Mike Bayer [Tue, 15 Jan 2008 17:59:27 +0000 (17:59 +0000)]
finally, a really straightforward reduce() method which reduces cols
to the minimal set for every test case I can come up with, and
now replaces all the cruft in Mapper._compile_pks() as well as
Join.__init_primary_key(). mappers can now handle aliased selects
and figure out the correct PKs pretty well [ticket:933]
Mike Bayer [Mon, 14 Jan 2008 04:20:26 +0000 (04:20 +0000)]
- query.join() can now accept class-mapped attributes
as arguments, which can be used in place or in any
combination with strings. In particular this allows
construction of joins to subclasses on a polymorphic
relation, i.e.
query(Company).join(['employees', Engineer.name]),
etc.
Mike Bayer [Mon, 14 Jan 2008 02:45:30 +0000 (02:45 +0000)]
- applying some refined versions of the ideas in the smarter_polymorphic
branch
- slowly moving Query towards a central "aliasing" paradigm which merges
the aliasing of polymorphic mappers to aliasing against arbitrary select_from(),
to the eventual goal of polymorphic mappers which can also eagerload other
relations
- supports many more join() scenarios involving polymorphic mappers in
most configurations
- PropertyAliasedClauses doesn't need "path", EagerLoader doesn't need to
guess about "towrap"
Mike Bayer [Sun, 13 Jan 2008 19:04:55 +0000 (19:04 +0000)]
- _get_equivalents() converted into a lazy-initializing property; Query was calling it
for polymorphic loads which is really expensive
- surrogate_mapper adapts the given order_by, so that order_by can be against the mapped
table and is usable for sub-mappers as well. Query properly calls select_mapper.order_by.
Jason Kirtland [Sat, 12 Jan 2008 22:03:42 +0000 (22:03 +0000)]
- testbase is gone, replaced by testenv
- Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase
- testing.db has the configured db
- Fixed up the perf/* scripts
Jason Kirtland [Fri, 11 Jan 2008 01:28:43 +0000 (01:28 +0000)]
- Warnings are now issued as SAWarning instead of RuntimeWarning; util.warn() wraps this up.
- SADeprecationWarning has moved to exceptions. An alias remains in logging until 0.5.
Mike Bayer [Thu, 10 Jan 2008 22:32:51 +0000 (22:32 +0000)]
- added a mapper() flag "eager_defaults"; when set to
True, defaults that are generated during an INSERT
or UPDATE operation are post-fetched immediately,
instead of being deferred until later. This mimics
the old 0.3 behavior.
Mike Bayer [Mon, 7 Jan 2008 18:52:02 +0000 (18:52 +0000)]
- fixed an attribute history bug whereby assigning a new collection
to a collection-based attribute which already had pending changes
would generate incorrect history [ticket:922]
- fixed delete-orphan cascade bug whereby setting the same
object twice to a scalar attribute could log it as an orphan
[ticket:925]
- generative select.order_by(None) / group_by(None) was not managing to
reset order by/group by criterion, fixed [ticket:924]
Mike Bayer [Sun, 6 Jan 2008 20:32:45 +0000 (20:32 +0000)]
- fixed bug which could occur with polymorphic "union" mapper
which falls back to "deferred" loading of inheriting tables
- the "columns" collection on a mapper/mapped class (i.e. 'c')
is against the mapped table, not the select_table in the
case of polymorphic "union" loading (this shouldn't be
noticeable)
Mike Bayer [Sat, 5 Jan 2008 23:27:02 +0000 (23:27 +0000)]
- synonyms can now be created against props that don't exist yet,
which are later added via add_property(). This commonly includes
backrefs. (i.e. you can make synonyms for backrefs without
worrying about the order of operations) [ticket:919]
Mike Bayer [Sat, 5 Jan 2008 22:59:18 +0000 (22:59 +0000)]
- changed name of TEXT to Text since its a "generic" type; TEXT name is
deprecated until 0.5. The "upgrading" behavior of String to Text
when no length is present is also deprecated until 0.5; will issue a
warning when used for CREATE TABLE statements (String with no length
for SQL expression purposes is still fine) [ticket:912]
Jason Kirtland [Sat, 5 Jan 2008 21:56:22 +0000 (21:56 +0000)]
Added 'function_call_count' assertion decorator. The full-suite vs. isolated run call count discrepancy needs to be ironed out before this can be applied to zoomark.
Mike Bayer [Sat, 5 Jan 2008 18:26:28 +0000 (18:26 +0000)]
- fixed fairly critical bug whereby the same instance could be listed
more than once in the unitofwork.new collection; most typically
reproduced when using a combination of inheriting mappers and
ScopedSession.mapper, as the multiple __init__ calls per instance
could save() the object with distinct _state objects
Mike Bayer [Wed, 2 Jan 2008 23:13:02 +0000 (23:13 +0000)]
- added very rudimentary yielding iterator behavior to Query. Call
query.yield_per(<number of rows>) and evaluate the Query in an
iterative context; every collection of N rows will be packaged up
and yielded. Use this method with extreme caution since it does
not attempt to reconcile eagerly loaded collections across
result batch boundaries, nor will it behave nicely if the same
instance occurs in more than one batch. This means that an eagerly
loaded collection will get cleared out if it's referenced in more than
one batch, and in all cases attributes will be overwritten on instances
that occur in more than one batch.
Mike Bayer [Wed, 2 Jan 2008 01:29:38 +0000 (01:29 +0000)]
- further fix to new TypeDecorator, so that subclasses of TypeDecorators work properly
- _handle_dbapi_exception() usage changed so that unwrapped exceptions can be rethrown with the original stack trace
Mike Bayer [Sat, 29 Dec 2007 20:13:50 +0000 (20:13 +0000)]
- added is_disconnect() support for oracle
- fixed _handle_dbapi_error to detect endless loops, doesn't call rollback/cursor.close
etc. in case of disconnect
Mike Bayer [Sat, 29 Dec 2007 19:20:38 +0000 (19:20 +0000)]
- mapped classes which extend "object" and do not provide an
__init__() method will now raise TypeError if non-empty *args
or **kwargs are present at instance construction time (and are
not consumed by any extensions such as the scoped_session mapper),
consistent with the behavior of normal Python classes [ticket:908]
Mike Bayer [Sat, 29 Dec 2007 18:33:27 +0000 (18:33 +0000)]
- MapperExtension.before_update() and after_update() are now called
symmetrically; previously, an instance that had no modified column
attributes (but had a relation() modification) could be called with
before_update() but not after_update() [ticket:907]
Mike Bayer [Fri, 21 Dec 2007 16:20:46 +0000 (16:20 +0000)]
- disabled the "populate expired/deferred attributes as we come across them" functionality in mapper._instance(), as its not completed, doesn't properly handle mutable scalar attributes, and has poor test coverage
Mike Bayer [Fri, 21 Dec 2007 06:57:20 +0000 (06:57 +0000)]
- reworked all lazy/deferred/expired callables to be
serializable class instances, added pickling tests
- cleaned up "deferred" polymorphic system so that the
mapper handles it entirely
- columns which are missing from a Query's select statement
now get automatically deferred during load.
Mike Bayer [Thu, 20 Dec 2007 02:37:48 +0000 (02:37 +0000)]
- inheriting mappers now inherit the MapperExtensions of their parent
mapper directly, so that all methods for a particular MapperExtension
are called for subclasses as well. As always, any MapperExtension
can return either EXT_CONTINUE to continue extension processing
or EXT_STOP to stop processing. The order of mapper resolution is:
<extensions declared on the classes mapper> <extensions declared on the
classes' parent mapper> <globally declared extensions>.
Note that if you instantiate the same extension class separately
and then apply it individually for two mappers in the same inheritance
chain, the extension will be applied twice to the inheriting class,
and each method will be called twice.
To apply a mapper extension explicitly to each inheriting class but
have each method called only once per operation, use the same
instance of the extension for both mappers.
[ticket:490]
Rick Morrison [Wed, 19 Dec 2007 23:04:43 +0000 (23:04 +0000)]
Fix for autoload of non-identity PK integer columns [824]
Better datetime checking/conversion for pyodbc adodbapi [842]
Fix for autoloading schema-qualified tables [901]
Convert_unicode support for all dialects [839]
Mike Bayer [Wed, 19 Dec 2007 19:51:46 +0000 (19:51 +0000)]
- auto-reconnect support improved; a Connection can now automatically
reconnect after its underlying connection is invalidated, without
needing to connect() again from the engine. This allows an ORM session
bound to a single Connection to not need a reconnect.
Open transactions on the Connection must be rolled back after an invalidation
of the underlying connection else an error is raised. Also fixed
bug where disconnect detect was not being called for cursor(), rollback(),
or commit().
Lele Gaifax [Wed, 19 Dec 2007 08:03:57 +0000 (08:03 +0000)]
Fix the unpacking of the refered table name under Firebird
This fixes a little glitch introduced in [3959], in case of "implicit FKs"
(that is, {{{ForeignKey("orders")}}}, where the field(s) is missing).
Mike Bayer [Tue, 18 Dec 2007 05:40:06 +0000 (05:40 +0000)]
- cleanup; lambdas removed from properties; properties mirror same-named functions (more like eventual decorator syntax); remove some old methods, factor out some "raiseerr" ugliness to outer lying functions.
- corresponding_column() integrates "require_embedded" flag with other set arithmetic
Mike Bayer [Tue, 18 Dec 2007 00:24:03 +0000 (00:24 +0000)]
- select().as_scalar() will raise an exception if the select does not have
exactly one expression in its columns clause.
- added "helper exception" to select.type access, generic functions raise
the chance of this happening
- a slight behavioral change to attributes is, del'ing an attribute
does *not* cause the lazyloader of that attribute to fire off again;
the "del" makes the effective value of the attribute "None". To
re-trigger the "loader" for an attribute, use
session.expire(instance, [attrname]).
- fix ormtutorial for IS NULL
Mike Bayer [Sun, 16 Dec 2007 18:32:25 +0000 (18:32 +0000)]
- more fixes to the LIMIT/OFFSET aliasing applied with Query + eagerloads,
in this case when mapped against a select statement [ticket:904]
- _hide_froms logic in expression totally localized to Join class, including search through previous clone sources
- removed "stop_on" from main visitors, not used
- "stop_on" in AbstractClauseProcessor part of constructor, ClauseAdapter sets it up based on given clause
- fixes to is_derived_from() to take previous clone sources into account, Alias takes self + cloned sources into account. this is ultimately what the #904 bug was.
Lele Gaifax [Sun, 16 Dec 2007 10:59:06 +0000 (10:59 +0000)]
Fix bad example of Firebird test DB
Use an absolute path rather than a relative one, and the out-of-the-box
sysdba password. This is just to avoid confusing new testers, that should
add a db.firebird entry in their ~/satest.cfg anyway.