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.
Mike Bayer [Thu, 6 Dec 2007 22:23:10 +0000 (22:23 +0000)]
- generation of "unique" bind parameters has been simplified to use the same
"unique identifier" mechanisms as everything else. This doesn't affect
user code, except any code that might have been hardcoded against the generated
names. Generated bind params now have the form "<paramname>_<num>",
whereas before only the second bind of the same name would have this form.
- bindparam() objects themselves can be used as keys for execute(), i.e.
statement.execute({bind1:'foo', bind2:'bar'})
Mike Bayer [Thu, 6 Dec 2007 19:15:04 +0000 (19:15 +0000)]
- query.get() and query.load() do not take existing filter or other
criterion into account; these methods *always* look up the given id
in the database or return the current instance from the identity map,
disregarding any existing filter, join, group_by or other criterion
which has been configured. [ticket:893]
Mike Bayer [Wed, 5 Dec 2007 22:04:27 +0000 (22:04 +0000)]
- ordering of cols in pks_by_table and cols_by_table is significant;
particularly for pks_by_table the ordering is expected to match the ordering
of pk columns in the table for usage in query.get() as well as identity key
generation
Mike Bayer [Wed, 5 Dec 2007 20:43:16 +0000 (20:43 +0000)]
- a major behavioral change to collection-based backrefs: they no
longer trigger lazy loads ! "reverse" adds and removes
are queued up and are merged with the collection when it is
actually read from and loaded; but do not trigger a load beforehand.
For users who have noticed this behavior, this should be much more
convenient than using dynamic relations in some cases; for those who
have not, you might notice your apps using a lot fewer queries than
before in some situations. [ticket:871]
Mike Bayer [Wed, 5 Dec 2007 03:07:21 +0000 (03:07 +0000)]
- basic framework for generic functions, [ticket:615]
- changed the various "literal" generation functions to use an anonymous
bind parameter. not much changes here except their labels now look
like ":param_1", ":param_2" instead of ":literal"
- from_obj keyword argument to select() can be a scalar or a list.
Mike Bayer [Tue, 4 Dec 2007 17:06:55 +0000 (17:06 +0000)]
- relaxed rules on column_property() expressions having labels; any
ColumnElement is accepted now, as the compiler auto-labels non-labeled
ColumnElements now. a selectable, like a select() statement, still
requires conversion to ColumnElement via as_scalar() or label().
Mike Bayer [Sun, 2 Dec 2007 00:31:26 +0000 (00:31 +0000)]
- moved class-level attributes placed by the attributes package into a _class_state
variable attached to the class.
- mappers track themselves primarily using the "mappers" collection on _class_state.
ClassKey is gone and mapper lookup uses regular dict keyed to entity_name; removes
a fair degree of WeakKeyDictionary overhead as well as ClassKey overhead.
- mapper_registry renamed to _mapper_registry; is only consulted by the
compile_mappers(), mapper.compile() and clear_mappers() functions/methods.
Mike Bayer [Sat, 1 Dec 2007 23:00:05 +0000 (23:00 +0000)]
- several ORM attributes have been removed or made private:
mapper.get_attr_by_column(), mapper.set_attr_by_column(),
mapper.pks_by_table, mapper.cascade_callable(),
MapperProperty.cascade_callable(), mapper.canload()
- refinements to mapper PK/table column organization, session cascading,
some naming convention work
Mike Bayer [Fri, 30 Nov 2007 00:40:56 +0000 (00:40 +0000)]
- added support for version_id_col in conjunction with inheriting mappers.
version_id_col is typically set on the base mapper in an inheritance
relationship where it takes effect for all inheriting mappers.
[ticket:883]
- a little rearrangement of save_obj()
Mike Bayer [Thu, 29 Nov 2007 19:37:05 +0000 (19:37 +0000)]
- adjustment to the previous checkin regarding inheritance to not conflict with globals
- fix to self-referential eager loading such that if the same mapped
instance appears in two or more distinct sets of columns in the same
result set, its eagerly loaded collection will be populated regardless
of whether or not all of the rows contain a set of "eager" columns for
that collection. this would also show up as a KeyError when fetching
results with join_depth turned on.
Mike Bayer [Thu, 29 Nov 2007 15:36:13 +0000 (15:36 +0000)]
- fixed bug where Query would not apply a subquery to the SQL when LIMIT
was used in conjunction with an inheriting mapper where the eager
loader was only in the parent mapper.
Mike Bayer [Tue, 27 Nov 2007 16:23:02 +0000 (16:23 +0000)]
opened up the test for "reflection with convert_unicode=True". this is since convert_unicode by default has assert_unicode, want to ensure that other dialects (at least oracle) support this (i.e. not unicode schema names themselves, just that they dont sent thru bytestrings to a String).
if maxdb or sybase *should* be able to handle this too though I can't test on this end.