Mike Bayer [Sun, 3 Mar 2013 18:51:54 +0000 (13:51 -0500)]
- Improved checking for an existing backref name conflict during
mapper configuration; will now test for name conflicts on
superclasses and subclasses, in addition to the current mapper,
as these conflicts break things just as much. This is new for
0.8, but see below for a warning that will also be triggered
in 0.7.11.
- Improved the error message emitted when a "backref loop" is detected,
that is when an attribute event triggers a bidirectional
assignment between two other attributes with no end.
This condition can occur not just when an object of the wrong
type is assigned, but also when an attribute is mis-configured
to backref into an existing backref pair. Also in 0.7.11.
- A warning is emitted when a MapperProperty is assigned to a mapper
that replaces an existing property, if the properties in question
aren't plain column-based properties. Replacement of relationship
properties is rarely (ever?) what is intended and usually refers to a
mapper mis-configuration. Also in 0.7.11.
[ticket:2674]
Mike Bayer [Sun, 3 Mar 2013 01:27:53 +0000 (20:27 -0500)]
Can set/change the "cascade" attribute on a :func:`.relationship`
construct after it's been constructed already. This is not
a pattern for normal use but we like to change the setting
for demonstration purposes in tutorials.
Mike Bayer [Sat, 2 Mar 2013 22:47:58 +0000 (17:47 -0500)]
- :meth:`.MetaData.create_all` and :meth:`.MetaData.drop_all` will
now accommodate an empty list as an instruction to not create/drop
any items, rather than ignoring the collection. [ticket:2664].
This is a behavioral change and extra notes to the changelog
and migration document have been added.
- create a new test suite for exercising codepaths
in engine/ddl.py
Mike Bayer [Sat, 2 Mar 2013 21:20:49 +0000 (16:20 -0500)]
- Fixed an import of "logging" in test_execute which was not
working on some linux platforms. Also in 0.7.11.
- only need "logging.handlers" here, "logging" comes in implicitly
Mike Bayer [Tue, 26 Feb 2013 00:27:07 +0000 (19:27 -0500)]
- A clear error message is emitted if an event handler
attempts to emit SQL on a Session within the after_commit()
handler, where there is not a viable transaction in progress.
[ticket:2662]
- rework how SessionTransaction maintains state, using symbols
instead.
- add lots of notes and cross-linking for session events.
- add a link to :func:`.select()` within :meth:`.FromClause.select`.
Mike Bayer [Mon, 25 Feb 2013 23:55:09 +0000 (18:55 -0500)]
Detection of a primary key change within the process
of cascading a natural primary key update will succeed
even if the key is composite and only some of the
attributes have changed.
[ticket:2665]
Mike Bayer [Wed, 20 Feb 2013 23:24:46 +0000 (18:24 -0500)]
- Added new helper function :func:`.was_deleted`, returns True
if the given object was the subject of a :meth:`.Session.delete`
operation.
- An object that's deleted from a session will be de-associated with
that session fully after the transaction is committed, that is
the :func:`.object_session` function will return None.
[ticket:2658]
Mike Bayer [Fri, 8 Feb 2013 17:42:36 +0000 (12:42 -0500)]
The cx_oracle dialect will no longer run the bind parameter names
through ``encode()``, as this is not valid on Python 3, and prevented
statements from functioning correctly on Python 3. We now
encode only if ``supports_unicode_binds`` is False, which is not
the case for cx_oracle when at least version 5 of cx_oracle is used.
Mike Bayer [Fri, 8 Feb 2013 06:20:41 +0000 (01:20 -0500)]
Fixed bug whereby :meth:`.Query.yield_per` would set the execution
options incorrectly, thereby breaking subsequent usage of the
:meth:`.Query.execution_options` method. Courtesy Ryan Kelly.
[ticket:2661]
Mike Bayer [Wed, 6 Feb 2013 20:49:32 +0000 (15:49 -0500)]
- add an "empty_inserts" requirement target plus a suite test
- add suite tests for basic explicit Sequence support, result-row column access (tests that name_normalize is set correctly among many other things)
Mike Bayer [Sun, 3 Feb 2013 01:06:31 +0000 (20:06 -0500)]
Fixed a bug regarding column annotations which in particular
could impact some usages of the new :func:`.orm.remote` and
:func:`.orm.local` annotation functions, where annotations
could be lost when the column were used in a subsequent
expression.
[ticket:2660]
Mike Bayer [Sat, 2 Feb 2013 23:40:56 +0000 (18:40 -0500)]
Added a conditional import to the ``gaerdbms`` dialect which attempts
to import rdbms_apiproxy vs. rdbms_googleapi to work
on both dev and production platforms. Also now honors the
``instance`` attribute. Courtesy Sean Lynch.
[ticket:2649]
Mike Bayer [Sat, 2 Feb 2013 01:47:02 +0000 (20:47 -0500)]
Added a new argument to :class:`.Enum` and its base
:class:`.SchemaType` ``inherit_schema``. When set to ``True``,
the type will set its ``schema`` attribute of that of the
:class:`.Table` to which it is associated. This also occurs
during a :meth:`.Table.tometadata` operation; the :class:`.SchemaType`
is now copied in all cases when :meth:`.Table.tometadata` happens,
and if ``inherit_schema=True``, the type will take on the new
schema name passed to the method. The ``schema`` is important
when used with the Postgresql backend, as the type results in
a ``CREATE TYPE`` statement. [ticket:2657]
Mike Bayer [Sun, 27 Jan 2013 16:23:59 +0000 (11:23 -0500)]
Fixed bug where :meth:`.Table.tometadata` would fail if a
:class:`.Column` had both a foreign key as well as an
alternate ".key" name for the column. Also in 0.7.10.
[ticket:2643]
Mike Bayer [Fri, 25 Jan 2013 02:31:23 +0000 (21:31 -0500)]
the consideration of a pending object as
an "orphan" has been modified to more closely match the
behavior as that of persistent objects, which is that the object
is expunged from the :class:`.Session` as soon as it is
de-associated from any of its orphan-enabled parents. Previously,
the pending object would be expunged only if de-associated
from all of its orphan-enabled parents. The new flag ``legacy_is_orphan``
is added to :func:`.orm.mapper` which re-establishes the
legacy behavior. [ticket:2655]
Mike Bayer [Mon, 21 Jan 2013 23:17:10 +0000 (18:17 -0500)]
Fixed the (most likely never used) "@collection.link" collection
method, which fires off each time the collection is associated
or de-associated with a mapped object - the decorator
was not tested or functional. The decorator method
is now named :meth:`.collection.linker` though the name "link"
remains for backwards compatibility. Courtesy Luca Wehrstedt.
[ticket:2653]
Mike Bayer [Mon, 21 Jan 2013 22:57:24 +0000 (17:57 -0500)]
- Made some fixes to the system of producing custom instrumented
collections, mainly that the usage of the @collection decorators
will now honor the __mro__ of the given class, applying the
logic of the sub-most classes' version of a particular collection
method. Previously, it wasn't predictable when subclassing
an existing instrumented class such as :class:`.MappedCollection`
whether or not custom methods would resolve correctly.
[ticket:2654]
- The undocumented (and hopefully unused) system of producing
custom collections using an ``__instrumentation__`` datastructure
associated with the collection has been removed, as this was a complex
and untested feature which was also essentially redundant versus the
decorator approach. Other internal simplifcations to the
orm.collections module have been made as well.
Mike Bayer [Thu, 17 Jan 2013 02:04:32 +0000 (21:04 -0500)]
:class:`.Index` now supports arbitrary SQL expressions and/or
functions, in addition to straight columns. Common modifiers
include using ``somecolumn.desc()`` for a descending index and
``func.lower(somecolumn)`` for a case-insensitive index, depending on the
capabilities of the target backend.
[ticket:695]