Commit Graph

2085 Commits

Author SHA1 Message Date
Mike Bayer d65c25bcc9 - Fixed __repr__() and other _get_colspec() methods on
ForeignKey constructed from __clause_element__() style
construct (i.e. declarative columns).  [ticket:1353]
2009-03-27 21:41:36 +00:00
Mike Bayer 18106b5e5b - Fixed the "set collection" function on "dynamic" relations
to initiate events correctly.  Previously a collection
could only be assigned to a pending parent instance,
otherwise modified events would not be fired correctly.
Set collection is now compatible with merge(),
fixes [ticket:1352].
2009-03-27 19:54:10 +00:00
Mike Bayer 3223bafafe more tests 2009-03-24 01:22:38 +00:00
Mike Bayer 533a0ab955 - Fixed bug in dynamic_loader() where append/remove events
after construction time were not being propagated to the
      UOW to pick up on flush(). [ticket:1347]
2009-03-24 01:19:45 +00:00
Mike Bayer 0983b610b4 - An alias() of a select() will convert to a "scalar subquery"
when used in an unambiguously scalar context, i.e. it's used
in a comparison operation.  This applies to
the ORM when using query.subquery() as well.
2009-03-21 16:12:37 +00:00
Mike Bayer 53deb98918 - Query.join() can now construct multiple FROM clauses, if
needed.  Such as, query(A, B).join(A.x).join(B.y)
might say SELECT A.*, B.* FROM A JOIN X, B JOIN Y.
Eager loading can also tack its joins onto those
multiple FROM clauses.  [ticket:1337]
2009-03-15 03:02:42 +00:00
Mike Bayer 3f0252abc7 - Fixed bug where column_prefix wasn't being checked before
not mapping an attribute that already had class-level
      name present.
2009-03-11 21:45:57 +00:00
Mike Bayer 68ee348d36 - a forward and complementing backwards reference which are both
of the same direction, i.e. ONETOMANY or MANYTOONE,
is now detected, and an error message is raised.
Saves crazy CircularDependencyErrors later on.
2009-03-09 01:20:29 +00:00
Mike Bayer 1b5d224df5 take 2 2009-03-08 19:40:12 +00:00
Mike Bayer dc7974deae attempt to exlude sqlite 3.5.9 and below, for buildbot failure. not clear which version of sqlite fixes this particular issue 2009-03-08 19:29:56 +00:00
Mike Bayer de06f512db - Query.group_by() properly takes into account aliasing applied
to the FROM clause, such as with select_from(), using
with_polymorphic(), or using from_self().
2009-03-08 19:06:12 +00:00
Mike Bayer 3953fe0ad4 some buildbot fixes 2009-03-08 02:35:46 +00:00
Mike Bayer b84c3b3469 - The "objects" argument to session.flush() is deprecated.
State which represents the linkage between a parent and
child object does not support "flushed" status on
one side of the link and not the other, so supporting
this operation leads to misleading results.
[ticket:1315]
2009-03-01 23:53:58 +00:00
Mike Bayer 77d6d31542 - Added PGUuid and PGBit types to
sqlalchemy.databases.postgres. [ticket:1327]

- Refection of unknown PG types won't crash when those
types are specified within a domain.  [ticket:1327]

- executemany() in conjunction with INSERT..RETURNING is documented as undefined by psycopg2.
2009-03-01 20:24:02 +00:00
Mike Bayer 8d295ec118 - Fixed adaptation of EXISTS clauses via any(), has(), etc.
in conjunction with an aliased object on the left and
of_type() on the right.  [ticket:1325]
2009-02-26 15:16:06 +00:00
Mike Bayer a8021432b8 - pared down private and semi-private functions in the attributes package.
- simplified the process of establishment and unestablishment of
class management from a mapper perspective; class manager setup/teardown
is now symmetric (ClassManager would never be fully de-associated previously).
- class manager now unconditionally decorates __init__.  this has a slight
behavior change for an unmapped subclass of a mapped superclass, in that
InstanceState creation corresponds to that of the superclass.  This
still doesn't allow unmapped subclasses to be usable in mapper
situations, though.
2009-02-23 00:08:37 +00:00
Mike Bayer b60185a078 - Declarative will accept a table-bound column as a property
when used in conjunction with __table__, if the column is already
present in __table__.  The column will be remapped to the given
key the same way as when added to the mapper() properties dict.
2009-02-22 19:35:36 +00:00
Mike Bayer e8b57a47cd - Query won't fail with weakref error when a non-mapper/class
instrumented descriptor is passed, raises
"Invalid column expession".
2009-02-20 15:45:25 +00:00
Mike Bayer 734e02c4f1 - Declarative locates the "inherits" class using a search
through __bases__, to skip over mixins that are local
to subclasses.
2009-02-19 15:48:37 +00:00
Mike Bayer 911c7b9b36 - Session.scalar() now converts raw SQL strings to text()
the same way Session.execute() does and accepts same
alternative **kw args.
2009-02-17 23:10:52 +00:00
Mike Bayer 38c9a5be50 - Declarative will properly interpret the "foreign_keys" argument
on a backref() if it's a string.
2009-02-17 22:09:30 +00:00
Mike Bayer 689a144a71 - Fixed a recursive pickling issue in serializer, triggered
by an EXISTS or other embedded FROM construct.
2009-02-17 12:56:48 +00:00
Mike Bayer 1de9012573 - annotations store 'parententity' as well as 'parentmapper'
- ORMAdapter filters all replacements against a non-compatible 'parentmapper' annotation
- Other filterings, like
query(A).join(A.bs).filter(B.foo=='bar'), were erroneously
adapting "B.foo" as though it were an "A".
2009-02-13 18:08:40 +00:00
Mike Bayer f180cc0c9f - Fixed bugs in Query regarding simultaneous selection of
multiple joined-table inheritance entities with common base
classes, previously the adaption applied to "e2" on
"e1 JOIN e2" would be partially applied to "e1".  Additionally,
comparisons on relations (i.e. Entity2.related==e2)
were not getting adapted correctly.
2009-02-13 17:14:05 +00:00
Mike Bayer 2d6b3f09eb move test by itself so that no fixture data is inserted 2009-02-12 16:02:23 +00:00
Mike Bayer 1d3185139a - a session.expire() on a particular collection attribute
will clear any pending backref additions as well, so that
the next access correctly returns only what was present
in the database.  Presents some degree of a workaround for
[ticket:1315], although we are considering removing the
flush([objects]) feature altogether.
2009-02-11 20:38:30 +00:00
Mike Bayer 03b5b34114 - anonymous alias names now truncate down to the max length
allowed by the dialect.  More significant on DBs like
Oracle with very small character limits. [ticket:1309]
2009-02-10 01:20:45 +00:00
Mike Bayer 6336e55069 need sizes for mysql 2009-02-07 22:18:40 +00:00
Mike Bayer 2dba55cb27 - When flushing partial sets of objects using session.flush([somelist]),
pending objects which remain pending after the operation won't
inadvertently be added as persistent. [ticket:1306]
2009-02-07 21:57:30 +00:00
Mike Bayer 1c751e3ddb - PG Index reflection won't fail when an index with
multiple expressions is encountered.
2009-02-03 00:22:01 +00:00
Mike Bayer e39b98ca7b - Fixed missing _label attribute on Function object, others
when used in a select() with use_labels (such as when used
in an ORM column_property()).  [ticket:1302]
2009-02-01 18:20:20 +00:00
Michael Trier 4b252f659e Added a few IDENTITY tests for mssql. 2009-01-31 21:20:04 +00:00
Mike Bayer 0749bc3850 appease older sqlite version 2009-01-29 17:03:49 +00:00
Mike Bayer 10dbde43db - The per-dialect cache used by TypeEngine to cache
dialect-specific types is now a WeakKeyDictionary.
This to prevent dialect objects from
being referenced forever for an application that
creates an arbitrarily large number of engines
or dialects.   There is a small performance penalty
which will be resolved in 0.6.  [ticket:1299]
2009-01-29 16:09:14 +00:00
Mike Bayer 966119f4d3 - improvements to the "determine direction" logic of
relation() such that the direction of tricky situations
like mapper(A.join(B)) -> relation-> mapper(B) can be
determined.
2009-01-29 06:40:29 +00:00
Mike Bayer 22b32da23a unit test fixes 2009-01-28 16:00:16 +00:00
Mike Bayer 397ba5d73d - _CalculatedClause is gone
- Function rolls the various standalone execution functionality of CC into itself,
accesses its internal state more directly
- collate just uses _BinaryExpression, don't know why it didn't do this already
- added new _Case construct, compiles directly
- the world is a happier place
2009-01-28 01:28:20 +00:00
Mike Bayer 7e7aa8f7c2 - Query now implements __clause_element__() which produces
its selectable, which means a Query instance can be accepted
in many SQL expressions, including col.in_(query),
union(query1, query2), select([foo]).select_from(query),
etc.

- the __selectable__() interface has been replaced entirely
by __clause_element__().
2009-01-27 01:05:20 +00:00
Mike Bayer c10104f0a8 - refined and clarified query.__join() for readability
- _ORMJoin() gets a new flag join_to_left to specify if
we really want to alias from the existing left side or not.  eager loading
wants this flag off in almost all cases, query.join() usually wants it on.
- query.join()/outerjoin() will now properly join an aliased()
construct to the existing left side, even if query.from_self()
or query.select_from(someselectable) has been called.
[ticket:1293]
2009-01-24 17:29:56 +00:00
Mike Bayer a03aed2dca - session.expire() and related methods will not expire() unloaded
deferred attributes.  This prevents them from being needlessly
loaded when the instance is refreshed.
2009-01-24 00:22:49 +00:00
Mike Bayer fc7de2aafd - Fixed an eager loading bug whereby self-referential eager
loading would prevent other eager loads, self referential or not,
from joining to the parent JOIN properly.  Thanks to Alex K
for creating a great test case.
2009-01-22 18:28:27 +00:00
Mike Bayer 3954df86cb - Adjusted the attribute instrumentation change from 0.5.1 to
fully establish instrumentation for subclasses where the mapper
was created after the superclass had already been fully
instrumented. [ticket:1292]
2009-01-22 03:55:48 +00:00
Michael Trier a7459fe1ab Trying one more time to get the decimal handling on mssql right. Closes #1282. 2009-01-22 01:55:06 +00:00
Michael Trier 52e2c2d916 Restored convert_unicode handling on mssql. Fixes #1291. 2009-01-22 01:46:04 +00:00
Mike Bayer 7c56371f81 - Further refined 0.5.1's warning about delete-orphan cascade
placed on a many-to-many relation.   First, the bad news:
the warning will apply to both many-to-many as well as
many-to-one relations.  This is necessary since in both
cases, SQLA does not scan the full set of potential parents
when determining "orphan" status - for a persistent object
it only detects an in-python de-association event to establish
the object as an "orphan".  Next, the good news: to support
one-to-one via a foreign key or assocation table, or to
support one-to-many via an association table, a new flag
single_parent=True may be set which indicates objects
linked to the relation are only meant to have a single parent.
The relation will raise an error if multiple parent-association
events occur within Python.

- Fixed bug in delete-orphan cascade whereby two one-to-one
relations from two different parent classes to the same target
class would prematurely expunge the instance.  This is
an extension of the non-ticketed fix in r4247.

- the order of "sethasparent" flagging in relation to
AttributeExtensions has been refined such that false setparents
are issued before the event, true setparents issued afterwards.
event handlers "know" that a remove event originates
from a non-orphan but need to know if its become an orphan,
and that append events will become non-orphans but need to know
if the event originates from a non-orphan.
2009-01-20 21:35:57 +00:00
Mike Bayer c1384f4c83 remove comparison/group by on TEXT columns 2009-01-19 22:28:48 +00:00
Mike Bayer 072039945b - Further fixes to the "percent signs and spaces in column/table
names" functionality. [ticket:1284]
- Still doesn't work for PG/MySQL, which unfortunately would require
post_process_text() calls all over the place.  Perhaps % escaping
can be assembled into IdentifierPreparer.quote() since that's where
identifier names are received.
2009-01-18 17:08:28 +00:00
Michael Trier 27c4e7aade Corrected handling of large decimal values on mssql. Added more robust tests.
- Removed string manipulation on floats. Float types are now passed through
  to mssql as is.
- Fixes #1280
2009-01-17 20:57:18 +00:00
Mike Bayer f5eca3933e more session updates 2009-01-17 20:06:54 +00:00
Mike Bayer 2ab5b4f30c fix errant foreign key 2009-01-17 19:28:46 +00:00