Mike Bayer [Sun, 28 Jan 2007 23:33:53 +0000 (23:33 +0000)]
merged the polymorphic relationship refactoring branch in. i want to go further on that branch and introduce the foreign_keys argument, and further centralize the "intelligence" about the joins and selectables into PropertyLoader so that lazyloader/sync can be simplified, but the current branch goes pretty far.
- relations keep track of "polymorphic_primaryjoin", "polymorphic_secondaryjoin" which it derives from the plain primaryjoin/secondaryjoin.
- lazy/eagerloaders work from those polymorphic join objects.
- the join exported by PropertyLoader to Query/SelectResults is the polymorphic join, so that join_to/etc work properly.
- Query builds itself against the base Mapper again, not the "polymorphic" mapper. uses the "polymorphic" version
only as appropriate. this helps join_by/join_to/etc to work with polymorphic mappers.
- Query will also adapt incoming WHERE criterion to the polymorphic mapper, i.e. the "people" table becomes the "person_join" automatically.
- quoting has been modified since labels made out of non-case-sensitive columns could themselves require quoting..so case_sensitive defaults to True if not otherwise specified (used to be based on the identifier itself).
- the test harness gets an ORMTest base class and a bunch of the ORM unit tests are using it now, decreases a lot of redundancy.
Mike Bayer [Wed, 24 Jan 2007 23:37:03 +0000 (23:37 +0000)]
- calling corresponding_column with keys_ok matches columns on name, not key, since
the name is meaningful with regards to SQL relationships, the key is not
- adjustments to the recent polymorphic relationship refactorings, specifically
for many-to-one relationships to polymorphic unions that did not contain the
base table [ticket:439]. the lazy/eager clause adaption to the selectable
will match up on straight column names (i.e. its a more liberal policy)
- lazy loader will not attempt to adapt the clause to the selectable if
loads_polymorphic is not enabled, since the more liberal policy of adapting
columns fails for more elaborate join conditions
- will have to see if ppl want to do complex joins with polymorphic relations...
may have to add "polymorphic_primaryjoin" in that case as a last resort (would make
working around these issues a snap, tho...)
Mike Bayer [Wed, 24 Jan 2007 03:21:26 +0000 (03:21 +0000)]
oracle can conditionally decide if it wants to say "use rowid" in a select statement.
needs to be tweaked vs. when ROW NUMBER OVER ORDER BY is being used, but currently
fixes [ticket:436]
Mike Bayer [Tue, 23 Jan 2007 20:25:48 +0000 (20:25 +0000)]
- *slight* support for binary, but still need to figure out how to insert reasonably large
values (over 4K). requires auto_setinputsizes=True sent to create_engine(), rows must
be fully fetched individually, etc.
Mike Bayer [Tue, 23 Jan 2007 04:05:07 +0000 (04:05 +0000)]
relationships no longer compile against the "selectable" mapper (i.e. the polymorphic mapper). join conditions, foreign keys etc. are configured against the actual mappers used in the relationship in all cases. the lazy and eager loaders in turn "adapt" their lazy/eager clauses to that of the "selectable" mapper if one is present. this is because the join conditions between the mapper's base tables are *far* easier to work with and detect direction etc. compared to an enormous polymorphic union; dealing with the polymorphic union is pushed further out into select query construction.
Mike Bayer [Sat, 20 Jan 2007 21:00:08 +0000 (21:00 +0000)]
- mysql table create options work on a generic passthru now, i.e. Table(..., mysql_engine='InnoDB',
mysql_collate="latin1_german2_ci", mysql_auto_increment="5", mysql_<somearg>...),
helps [ticket:418]
Mike Bayer [Sat, 20 Jan 2007 12:31:27 +0000 (12:31 +0000)]
- tightened down conditions used to locate "relation direction", associating
the "foreignkey" of the relationship with the "primaryjoin". the column match now
must be exact, not just "corresponding". this enables self-referential relationships on a
polymorphic mapper.
- a little bit of improvement to the concept of a "concrete" inheritance mapping, though that concept
is not well fleshed out yet (added test case to support concrete mappers on top of a polymorphic base).
Mike Bayer [Fri, 19 Jan 2007 20:32:13 +0000 (20:32 +0000)]
- changed "BooleanExpression" to subclass from "BinaryExpression", so that boolean
expressions can also follow column-clause behaviors (i.e. label(), etc).
- query.select() had to become more picky about what it considers to be a full "selectable"
and what it considers to be a fragment that represents a WHERE criterion - looks for the presence
of a FromClause now (which is still pretty liberal, since i originally intended the check to be
for select() only). the previous exception-catch method also added a little stack tracing
overhead anyway.
Mike Bayer [Fri, 19 Jan 2007 02:19:38 +0000 (02:19 +0000)]
- another fix to subquery correlation so that a subquery which has only one FROM
element will *not* correlate that single element, since at least one FROM element is
required in a query.
Mike Bayer [Thu, 18 Jan 2007 03:33:13 +0000 (03:33 +0000)]
- some deeper error checking when compiling relations, to detect an ambiguous "primaryjoin"
in the case that both sides of the relationship have foreign key references in the primary
join condition
Mike Bayer [Mon, 15 Jan 2007 21:54:16 +0000 (21:54 +0000)]
- added optional constructor to sql.ColumnCollection
- mapper sets its "primary_key" attribute to be the ultimately decided primary_key column collection post-compilation
- added compare() method to MapperProperty, defines a comparison operation of the columns represented by the property to some value
- all the above combines into today's controversial feature: saying query.select_by(somerelationname=someinstance) will create the join of the primary key columns represented by "somerelationname"'s mapper to the actual primary key in "someinstance".
- docs for the above
Mike Bayer [Sun, 14 Jan 2007 20:21:36 +0000 (20:21 +0000)]
- postgres cursor option is now server_side_cursors=False; some users get bad results using them
so theyre off by default
- type system slightly modified to support TypeDecorators that can be overridden by the dialect
- added an NVarchar type to mssql (produces NVARCHAR), also MSUnicode which provides Unicode-translation
for the NVarchar regardless of dialect convert_unicode setting.
Mike Bayer [Fri, 12 Jan 2007 01:57:41 +0000 (01:57 +0000)]
- mysql is inconsistent with what kinds of quotes it uses in foreign keys during a
SHOW CREATE TABLE, reflection updated to accomodate for all three styles [ticket:420]
Mike Bayer [Wed, 10 Jan 2007 07:49:37 +0000 (07:49 +0000)]
- postgres no longer uses client-side cursors, uses more efficient server side
cursors via apparently undocumented psycopg2 behavior recently discovered on the
mailing list. disable it via create_engine('postgres://', client_side_cursors=True)
Mike Bayer [Mon, 8 Jan 2007 19:09:02 +0000 (19:09 +0000)]
- the "op()" function is now treated as an "operation", rather than a "comparison".
the difference is, an operation produces a BinaryExpression from which further operations
can occur whereas comparison produces the more restrictive BooleanExpression
Mike Bayer [Sat, 6 Jan 2007 20:32:47 +0000 (20:32 +0000)]
- added a mutex to the mapper compilation step. ive been reluctant to add any kind
of threading anything to SA but this is one spot that its its really needed since mappers
are typically "global", and while their state does not change during normal operation, the
initial compilation step does modify internal state significantly, and this step usually
occurs not at module-level initialization time (unless you call compile()) but at first-request
time
- added "compile_mappers()" function as a shortcut to compiling all mappers
Mike Bayer [Fri, 5 Jan 2007 18:51:23 +0000 (18:51 +0000)]
- default "timezone" setting is now False. this corresponds to Python's datetime
behavior as well as Postgres' timestamp/time types (which is the only timezone-sensitive
dialect at the moment) [ticket:414]
Mike Bayer [Tue, 2 Jan 2007 03:43:09 +0000 (03:43 +0000)]
- added "none" to the list of cascades, although im not sure if we should really allow "none" since it currently doesnt do anything (what should it do, cancel out the other cascades?)
Mike Bayer [Mon, 1 Jan 2007 00:10:37 +0000 (00:10 +0000)]
- global "insure"->"ensure" change. in US english "insure" is actually
largely interchangeable with "ensure" (so says the dictionary), so I'm not
completely illiterate, but its definitely sub-optimal to "ensure" which is
non-ambiguous.
Mike Bayer [Thu, 28 Dec 2006 00:27:58 +0000 (00:27 +0000)]
- fix to correlation of subqueries when the column list of the select statement
is constructed with individual calls to append_column(); this fixes an ORM
bug whereby nested select statements were not getting correlated with the
main select generated by the Query object.