Released: January 25, 2019
[bug] [ext] Fixed a regression in 1.3.0b1 caused by #3423 where association
proxy objects that access an attribute that's only present on a polymorphic
subclass would raise an
AttributeErroreven though the actual instance
being accessed was an instance of that subclass.
[bug] [orm] Fixed long-standing issue where duplicate collection members would cause a
backref to delete the association between the member and its parent object
when one of the duplicates were removed, as occurs as a side effect of
swapping two objects in one statement.
[bug] [mssql] The
UnicodeTextdatatypes now render an
Ncharacter in front of
the literal string expression as required by SQL Server for Unicode string
values rendered in SQL expressions.
[feature] [orm] Implemented a new feature whereby the
now be used as the target of a
relationship(). This allows the
concept of "non primary mappers" to no longer be necessary, as the
AliasedClassis much easier to configure and automatically inherits
all the relationships of the mapped class, as well as preserves the
ability for loader options to work normally.
[bug] [orm] Extended the fix first made as part of #3287, where a loader option
made against a subclass using a wildcard would extend itself to include
application of the wildcard to attributes on the super classes as well, to a
"bound" loader option as well, e.g. in an expression like
Load(SomeSubClass).load_only('foo'). Columns that are part of the
parent class of
SomeSubClasswill also be excluded in the same way as if
the unbound option
[bug] [orm] Improved error messages emitted by the ORM in the area of loader option
traversal. This includes early detection of mis-matched loader strategies
along with a clearer explanation why these strategies don't match.
[change] [orm] Added a new function
over the task of the
is now deprecated as this is confusing as a classmethod.
Pull request courtesy Augustin Trancart.
[feature] [orm] Added new
event complements the other "configure" stage mapper events with a per
mapper event that receives each
Mapperright before its
configure step, and additionally may be used to prevent or delay the
configuration of specific
Mapperobjects using a new
orm.interfaces.EXT_SKIP. See the
documentation link for an example.
[bug] [orm] The "remove" event for collections is now called before the item is removed
in the case of the
collection.remove()method, as is consistent with the
behavior for most other forms of collection item removal (such as
__delitem__, replacement under
the remove event still fires after the operation.
[bug] [orm declarative] Added a
can allow the usage of a not-fully-declared column or deferred attribute in
a declarative mapped class slightly more friendly when it's used in a
constraint or other column-oriented scenario within the class declaration,
though this still can't work in open-ended expressions; prefer to call the
ColumnProperty.expressionattribute if receiving
[bug] [engine] [orm] Added accessors for execution options to Core and ORM, via
Executable.get_execution_options(). PR courtesy Daniel Lister.
[bug] [orm] Fixed issue in association proxy due to #3423 which caused the use
PropComparatorobjects with hybrid attributes, such as
the one demonstrated in the
dictlike-polymorphicexample to not
function within an association proxy. The strictness that was added in
#3423 has been relaxed, and additional logic to accommodate for
an association proxy that links to a custom hybrid have been added.
[change] [general] A large change throughout the library has ensured that all objects,
parameters, and behaviors which have been noted as deprecated or legacy now
DeprecationWarningwarnings when invoked.As the Python 3
interpreter now defaults to displaying deprecation warnings, as well as that
modern test suites based on tools like tox and pytest tend to display
deprecation warnings, this change should make it easier to note what API
features are obsolete. A major rationale for this change is so that long-
deprecated features that nonetheless still see continue to see real world
use can finally be removed in the near future; the biggest example of this
well as a handful of other pre-event extension hooks, which have been
deprecated since version 0.7 but still remain in the library. Another is
that several major longstanding behaviors are to be deprecated as well,
including the threadlocal engine strategy, the convert_unicode flag, and non
[change] [engine] The "threadlocal" engine strategy which has been a legacy feature of
SQLAlchemy since around version 0.2 is now deprecated, along with the
Poolwhich has no
effect in most modern use cases.
[change] [sql] The
String.convert_unicodeparameters have been deprecated. These
parameters were built back when most Python DBAPIs had little to no support
for Python Unicode objects, and SQLAlchemy needed to take on the very
complex task of marshalling data and SQL strings between Unicode and
bytestrings throughout the system in a performant way. Thanks to Python 3,
DBAPIs were compelled to adapt to Unicode-aware APIs and today all DBAPIs
supported by SQLAlchemy support Unicode natively, including on Python 2,
allowing this long-lived and very complicated feature to finally be (mostly)
removed. There are still of course a few Python 2 edge cases where
SQLAlchemy has to deal with Unicode however these are handled automatically;
in modern use, there should be no need for end-user interaction with these
[bug] [orm] Implemented the
.get_history()method, which also implies availability
Previously, trying to access attribute history via a synonym would raise an
[engine] [feature] Added public accessor
QueuePool.timeout()that returns the configured
timeout for a
QueuePoolobject. Pull request courtesy Irina Delamare.
[feature] [sql] Amended the
AnsiFunctionclass, the base of common SQL
CURRENT_TIMESTAMP, to accept positional arguments
like a regular ad-hoc function. This to suit the case that many of
these functions on specific backends accept arguments such as
"fractional seconds" precision and such. If the function is created
with arguments, it renders the parenthesis and the arguments. If
no arguments are present, the compiler generates the non-parenthesized form.