Mike Bayer [Wed, 14 Sep 2011 15:31:33 +0000 (11:31 -0400)]
- Changed the update() method on association proxy
dictionary to use a duck typing approach, i.e.
checks for "keys", to discern between update({})
and update((a, b)). Previously, passing a
dictionary that had tuples as keys would be misinterpreted
as a sequence. [ticket:2275]
Mike Bayer [Sat, 10 Sep 2011 20:54:23 +0000 (16:54 -0400)]
- New event hook, MapperEvents.after_configured().
Called after a configure() step has completed and
mappers were in fact affected. Theoretically this
event is called once per application, unless new mappings
are constructed after existing ones have been used
already.
- New declarative features:
- __declare_last__() method, establishes an event
listener for the class method that will be called
when mappers are completed with the final "configure"
step.
- __abstract__ flag. The class will not be mapped
at all when this flag is present on the class.
- New helper classes ConcreteBase, AbstractConcreteBase.
Allow concrete mappings using declarative which automatically
set up the "polymorphic_union" when the "configure"
mapper step is invoked.
- The mapper itself has semi-private methods that allow
the "with_polymorphic" selectable to be assigned
to the mapper after it has already been configured.
[ticket:2239]
Mike Bayer [Fri, 9 Sep 2011 21:12:52 +0000 (17:12 -0400)]
- Reflection functions for Table, Sequence no longer
case insensitive. Names can be differ only in case
and will be correctly distinguished. [ticket:2256]
Mike Bayer [Fri, 9 Sep 2011 20:18:44 +0000 (16:18 -0400)]
- Calling class_mapper() and passing in an object
that is not a "type" (i.e. a class that could
potentially be mapped) now raises an informative
ArgumentError, rather than UnmappedClassError.
[ticket:2196]
Mike Bayer [Fri, 9 Sep 2011 20:11:13 +0000 (16:11 -0400)]
- Identity map .discard() uses dict.pop(,None)
internally instead of "del" to avoid KeyError/warning
during a non-determinate gc teardown [ticket:2267]
Mike Bayer [Fri, 9 Sep 2011 20:03:23 +0000 (16:03 -0400)]
- Behavioral improvement: empty
conjunctions such as and_() and or_() will be
flattened in the context of an enclosing conjunction,
i.e. and_(x, or_()) will produce 'X' and not 'X AND
()'. [ticket:2257].
Mike Bayer [Fri, 9 Sep 2011 19:51:40 +0000 (15:51 -0400)]
- Fixed bug whereby if __eq__() was
redefined, a relationship many-to-one lazyload
would hit the __eq__() and fail. [ticket:2260]
Does not apply to 0.6.9.
Mike Bayer [Mon, 5 Sep 2011 23:12:12 +0000 (19:12 -0400)]
- Fixed bug regarding calculation of "from" list
for a select() element. The "from" calc is now
delayed, so that if the construct uses a Column
object that is not yet attached to a Table,
but is later associated with a Table, it generates
SQL using the table as a FROM. This change
impacted fairly deeply the mechanics of how
the FROM list as well as the "correlates" collection
is calculated, as some "clause adaption" schemes
(these are used very heavily in the ORM)
were relying upon the fact that the "froms"
collection would typically be cached before the
adaption completed. The rework allows it
such that the "froms" collection can be cleared
and re-generated at any time. [ticket:2261]
- RelationshipProperty.Comparator._criterion_exists()
adds an "_orm_adapt" annotation to the correlates target,
to work with the change in [ticket:2261]. It's not clear
if the change to correlation+adaption mechanics will affect end user
code yet.
- FromClause now uses group_expirable_memoized_property for
late-generated values like primary key, _columns, etc.
The Select class adds some tokens to this object and has the
nice effect that FromClause doesn't need to know about
Select's names anymore. An additional change might be to
have Select use a different group_expirable_memoized_property
so that it's collection of attribute names are specific to
Select though this isn't really necessary right now.
Mike Bayer [Mon, 22 Aug 2011 15:12:36 +0000 (11:12 -0400)]
- Improvement to multi-param statement logging,
long lists of bound parameter sets will be
compressed with an informative indicator
of the compression taking place. Exception
messages use the same improved formatting.
[ticket:2243]
Mike Bayer [Tue, 16 Aug 2011 22:31:49 +0000 (18:31 -0400)]
- Extra keyword arguments to the base Float
type beyond "precision" and "asdecimal" are ignored;
added a deprecation warning here and additional
docs, related to [ticket:2258]
Mike Bayer [Sun, 14 Aug 2011 16:20:54 +0000 (12:20 -0400)]
- Added a slightly nicer __repr__() to SchemaItem
classes. Note the repr here can't fully support
the "repr is the constructor" idea since schema
items can be very deeply nested/cyclical, have
late initialization of some things, etc.
[ticket:2223]
Mike Bayer [Sun, 14 Aug 2011 15:55:32 +0000 (11:55 -0400)]
- The recreate() method in all pool classes uses
self.__class__ to get at the type of pool
to produce, in the case of subclassing. Note
there's no usual need to subclass pools.
[ticket:2254]
Mike Bayer [Sat, 13 Aug 2011 02:48:40 +0000 (22:48 -0400)]
- add test profiling merge() behavior when merging lots of bidirectional collections/m2os,
collections present in given merge field. This shows that the change proposed
in [ticket:2221] adds over 10% method call overhead including significantly more
SQL statements.
Mike Bayer [Tue, 9 Aug 2011 23:45:20 +0000 (19:45 -0400)]
- Narrowed the assumption made when reflecting
a foreign-key referenced table with schema in
the current search path; an explicit schema will
be applied to the referenced table only if
it actually matches that of the referencing table,
which also has an explicit schema. Previously
it was assumed that "current" schema was synonymous
with the full search_path. [ticket:2249]
Mike Bayer [Sun, 7 Aug 2011 23:04:10 +0000 (19:04 -0400)]
- basic relational patterns -> all declarative. classical mapper folks can
figure it out.
- update self-referential examples to be fully declarative/aliased etc.
Mike Bayer [Sat, 6 Aug 2011 23:30:34 +0000 (19:30 -0400)]
- Repaired edge case where mapper would fail
to fully update internal state when a relationship
on a new mapper would establish a backref on the
first mapper.
- continuing with tutorial, moving eager loading into its
own place and describing more fully
Mike Bayer [Sat, 6 Aug 2011 19:03:33 +0000 (15:03 -0400)]
- Query will convert an OFFSET of zero when
slicing into None, so that needless OFFSET
clauses are not invoked.
- mssql: "0" is accepted as an argument for limit() which
will produce "TOP 0". [ticket:2222]
- add tests to default compiler test for LIMIT/OFFSET generation
Mike Bayer [Sat, 6 Aug 2011 18:23:07 +0000 (14:23 -0400)]
- Fixed bug in query.join() which would occur
in a complex multiple-overlapping path scenario,
where the same table could be joined to
twice. Thanks *much* to Dave Vitek
for the excellent fix here. [ticket:2247]
Mike Bayer [Sat, 6 Aug 2011 01:29:21 +0000 (21:29 -0400)]
- rewrite the docs for association proxy using declarative, add new examples, querying,
etc., part of [ticket:2246]
- add some accessors to AssociationProxy for attributes, test in join(), [ticket:2236]
- update relationship docs to talk about callables, part of [ticket:2246]
Mike Bayer [Thu, 4 Aug 2011 19:34:24 +0000 (15:34 -0400)]
- Ensured that the same ValueError is raised for
illegal date/time/datetime string parsed from
the database regardless of whether C
extensions are in use or not.
Mike Bayer [Mon, 1 Aug 2011 18:16:46 +0000 (14:16 -0400)]
- Added after_soft_rollback() Session event. This
event fires unconditionally whenever rollback()
is called, regardless of if an actual DBAPI
level rollback occurred. This event
is specifically designed to allow operations
with the Session to proceed after a rollback
when the Session.is_active is True.
[ticket:2241]
- SessionTransaction is mentioned in public docs, many
more docstrings for events etc. otherwise
Mike Bayer [Sun, 31 Jul 2011 21:32:07 +0000 (17:32 -0400)]
- Load of a deferred() attribute on an object
where row can't be located raises
ObjectDeletedError instead of failing later
on; improved the message in ObjectDeletedError
to include other conditions besides a simple
"delete". [ticket:2191]
- break up test_get_refreshes() in test_expire
Mike Bayer [Sat, 30 Jul 2011 17:53:41 +0000 (13:53 -0400)]
- add CoerceUTF8 example
- New feature: with_variant() method on
all types. Produces an instance of Variant(),
a special TypeDecorator which will select
the usage of a different type based on the
dialect in use. [ticket:2187]
Mike Bayer [Sat, 30 Jul 2011 16:12:32 +0000 (12:12 -0400)]
- Fixed bug where query.join() + aliased=True
from a joined-inh structure to itself on
relationship() with join condition on the child
table would convert the lead entity into the
joined one inappropriately. [ticket:2234]
Also in 0.6.9.
Mike Bayer [Sat, 30 Jul 2011 15:41:53 +0000 (11:41 -0400)]
- Added public attribute ".validators" to
Mapper, an immutable dictionary view of
all attributes that have been decorated
with the @validates decorator.
[ticket:2240] courtesy Stefano Fontanelli
Mike Bayer [Thu, 28 Jul 2011 15:53:18 +0000 (11:53 -0400)]
- SQLite dialect no longer strips quotes
off of reflected default value, allowing
a round trip CREATE TABLE to work.
This is consistent with other dialects
that also maintain the exact form of
the default. [ticket:2189]
Mike Bayer [Mon, 25 Jul 2011 00:41:42 +0000 (20:41 -0400)]
- rework Annotated to no longer use __cmp__(), supply an __eq__() that
works with ColumnElement as well as works with non-__eq__() suppliers,
works with sets, on Py3K as well.
Mike Bayer [Sun, 24 Jul 2011 21:51:01 +0000 (17:51 -0400)]
- rewrite cloned_traverse() and replacement_traverse() to use a straight
recursive descent with clone() + _copy_internals(). This is essentially
what it was doing anyway with lots of unnecessary steps.
Fix Alias() to honor the given clone() function which may have been the
reason the traversal hadn't been fixed sooner. Alias._copy_internals()
will specifically skip an alias of a Table
as a more specific form of what it was doing before. This may need to
be further improved such that ClauseAdapter or replacement_traverse()
send it some specific hints what not to dig into; **kw has been added
to all _copy_internals() to support this. replacement/clone traversal
is at least clear now.
- apply new no_replacement_traverse annotation to join created by
_create_joins(), fixes [ticket:2195]
- can replace orm.query "_halt_adapt" with "no_replacement_traverse"
Mike Bayer [Sun, 24 Jul 2011 16:37:48 +0000 (12:37 -0400)]
- Fixed regression from 0.6 where Session.add()
against an object which contained None in a
collection would raise an internal exception.
Reverted this to 0.6's behavior which is to
accept the None but obviously nothing is
persisted. Ideally, collections with None
present or on append() should at least emit a
warning, which is being considered for 0.8.
[ticket:2205]
Mike Bayer [Sun, 24 Jul 2011 15:45:30 +0000 (11:45 -0400)]
- Fixed bug apparent only in Python 3 whereby
sorting of persistent + pending objects during
flush would produce an illegal comparison,
if the persistent object primary key
is not a single integer. [ticket:2228]
Also in 0.6.9
Mike Bayer [Thu, 21 Jul 2011 15:44:31 +0000 (11:44 -0400)]
- Added an informative error message when
ForeignKeyConstraint refers to a column name in
the parent that is not found. Also in 0.6.9.
- add tests for [ticket:2226], as if we hit each @declared_attr
directly with obj.__get__(obj, name) instead of using
getattr(cls, name). Basic inheritance mechanics are improperly
used in this case, so 2226 is invalid.
Mike Bayer [Wed, 20 Jul 2011 22:30:57 +0000 (18:30 -0400)]
- Fixed regression from 0.6 where a get history
operation on some relationship() based attributes
would fail when a lazyload would emit; this could
trigger within a flush() under certain conditions.
[ticket:2224] Thanks to the user who submitted
the great test for this.
Mike Bayer [Wed, 20 Jul 2011 22:03:35 +0000 (18:03 -0400)]
- Fixed bug whereby the source clause
used by query.join() would be inconsistent
if against a column expression that combined
multiple entities together. [ticket:2197]
Mike Bayer [Wed, 20 Jul 2011 14:49:36 +0000 (10:49 -0400)]
- Added new "postgresql_ops" argument to
Index, allows specification of PostgreSQL
operator classes for indexed columns.
[ticket:2198] Courtesy Filip Zyzniewski.
Mike Bayer [Sun, 17 Jul 2011 20:44:37 +0000 (16:44 -0400)]
- Fixed bug whereby if a mapped class
redefined __hash__() or __eq__() to something
non-standard, which is a supported use case
as SQLA should never consult these,
the methods would be consulted if the class
was part of a "composite" (i.e. non-single-entity)
result set. [ticket:2215]
Also in 0.6.9.
Mike Bayer [Sun, 17 Jul 2011 19:14:03 +0000 (15:14 -0400)]
- Feature enhancement: joined and subquery
loading will now traverse already-present related
objects and collections in search of unpopulated
attributes throughout the scope of the eager load
being defined, so that the eager loading that is
specified via mappings or query options
unconditionally takes place for the full depth,
populating whatever is not already populated.
Previously, this traversal would stop if a related
object or collection were already present leading
to inconsistent behavior (though would save on
loads/cycles for an already-loaded graph). For a
subqueryload, this means that the additional
SELECT statements emitted by subqueryload will
invoke unconditionally, no matter how much of the
existing graph is already present (hence the
controversy). The previous behavior of "stopping"
is still in effect when a query is the result of
an attribute-initiated lazyload, as otherwise an
"N+1" style of collection iteration can become
needlessly expensive when the same related object
is encountered repeatedly. There's also an
as-yet-not-public generative Query method
_with_invoke_all_eagers()
which selects old/new behavior [ticket:2213]
Mike Bayer [Thu, 7 Jul 2011 15:34:59 +0000 (11:34 -0400)]
- add a latex Makefile to texinputs that gets copied on latex build,
ensures pdflatex/latex errors are totally ignored
- fix all SQL/code examples in the inherits doc to be within 79 chars.
will need to do this for all the docs to get pdf to not look crappy.
- add an abspath to the "templates" dir, not sure of the rationale
here but is harmless, [ticket:2211]
- integrate pdf build with site-mako build
Mike Bayer [Wed, 6 Jul 2011 16:35:45 +0000 (12:35 -0400)]
- The join condition produced by with_parent
as well as when using a "dynamic" relationship
against a parent will generate unique
bindparams, rather than incorrectly repeating
the same bindparam. [ticket:2207].
Also in 0.6.9.
Mike Bayer [Mon, 4 Jul 2011 20:31:58 +0000 (16:31 -0400)]
- fix pypostgresql typo, [ticket:2185]
- rewrite "getting a session" docs to delineate
all sessionmaker() use cases distinctly
- rewrite "Managing Transactions" doc to spell out
each specific step completely, [ticket:2204]
- add to create_engine() and main "engine" doc
an unambiguous statement that the create_engine()
does not create a connection
- other link fixes
- rewrite "deleting" section so that "deleting from collections"
is separate, well-described, [ticket:2202]
- rephrase "autocommit mode" into its own section, move it down,
put some bold text that you shouldn't be using it.
- simplify the "subtransactions" section and make it local to
"autocommit" since it is utterly unneeded by anybody.
- oracle is not doing 2-phase anytime soon
Mike Bayer [Mon, 4 Jul 2011 17:56:17 +0000 (13:56 -0400)]
- Added an improved repr() to TypeEngine objects
that will only display constructor args which
are positional or kwargs that deviate
from the default. [ticket:2209]
Mike Bayer [Fri, 1 Jul 2011 21:09:57 +0000 (17:09 -0400)]
- add doc to schema docs linking to declarative usage of __table__
- add more examples to __table__ such as that asked on a recent
stackoverflow question.
Mike Bayer [Fri, 1 Jul 2011 20:52:11 +0000 (16:52 -0400)]
- Failures on connect which raise dbapi.Error
will forward the error to dialect.is_disconnect()
and set the "connection_invalidated" flag if
the dialect knows this to be a potentially
"retryable" condition. Only Oracle ORA-01033
implemented for now. [ticket:2201]
- Added ORA-01033 to disconnect codes, which
can be caught during a connection
event. [ticket:2201]
Mike Bayer [Fri, 1 Jul 2011 15:32:07 +0000 (11:32 -0400)]
- Fixed bug in the mutable extension whereby
if None or a non-corresponding type were set,
an error would be raised. None is now accepted
which assigns None to all attributes,
illegal values raise ValueError.
Mike Bayer [Thu, 30 Jun 2011 22:48:01 +0000 (18:48 -0400)]
- Fixed bug where "autoincrement" detection on
Table would fail if the type had no "affinity"
value, in particular this would occur when using
the UUID example on the site that uses TypeEngine
as the "impl".
Mike Bayer [Thu, 30 Jun 2011 14:43:53 +0000 (10:43 -0400)]
- Fixed bug in the mutable extension whereby
if the same type were used twice in one
mapping, the attributes beyond the first
would not get instrumented.
Mike Bayer [Thu, 30 Jun 2011 14:27:52 +0000 (10:27 -0400)]
- Fixed bug whereby adaptation of old append_ddl_listener()
function was passing unexpected **kw through
to the Table event. Table gets no kws, the MetaData
event in 0.6 would get "tables=somecollection",
this behavior is preserved. [ticket:2206]