Mike Bayer [Sun, 26 Apr 2009 21:57:18 +0000 (21:57 +0000)]
- Allowed pickling of PropertyOption objects constructed with
instrumented descriptors; previously, pickle errors would occur
when pickling an object which was loaded with a descriptor-based
option, such as query.options(eagerload(MyClass.foo)).
Mike Bayer [Sat, 11 Apr 2009 20:20:38 +0000 (20:20 +0000)]
- Fixed a unit of work issue whereby the foreign
key attribute on an item contained within a collection
owned by an object being deleted would not be set to
None if the relation() was self-referential. [ticket:1376]
Mike Bayer [Thu, 2 Apr 2009 14:53:28 +0000 (14:53 +0000)]
- Fixed bug in relation(), introduced in 0.5.3,
whereby a self referential relation
from a base class to a joined-table subclass would
not configure correctly.
Michael Trier [Tue, 31 Mar 2009 22:31:08 +0000 (22:31 +0000)]
Lots of fixes to the code examples to specify imports explicitly.
Explicit imports make it easier for users to understand the examples.
Additionally a lot of the examples were fixed to work with the changes in the
0.5.x code base. One small correction to the Case expression. Thanks a bunch
to Adam Lowry! Fixes #717.
Mike Bayer [Tue, 31 Mar 2009 14:57:19 +0000 (14:57 +0000)]
- Fixed another location where autoflush was interfering
with session.merge(). autoflush is disabled completely
for the duration of merge() now. [ticket:1360]
Mike Bayer [Sun, 29 Mar 2009 21:21:10 +0000 (21:21 +0000)]
- Lazy loader will not use get() if the "lazy load"
SQL clause matches the clause used by get(), but
contains some parameters hardcoded. Previously
the lazy strategy would fail with the get(). Ideally
get() would be used with the hardcoded parameters
but this would require further development.
[ticket:1357]
Mike Bayer [Fri, 27 Mar 2009 21:41:36 +0000 (21:41 +0000)]
- Fixed __repr__() and other _get_colspec() methods on
ForeignKey constructed from __clause_element__() style
construct (i.e. declarative columns). [ticket:1353]
Mike Bayer [Fri, 27 Mar 2009 19:54:10 +0000 (19:54 +0000)]
- 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].
Mike Bayer [Tue, 24 Mar 2009 01:19:45 +0000 (01:19 +0000)]
- 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]
Mike Bayer [Sat, 21 Mar 2009 16:12:37 +0000 (16:12 +0000)]
- 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.
Mike Bayer [Tue, 17 Mar 2009 15:09:49 +0000 (15:09 +0000)]
- Fixed SQLite reflection methods so that non-present
cursor.description, which triggers an auto-cursor
close, will be detected so that no results doesn't
fail on recent versions of pysqlite which raise
an error when fetchone() called with no rows present.
Mike Bayer [Sun, 15 Mar 2009 03:02:42 +0000 (03:02 +0000)]
- 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]
Mike Bayer [Mon, 9 Mar 2009 01:20:29 +0000 (01:20 +0000)]
- 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.
Mike Bayer [Sun, 8 Mar 2009 19:06:12 +0000 (19:06 +0000)]
- 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().
Mike Bayer [Sun, 1 Mar 2009 23:53:58 +0000 (23:53 +0000)]
- 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]
Mike Bayer [Thu, 26 Feb 2009 15:16:06 +0000 (15:16 +0000)]
- 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]
Mike Bayer [Mon, 23 Feb 2009 00:08:37 +0000 (00:08 +0000)]
- 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.
Mike Bayer [Sun, 22 Feb 2009 19:35:36 +0000 (19:35 +0000)]
- 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.
Mike Bayer [Mon, 16 Feb 2009 23:49:53 +0000 (23:49 +0000)]
- Declarative figures out joined-table inheritance primary join
condition even if "inherits" mapper argument is given
explicitly. Allows mixins to be used with joined table
inheritance.
Mike Bayer [Sun, 15 Feb 2009 20:43:14 +0000 (20:43 +0000)]
- Added an attribute helper method ``set_committed_value`` in
sqlalchemy.orm.attributes. Given an object, attribute name,
and value, will set the value on the object as part of its
"committed" state, i.e. state that is understood to have
been loaded from the database. Helps with the creation of
homegrown collection loaders and such.
- documented public attributes helper functions.
Mike Bayer [Fri, 13 Feb 2009 18:08:40 +0000 (18:08 +0000)]
- 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".
Mike Bayer [Fri, 13 Feb 2009 17:14:05 +0000 (17:14 +0000)]
- 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.
Mike Bayer [Wed, 11 Feb 2009 20:38:30 +0000 (20:38 +0000)]
- 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.
Mike Bayer [Tue, 10 Feb 2009 01:20:45 +0000 (01:20 +0000)]
- 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]
Mike Bayer [Sat, 7 Feb 2009 21:57:30 +0000 (21:57 +0000)]
- 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]
Mike Bayer [Sun, 1 Feb 2009 18:20:20 +0000 (18:20 +0000)]
- 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]
Mike Bayer [Thu, 29 Jan 2009 16:09:14 +0000 (16:09 +0000)]
- 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]
Mike Bayer [Thu, 29 Jan 2009 06:40:29 +0000 (06:40 +0000)]
- 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.
Mike Bayer [Wed, 28 Jan 2009 01:28:20 +0000 (01:28 +0000)]
- _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
Mike Bayer [Tue, 27 Jan 2009 01:05:20 +0000 (01:05 +0000)]
- 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__().
Mike Bayer [Sat, 24 Jan 2009 17:29:56 +0000 (17:29 +0000)]
- 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]
Mike Bayer [Sat, 24 Jan 2009 00:22:49 +0000 (00:22 +0000)]
- session.expire() and related methods will not expire() unloaded
deferred attributes. This prevents them from being needlessly
loaded when the instance is refreshed.