Mike Bayer [Thu, 26 Jul 2007 17:11:37 +0000 (17:11 +0000)]
- changed 'desired_columns' argument to 'include_columns'
- made 'include_columns' an explicit argument to Table. I'm
trying to avoid the "x can be a foo, or a bar, or a list of dictionaries of hoho's"-type behavior
- added unit test, closes [ticket:561]
Mike Bayer [Thu, 26 Jul 2007 07:19:37 +0000 (07:19 +0000)]
- ANSICompiler now uses its own traversal when compiling, returning a composed
string from each visit_XXXX method, so that the full string is compiled at once
without using any dictionary storage. dialects modified accordingly.
tested on mysql/sqlite/postgres fully,
tested with string-only tests for oracle/fb/informix/mssql so far.
Jason Kirtland [Wed, 25 Jul 2007 22:02:49 +0000 (22:02 +0000)]
Really finish proxied list methods. Either these last couple (count, remove, setitem w/ slice) weren't possible in 0.3 and/or I spaced these.
Improved messaging on flubbed stepped slice assignment in collection decorators.
Mike Bayer [Wed, 25 Jul 2007 18:57:56 +0000 (18:57 +0000)]
- added unittest for sharding module
- fixed shard test/example datatype to "Float" since Numeric
behavior has changed
- added docstrings to sqlalchemy/orm/__init__.py functions;
still need to proof within generated HTML pages/fix errors
- added engine.threadlocal to docs, removed old mods.threadlocal
Mike Bayer [Tue, 24 Jul 2007 22:00:19 +0000 (22:00 +0000)]
- added has(), like any() but for scalars
- added **kwargs to has() and any(), criterion is optional; generate equality criterion
against the related table (since we know the related property when has() and any() are used),
i.e. filter(Address.user.has(name='jack')) equivalent to filter(Address.user.has(User.name=='jack'))
- added "from_joinpoint=False" arg to join()/outerjoin(). yes, I know join() is getting a little
crazy, but this flag is needed when you want to keep building along a line of aliased joins,
adding query criterion for each alias in the chain. self-referential unit test added.
- fixed basic_tree example a little bit
Mike Bayer [Tue, 24 Jul 2007 20:05:10 +0000 (20:05 +0000)]
- deprecated scalar=True argument on select(). its replaced
by select().scalar() which returns a _ScalarSelect object, that obeys
the ColumnElement interface fully
- removed _selectable() method. replaced with __selectable__() as an optional
duck-typer; subclassing Selectable (without any __selectable__()) is equivalent
- query._col_aggregate() was assuming bound metadata. ick !
- probably should deprecate ClauseElement.scalar(), in favor of ClauseElement.execute().scalar()...
otherwise might need to rename select().scalar()
Mike Bayer [Tue, 24 Jul 2007 16:36:14 +0000 (16:36 +0000)]
- Numeric and Float types now have an "asdecimal" flag; defaults to
True for Numeric, False for Float. when True, values are returned as
decimal.Decimal objects; when False, values are returned as float().
the defaults of True/False are already the behavior for PG and MySQL's
DBAPI modules. [ticket:646]
Mike Bayer [Tue, 24 Jul 2007 04:05:55 +0000 (04:05 +0000)]
- a rudimental sharding (horizontal scaling) system is introduced. This system
uses a modified Session which can distribute read and write operations among
multiple databases, based on user-defined functions defining the
"sharding strategy". Instances and their dependents can be distributed
and queried among multiple databases based on attribute values, round-robin
approaches or any other user-defined system. [ticket:618]
Mike Bayer [Mon, 23 Jul 2007 22:20:44 +0000 (22:20 +0000)]
- joined-table inheritance will now generate the primary key
columns of all inherited classes against the root table of the
join only. This implies that each row in the root table is distinct
to a single instance. If for some rare reason this is not desireable,
explicit primary_key settings on individual mappers will override it.
- When "polymorphic" flags are used with joined-table or single-table
inheritance, all identity keys are generated against the root class
of the inheritance hierarchy; this allows query.get() to work
polymorphically using the same caching semantics as a non-polymorphic get.
note that this currently does not work with concrete inheritance.
Mike Bayer [Mon, 23 Jul 2007 20:56:27 +0000 (20:56 +0000)]
ColumnDefault functions pass ExecutionContext to callables which accept a single argument;
refactored workings of defaults so that they share the same execution context.
Jason Kirtland [Mon, 23 Jul 2007 20:32:19 +0000 (20:32 +0000)]
_ConnectionRecord gains a .properties collection, with contents scoped to
the lifetime of the underlying DBAPI connection. Accessors on Connections and fairies.
Mike Bayer [Mon, 23 Jul 2007 15:52:09 +0000 (15:52 +0000)]
- refinement of connection.execute() , parameter processing behavior
- Connection's dealings with params are simplified; generation of
ClauseParameters pushed into DefaultDialect.
- simplified ClauseParameters.
- this is to make room for execute_raw() but I haven't decided how that
should look yet.
Jason Kirtland [Mon, 23 Jul 2007 01:50:54 +0000 (01:50 +0000)]
Refactored test support code, moved most into 'testlib/'
Cleaned up imports, all tests should be runnable stand-alone or suite now
Updated most of the perf tests
Removed dead test suites
Added new profiling decorator
Added new profilable perf test, 'ormsession' to try to capture a typical workload
Mike Bayer [Sun, 22 Jul 2007 19:35:46 +0000 (19:35 +0000)]
- fix to _CalculatedClause._copy_internals() behavior so that ClauseAdapter works with _Function objects better
- factored AliasedClauses out of EagerLoader into its own unit; Query makes heavy use of it for joins
- added support to Query for full interaction between aliased and nonalised joins with appended entities, columns, and externally-mapped columns
Mike Bayer [Sun, 22 Jul 2007 14:07:15 +0000 (14:07 +0000)]
- got self-referential query.join()/query.outerjoin() to work.
- PropertyLoader adds local_side set which is the opposite of remote_side, makes
the self-referential aliasing a snap.
- added "id" argument to join()/outerjoin() to allow access to the aliased joins
in add_entity().
- added "alias" argument to add_entity() to get at entities selected from an explicit
Alias
- starting to move EagerLoader.AliasedClasues to a general utility function which
will be used by Query as well
Mike Bayer [Sun, 22 Jul 2007 03:26:13 +0000 (03:26 +0000)]
filter_by([joinpath], ...) is gone. join([path], aliased=True) replaces it, all subsequent filter() criterion is converted
against that alias; represents a much more flexible and consistent solution.
needs some tweaks and can then work with self-referential loading too.
Mike Bayer [Fri, 20 Jul 2007 20:02:41 +0000 (20:02 +0000)]
- added query.populate_existing().. - marks the query to reload
all attributes and collections of all instances touched in the query,
including eagerly-loaded entities [ticket:660]
- added eagerload_all(), allows eagerload_all('x.y.z') to specify eager
loading of all properties in the given path
Mike Bayer [Fri, 20 Jul 2007 03:20:33 +0000 (03:20 +0000)]
- Eager loading now functions at any arbitrary depth along self-referential
and cyclical structures. When loading cyclical structures, specify "join_depth"
on relation() indicating how many times you'd like the table to join
to itself; each level gets a distinct table alias.
- adds a stack to the Mapper->eagerloader->Mapper process which is the single
point of tracking the various AliasedClause objects both at query compile
time as well as result fetching time. self-referential relationships narrow
down the "aliasing" of tables more sharply so as to produce the correct
eager joins in those cases without stepping on more generalized cases.
the mechanism of detecting "too deep" of an eager load now works based on
locating a true cycle, but only if join_depth is not specified; otherwise
join_depth is used.
[ticket:659]
Mike Bayer [Thu, 19 Jul 2007 20:36:51 +0000 (20:36 +0000)]
- changed set used to generate FROM list to an ordered set; may fix [ticket:669]
- improvements to select generative capability, ClauseAdapter
- one select test is failing, but not from this checkin
Mike Bayer [Thu, 19 Jul 2007 07:11:55 +0000 (07:11 +0000)]
- all "type" keyword arguments, such as those to bindparam(), column(),
Column(), and func.<something>(), renamed to "type_". those objects
still name their "type" attribute as "type".
- new SQL operator implementation which removes all hardcoded operators
from expression structures and moves them into compilation;
allows greater flexibility of operator compilation; for example, "+"
compiles to "||" when used in a string context, or "concat(a,b)" on
MySQL; whereas in a numeric context it compiles to "+". fixes [ticket:475].
- major cruft cleanup in ANSICompiler regarding its processing of update/insert
bind parameters. code is actually readable !
- a clause element embedded in an UPDATE, i.e. for a correlated update, uses
standard "grouping" rules now to place parenthesis. Doesn't change much, except
if you embed a text() clause in there, it will not be automatically parenthesized
(place parens in the text() manually).
Mike Bayer [Wed, 18 Jul 2007 21:00:14 +0000 (21:00 +0000)]
- unittest cleanup: after removal of threadlocal mod + changes to session calling signature,
got sqlite, postgres, mysql all working again (one unresolved failure for mysql)
Mike Bayer [Tue, 17 Jul 2007 22:38:54 +0000 (22:38 +0000)]
- changed the order of args to session.execute(), session.scalar()
- removed session.connect(). theres only connection()
- implemented twophase flag on session, twophase calls within SessionTransaction,
one unit test so far which tests that it succeeds (but doesnt test a failure yet or
do any mocking)
- rewrote session transaction docs
Mike Bayer [Tue, 17 Jul 2007 20:38:57 +0000 (20:38 +0000)]
- removed ancient threadlocal/legacy_session mods
- Session now has tranasaction API built into it, SessionTransaction not part of the usual API now (but still does the work)
- integrated nested transactions/SAVEPOINT with Session transactional system
- Session gets "transactional" mode, it always begins a transaction and reopens after commit/rollback
- Session gets "autoflush=True" flag, implies "transactional", issues a flush before the execution of every
query so that query results include whatever is currently in the session
- various unit test fixes
Mike Bayer [Tue, 17 Jul 2007 04:54:30 +0000 (04:54 +0000)]
- got in_() working, enhanced sql.py treatment of Comparator so comparators can be used in any SQL expression (i.e. order bys, desc(), etc.)
- adding various tests for new clause generation
Mike Bayer [Tue, 17 Jul 2007 04:25:09 +0000 (04:25 +0000)]
- added operator support to class-instrumented attributes. you can now
filter() (or whatever) using <classname>.<attributename>==<whatever>.
for column based properties, all column operators work (i.e. ==, <, >,
like(), in_(), etc.). For relation() and composite column properties,
==<instance>, !=<instance>, and ==<None> are implemented so far.
[ticket:643]
Mike Bayer [Tue, 17 Jul 2007 01:14:33 +0000 (01:14 +0000)]
- moved query._with_parent into prop.compare() calls
- built extensible operator framework in sql package, ORM
builds on top of it to shuttle python operator objects back down
to the individual columns. no relation() comparisons yet. implements
half of [ticket:643]
Jason Kirtland [Tue, 17 Jul 2007 00:41:45 +0000 (00:41 +0000)]
- Finish collections doc changes started in r2839, expanding coverage in
main documentation and docstrings.
- Per list discussion, removed backward compat. for dict- and object-derived
collection types. This is the safest course of action given the major
change in dict iterator behavior.
- Minor typos and code cleanups.
Mike Bayer [Mon, 16 Jul 2007 18:55:05 +0000 (18:55 +0000)]
- converted all anonymous labels and aliases to be generated within the compilation phase. this allows fully "deterministic" label generation. theres a couple of unit test failures that need to be fixed but most are passing.
- also some tweaks to unicode result column names; no longer chopping out characters from the names, since the name might be composed of all non-ascii characters. mysql needs some work here since its returning, i think, the unicode's internally-encoded bytes directly within a bytestring.
- need to simplify the amount of dictionaries present in ANSICompiler, its pretty hard to follow at this point.
Mike Bayer [Thu, 12 Jul 2007 18:34:48 +0000 (18:34 +0000)]
added some order_bys to eager relations, which otherwise load with different
ordering on PG. we might want to get eager relations on m2m to handle default order-by differently