Mike Bayer [Mon, 10 Mar 2008 17:14:08 +0000 (17:14 +0000)]
- a new super-small "declarative" extension has been added,
which allows Table and mapper() configuration to take place
inline underneath a class declaration. This extension differs
from ActiveMapper and Elixir in that it does not redefine
any SQLAlchemy semantics at all; literal Column, Table
and relation() constructs are used to define the class
behavior and table definition.
Mike Bayer [Mon, 10 Mar 2008 00:59:51 +0000 (00:59 +0000)]
- relation() can accept a callable for its first argument,
which returns the class to be related. This is in place
to assist declarative packages to define relations without
classes yet being in place.
Mike Bayer [Fri, 7 Mar 2008 03:16:46 +0000 (03:16 +0000)]
- moved property._is_self_referential() to be more generalized; returns True for any mapper.isa() relationship between parent and child, and indicates that aliasing should be used for any join/correlation across the relation. allows joins/any()/has() to work with inherited mappers referencing the parent etc.
- the original _is_self_referential() is now _refers_to_parent_table() and is only used during "direction" calculation to indicate the relation is from a single table to itself
Mike Bayer [Thu, 6 Mar 2008 18:44:45 +0000 (18:44 +0000)]
- added assert_raises() to TestBase class
- session.refresh() and session.expire() raise an error when
called on instances which are not persistent within the session
- session._validate_persistent() properly raises an error for false check
Mike Bayer [Thu, 6 Mar 2008 16:53:40 +0000 (16:53 +0000)]
- adjusted generative.py test for revised error message
- mapper with non_primary asserts primary mapper already created
- added any()/instance compare test to query
Mike Bayer [Tue, 4 Mar 2008 19:31:33 +0000 (19:31 +0000)]
- postgres PGArray is a "mutable" type by default;
when used with the ORM, mutable-style equality/
copy-on-write techniques are used to test for changes.
Mike Bayer [Sat, 1 Mar 2008 22:30:02 +0000 (22:30 +0000)]
- state.commit() and state.commit_all() now reconcile the current dict against expired_attributes
and unset the expired flag for those attributes. This is partially so that attributes are not
needlessly marked as expired after a two-phase inheritance load.
- fixed bug which was introduced in 0.4.3, whereby loading an
already-persistent instance mapped with joined table inheritance
would trigger a useless "secondary" load from its joined
table, when using the default "select" polymorphic_fetch.
This was due to attributes being marked as expired
during its first load and not getting unmarked from the
previous "secondary" load. Attributes are now unexpired
based on presence in __dict__ after any load or commit
operation succeeds.
Mike Bayer [Sat, 1 Mar 2008 01:46:23 +0000 (01:46 +0000)]
- fixed bug whereby session.expire() attributes were not
loading on an polymorphically-mapped instance mapped
by a select_table mapper.
- added query.with_polymorphic() - specifies a list
of classes which descend from the base class, which will
be added to the FROM clause of the query. Allows subclasses
to be used within filter() criterion as well as eagerly loads
the attributes of those subclasses.
Mike Bayer [Fri, 29 Feb 2008 21:54:40 +0000 (21:54 +0000)]
- setting the relation()-level order by to a column in the
many-to-many "secondary" table will now work with eager
loading, previously the "order by" wasn't aliased against
the secondary table's alias.
Mike Bayer [Mon, 25 Feb 2008 18:32:11 +0000 (18:32 +0000)]
- added exception wrapping/reconnect support to result set
fetching. Reconnect works for those databases that
raise a catchable data error during results
(i.e. doesn't work on MySQL) [ticket:978]
Mike Bayer [Fri, 22 Feb 2008 23:17:15 +0000 (23:17 +0000)]
- the value of a bindparam() can be a callable, in which
case it's evaluated at statement execution time to
get the value.
- expressions used in filter(), filter_by() and others,
when they make usage of a clause generated from a
relation using the identity of a child object
(e.g. filter(Parent.child==<somechild>)), evaluate
the actual primary key value of <somechild> at
execution time so that the autoflush step of the
Query can complete, thereby populating the PK value
of <somechild> in the case that <somechild> was
pending.
- cleanup of attributes.get_committed_value() to never return
the NO_VALUE value; evaluates to None
Mike Bayer [Thu, 21 Feb 2008 01:01:24 +0000 (01:01 +0000)]
- added a new "higher level" operator called "of_type()" -
used in join() as well as with any() and has(), qualifies
the subclass which will be used in filter criterion,
e.g.:
Mike Bayer [Sun, 17 Feb 2008 18:13:14 +0000 (18:13 +0000)]
- modernized cascade.py tests
- your cries have been heard: removing a pending item
from an attribute or collection with delete-orphan
expunges the item from the session; no FlushError is raised.
Note that if you session.save()'ed the pending item
explicitly, the attribute/collection removal still knocks
it out.
Mike Bayer [Sun, 17 Feb 2008 01:15:43 +0000 (01:15 +0000)]
- any(), has(), contains(), attribute level == and != now
work properly with self-referential relations - the clause
inside the EXISTS is aliased on the "remote" side to
distinguish it from the parent table.
Rick Morrison [Thu, 14 Feb 2008 18:03:57 +0000 (18:03 +0000)]
Added EXEC to MSSQL _is_select regexp; should now detect row-returning stored procedures
Added experimental implementation of limit/offset using row_number()
Mike Bayer [Tue, 12 Feb 2008 21:16:31 +0000 (21:16 +0000)]
- fixed bug introduced in r4070 where union() and other compound selects would not get
an OID column if it only contained one selectable element, due to missing return in _proxy_column()
- visit_column() calls itself to render a primary key col being used as the interpretation of the oid col instead of relying upon broken partial logic
Mike Bayer [Mon, 11 Feb 2008 19:22:34 +0000 (19:22 +0000)]
- added expire_all() method to Session. Calls expire()
for all persistent instances. This is handy in conjunction
with .....
- instances which have been partially or fully expired
will have their expired attributes populated during a regular
Query operation which affects those objects, preventing
a needless second SQL statement for each instance.
Mike Bayer [Mon, 11 Feb 2008 00:28:39 +0000 (00:28 +0000)]
- updated the naming scheme of the base test classes in test/testlib/testing.py;
tests extend from either TestBase or ORMTest, using additional mixins for
special assertion methods as needed
Mike Bayer [Sun, 10 Feb 2008 23:39:09 +0000 (23:39 +0000)]
- Table columns and constraints can be overridden on a
an existing table (such as a table that was already
reflected) using the 'useexisting=True' flag, which now
takes into account the arguments passed along with it.
- fixed one element of [ticket:910]
- refactored reflection test
Mike Bayer [Sat, 9 Feb 2008 01:48:19 +0000 (01:48 +0000)]
- lazy loader can now handle a join condition where the "bound"
column (i.e. the one that gets the parent id sent as a bind
parameter) appears more than once in the join condition.
Specifically this allows the common task of a relation()
which contains a parent-correlated subquery, such as "select
only the most recent child item". [ticket:946]
- col_is_part_of_mappings made more strict, seems to be OK
with tests
- memusage will dump out the size list in an assertion fail
Mike Bayer [Sat, 9 Feb 2008 01:24:01 +0000 (01:24 +0000)]
heisenbug in aisle 3
(when db.dispose is called in unitofwork test with sqlite, the first test that runs in memusage grows by two gc'ed objects on every iteration; then the problem vanishes. doesnt matter what test runs in memusage. doing a dispose() in memusage solves the problem also. screwing wiht the mechanics of engine.dispose() only fix it when both the pool.dispose() *and* the pool.ressurect() are disabled. its just a subtle python/pysqlite bug afaict)
Mike Bayer [Fri, 8 Feb 2008 22:57:45 +0000 (22:57 +0000)]
- added generative where(<criterion>) method to delete()
and update() constructs which return a new object with
criterion joined to existing criterion via AND, just
like select().where().
- compile assertions use assertEquals()