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.
Lele Gaifax [Sat, 15 Dec 2007 16:14:31 +0000 (16:14 +0000)]
Revert to use default poolclass under Firebird
This partially reverts [3562] and instead documents the problem suggesting
a possible workaround. For the tests, the occurence of the problem is
largely reduced by using a TCP connection (that is, 'localhost:/some/file.fdb'
instead of '/some/file.fdb')
Mike Bayer [Fri, 14 Dec 2007 23:11:13 +0000 (23:11 +0000)]
- simplified _mapper_registry further. its now just a weakkeydict of mapper->True, stores
all mappers including non primaries, and is strictly used for the list of "to compile/dispose".
- all global references are now weak referencing. if you del a mapped class and any dependent classes,
its mapper and all dependencies fall out of scope.
- attributes.py still had issues which were barely covered by tests. added way more tests (coverage.py still says 71%, doh)
fixed things, took out unnecessary commit to states. attribute history is also asserted for ordering.
Mike Bayer [Fri, 14 Dec 2007 05:53:18 +0000 (05:53 +0000)]
- merged instances_yields branch r3908:3934, minus the "yield" part which remains slightly problematic
- cleanup of mapper._instance, query.instances(). mapper identifies objects which are part of the
current load using a app-unique id on the query context.
- attributes refactor; attributes now mostly use copy-on-modify instead of copy-on-load behavior,
simplified get_history(), added a new set of tests
- fixes to OrderedSet such that difference(), intersection() and others can accept an iterator
- OrderedIdentitySet passes in OrderedSet to the IdentitySet superclass for usage in difference/intersection/etc. operations so that these methods actually work with ordering behavior.
- query.order_by() takes into account aliased joins, i.e. query.join('orders', aliased=True).order_by(Order.id)
- cleanup etc.
Jason Kirtland [Fri, 14 Dec 2007 00:13:18 +0000 (00:13 +0000)]
- Raise an error when assigning a bogusly keyed dictionary to one of the builtin dict-based collection types [ticket:886]
- Collections gain a @converter framework for flexible validation and adaptation of bulk assignment
- Bogus bulk assignments now raise TypeError instead of exceptions.ArgumentError
Jason Kirtland [Thu, 13 Dec 2007 09:59:14 +0000 (09:59 +0000)]
- Removed @testing.supported. Dialects in development or maintained outside
the tree can now run the full suite of tests out of the box.
- Migrated most @supported to @fails_on, @fails_on_everything_but, or (last
resort) @unsupported. @fails_on revealed a slew of bogus test skippage,
which was corrected.
- Added @fails_on_everything_but. Yes, the first usage *was*
"fails_on_everything_but('postgres')". How did you guess!
- Migrated @supported in dialect/* to the new test-class attribute __only_on__.
- Test classes can also have __unsupported_on__ and __excluded_on__.
Lele Gaifax [Wed, 12 Dec 2007 16:08:07 +0000 (16:08 +0000)]
Reflect Firebird PassiveDefaults
- column's default values are properly reflected (also those coming from DOMAINs)
- implemented .has_sequence()
- fix type on FK reflection
Lele Gaifax [Tue, 11 Dec 2007 23:07:41 +0000 (23:07 +0000)]
Cosmetic changes to the Firebird reflection queries.
This brings them more consistent with the syntax of the statements generated by SA,
using lowercase field names.
Mike Bayer [Tue, 11 Dec 2007 19:33:36 +0000 (19:33 +0000)]
- eagerload(), lazyload(), eagerload_all() take an optional
second class-or-mapper argument, which will select the mapper
to apply the option towards. This can select among other
mappers which were added using add_entity().
- eagerloading will work with mappers added via add_entity().
Mike Bayer [Tue, 11 Dec 2007 17:29:08 +0000 (17:29 +0000)]
- fix to cascades on polymorphic relations, such that cascades
from an object to a polymorphic collection continue cascading
along the set of attributes specific to each element in the collection.
Mike Bayer [Mon, 10 Dec 2007 04:31:17 +0000 (04:31 +0000)]
- more query tests
- trying to refine some of the adaptation stuff
- query.from_statement() wont allow further generative criterion
- added a warning to columncollection when selectable is formed with
conflicting columns (only in the col export phase)
- some method rearrangement on schema/columncollection....
- property conflicting relation warning doesnt raise for concrete
Mike Bayer [Sun, 9 Dec 2007 23:27:04 +0000 (23:27 +0000)]
- Query.select_from() now replaces all existing FROM criterion with
the given argument; the previous behavior of constructing a list
of FROM clauses was generally not useful as is required
filter() calls to create join criterion, and new tables introduced
within filter() already add themselves to the FROM clause. The
new behavior allows not just joins from the main table, but select
statements as well. Filter criterion, order bys, eager load
clauses will be "aliased" against the given statement.
Lele Gaifax [Sun, 9 Dec 2007 23:08:59 +0000 (23:08 +0000)]
Better reflection of Firebird data types.
Instead of relying on internal numeric code, lookup the associated real
name. This has the extra benefit of properly handling of DOMAINs.
Mike Bayer [Sun, 9 Dec 2007 17:26:16 +0000 (17:26 +0000)]
- added a warning when a relation() is added to an inheriting mapper that is present on a super-mapper; multiple DependencyProcessors are not expected during the flush process
- found an uncovered line in uow, was "covered" by one particular breaking test
Mike Bayer [Sun, 9 Dec 2007 05:00:12 +0000 (05:00 +0000)]
- mutable primary key support is added. primary key columns can be
changed freely, and the identity of the instance will change upon
flush. In addition, update cascades of foreign key referents (primary
key or not) along relations are supported, either in tandem with the
database's ON UPDATE CASCADE (required for DB's like Postgres) or
issued directly by the ORM in the form of UPDATE statements, by setting
the flag "passive_cascades=False".
Mike Bayer [Sat, 8 Dec 2007 23:03:22 +0000 (23:03 +0000)]
- added new methods to TypeDecorator, process_bind_param() and
process_result_value(), which automatically take advantage of the processing
of the underlying type. Ideal for using with Unicode or Pickletype.
TypeDecorator should now be the primary way to augment the behavior of any
existing type including other TypeDecorator subclasses such as PickleType.
Mike Bayer [Sat, 8 Dec 2007 18:58:03 +0000 (18:58 +0000)]
- flush() refactor merged from uow_nontree branch r3871-r3885
- topological.py cleaned up, presents three public facing functions which
return list/tuple based structures, without exposing any internals. only
the third function returns the "hierarchical" structure. when results
include "cycles" or "child" items, 2- or 3- tuples are used to represent
results.
- unitofwork uses InstanceState almost exclusively now. new and deleted lists
are now dicts which ref the actual object to provide a strong ref for the
duration that they're in those lists. IdentitySet is only used for the public
facing versions of "new" and "deleted".
- unitofwork topological sort no longer uses the "hierarchical" version of the sort
for the base sort, only for the "per-object" secondary sort where it still
helps to group non-dependent operations together and provides expected insert
order. the default sort deals with UOWTasks in a straight list and is greatly
simplified. Tests all pass but need to see if svilen's stuff still works,
one block of code in _sort_cyclical_dependencies() seems to not be needed anywhere
but i definitely put it there for a reason at some point; if not hopefully we
can derive more test coverage from that.
- the UOWEventHandler is only applied to object-storing attributes, not
scalar (i.e. column-based) ones. cuts out a ton of overhead when setting
non-object based attributes.
- InstanceState also used throughout the flush process, i.e. dependency.py,
mapper.save_obj()/delete_obj(), sync.execute() all expect InstanceState objects
in most cases now.
- mapper/property cascade_iterator() takes InstanceState as its argument,
but still returns lists of object instances so that they are not dereferenced.
- a few tricks needed when dealing with InstanceState, i.e. when loading a list
of items that are possibly fresh from the DB, you *have* to get the actual objects
into a strong-referencing datastructure else they fall out of scope immediately.
dependency.py caches lists of dependent objects which it loads now (i.e. history
collections).
- AttributeHistory is gone, replaced by a function that returns a 3-tuple of
added, unchanged, deleted. these collections still reference the object
instances directly for the strong-referencing reasons mentiontioned, but
it uses less IdentitySet logic to generate.
Mike Bayer [Fri, 7 Dec 2007 16:47:00 +0000 (16:47 +0000)]
fix to unique bind params, you *can* use the same unique bindparam multiple times
in a statement. the collision check is strictly detecting non-unique's that happen to have
the same name.
Mike Bayer [Fri, 7 Dec 2007 16:13:19 +0000 (16:13 +0000)]
- added "cascade delete" behavior to "dynamic" relations just like
that of regular relations. if passive_deletes flag (also just added)
is not set, a delete of the parent item will trigger a full load of
the child items so that they can be deleted or updated accordingly.