Sqlalchemy

Latest version: v2.0.36

Safety actively analyzes 683249 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 36 of 51

0.9.0

Not secure
:released: December 30, 2013

.. change::
:tags: bug, orm, declarative
:tickets: 2828

Declarative does an extra check to detect if the same
:class:`_schema.Column` is mapped multiple times under different properties
(which typically should be a :func:`.synonym` instead) or if two
or more :class:`_schema.Column` objects are given the same name, raising
a warning if this condition is detected.

.. change::
:tags: bug, firebird
:tickets: 2898

Changed the queries used by Firebird to list table and view names
to query from the ``rdb$relations`` view instead of the
``rdb$relation_fields`` and ``rdb$view_relations`` views.
Variants of both the old and new queries are mentioned on many
FAQ and blogs, however the new queries are taken straight from
the "Firebird FAQ" which appears to be the most official source
of info.

.. change::
:tags: bug, mysql
:tickets: 2893

Improvements to the system by which SQL types generate within
``__repr__()``, particularly with regards to the MySQL integer/numeric/
character types which feature a wide variety of keyword arguments.
The ``__repr__()`` is important for use with Alembic autogenerate
for when Python code is rendered in a migration script.

.. change::
:tags: feature, postgresql
:tickets: 2581

Support for PostgreSQL JSON has been added, using the new
:class:`_types.JSON` type. Huge thanks to Nathan Rice for
implementing and testing this.

.. change::
:tags: bug, sql

The :func:`.cast` function, when given a plain literal value,
will now apply the given type to the given literal value on the
bind parameter side according to the type given to the cast,
in the same manner as that of the :func:`.type_coerce` function.
However unlike :func:`.type_coerce`, this only takes effect if a
non-clauseelement value is passed to :func:`.cast`; an existing typed
construct will retain its type.

.. change::
:tags: bug, postgresql

Now using psycopg2 UNICODEARRAY extension for handling unicode arrays
with psycopg2 + normal "native unicode" mode, in the same way the
UNICODE extension is used.

.. change::
:tags: bug, sql
:tickets: 2883

The :class:`_schema.ForeignKey` class more aggressively checks the given
column argument. If not a string, it checks that the object is
at least a :class:`.ColumnClause`, or an object that resolves to one,
and that the ``.table`` attribute, if present, refers to a
:class:`_expression.TableClause` or subclass, and not something like an
:class:`_expression.Alias`. Otherwise, a :class:`.ArgumentError` is raised.


.. change::
:tags: feature, orm

The :class:`.exc.StatementError` or DBAPI-related subclass
now can accommodate additional information about the "reason" for
the exception; the :class:`.Session` now adds some detail to it
when the exception occurs within an autoflush. This approach
is taken as opposed to combining :class:`.FlushError` with
a Python 3 style "chained exception" approach so as to maintain
compatibility both with Py2K code as well as code that already
catches ``IntegrityError`` or similar.

.. change::
:tags: feature, postgresql

Added support for PostgreSQL TSVECTOR via the
:class:`_postgresql.TSVECTOR` type. Pull request courtesy
Noufal Ibrahim.

.. change::
:tags: feature, engine
:tickets: 2875

The :func:`.engine_from_config` function has been improved so that
we will be able to parse dialect-specific arguments from string
configuration dictionaries. Dialect classes can now provide their
own list of parameter types and string-conversion routines.
The feature is not yet used by the built-in dialects, however.

.. change::
:tags: bug, sql
:tickets: 2879

The precedence rules for the :meth:`.ColumnOperators.collate` operator
have been modified, such that the COLLATE operator is now of lower
precedence than the comparison operators. This has the effect that
a COLLATE applied to a comparison will not render parenthesis
around the comparison, which is not parsed by backends such as
MSSQL. The change is backwards incompatible for those setups that
were working around the issue by applying :meth:`.Operators.collate`
to an individual element of the comparison expression,
rather than the comparison expression as a whole.

.. seealso::

:ref:`migration_2879`

.. change::
:tags: bug, orm, declarative
:tickets: 2865

The :class:`.DeferredReflection` class has been enhanced to provide
automatic reflection support for the "secondary" table referred
to by a :func:`_orm.relationship`. "secondary", when specified
either as a string table name, or as a :class:`_schema.Table` object with
only a name and :class:`_schema.MetaData` object will also be included
in the reflection process when :meth:`.DeferredReflection.prepare`
is called.

.. change::
:tags: feature, orm, backrefs
:tickets: 1535

Added new argument ``include_backrefs=True`` to the
:func:`.validates` function; when set to False, a validation event
will not be triggered if the event was initiated as a backref to
an attribute operation from the other side.

.. seealso::

:ref:`feature_1535`

.. change::
:tags: bug, orm, collections, py3k

Added support for the Python 3 method ``list.clear()`` within
the ORM collection instrumentation system; pull request
courtesy Eduardo Schettino.

.. change::
:tags: bug, postgresql
:tickets: 2878

Fixed bug where values within an ENUM weren't escaped for single
quote signs. Note that this is backwards-incompatible for existing
workarounds that manually escape the single quotes.

.. seealso::

:ref:`migration_2878`

.. change::
:tags: bug, orm, declarative

Fixed bug where in Py2K a unicode literal would not be accepted
as the string name of a class or other argument within
declarative using :func:`_orm.relationship`.

.. change::
:tags: feature, sql
:tickets: 2877, 2882

New improvements to the :func:`_expression.text` construct, including
more flexible ways to set up bound parameters and return types;
in particular, a :func:`_expression.text` can now be turned into a full
FROM-object, embeddable in other statements as an alias or CTE
using the new method :meth:`_expression.TextClause.columns`. The :func:`_expression.text`
construct can also render "inline" bound parameters when the construct
is compiled in a "literal bound" context.

.. seealso::

:ref:`feature_2877`

.. change::
:tags: feature, sql

A new API for specifying the ``FOR UPDATE`` clause of a ``SELECT``
is added with the new :meth:`_expression.GenerativeSelect.with_for_update` method.
This method supports a more straightforward system of setting
dialect-specific options compared to the ``for_update`` keyword
argument of :func:`_expression.select`, and also includes support for the
SQL standard ``FOR UPDATE OF`` clause. The ORM also includes
a new corresponding method :meth:`_query.Query.with_for_update`.
Pull request courtesy Mario Lassnig.

.. seealso::

:ref:`feature_github_42`

.. change::
:tags: feature, orm

A new API for specifying the ``FOR UPDATE`` clause of a ``SELECT``
is added with the new :meth:`_query.Query.with_for_update` method,
to complement the new :meth:`_expression.GenerativeSelect.with_for_update` method.
Pull request courtesy Mario Lassnig.

.. seealso::

:ref:`feature_github_42`

.. change::
:tags: bug, engine
:tickets: 2873

The :func:`_sa.create_engine` routine and the related :func:`.make_url`
function no longer considers the ``+`` sign to be a space within the
password field. The parsing in this area has been adjusted to match
more closely to how RFC 1738 handles these tokens, in that both
``username`` and ``password`` expect only ``:``, `, and ``/`` to be
encoded.

.. seealso::

:ref:`migration_2873`


.. change::
:tags: bug, orm
:tickets: 2872

Some refinements to the :class:`.AliasedClass` construct with regards
to descriptors, like hybrids, synonyms, composites, user-defined
descriptors, etc. The attribute
adaptation which goes on has been made more robust, such that if a descriptor
returns another instrumented attribute, rather than a compound SQL
expression element, the operation will still proceed.
Additionally, the "adapted" operator will retain its class; previously,
a change in class from ``InstrumentedAttribute`` to ``QueryableAttribute``
(a superclass) would interact with Python's operator system such that
an expression like ``aliased(MyClass.x) > MyClass.x`` would reverse itself
to read ``myclass.x < myclass_1.x``. The adapted attribute will also
refer to the new :class:`.AliasedClass` as its parent which was not
always the case before.

.. change::
:tags: feature, sql
:tickets: 2867

The precision used when coercing a returned floating point value to
Python ``Decimal`` via string is now configurable. The
flag ``decimal_return_scale`` is now supported by all :class:`.Numeric`
and :class:`.Float` types, which will ensure this many digits are taken
from the native floating point value when it is converted to string.
If not present, the type will make use of the value of ``.scale``, if
the type supports this setting and it is non-None. Otherwise the original
default length of 10 is used.

.. seealso::

:ref:`feature_2867`

.. change::
:tags: bug, schema
:tickets: 2868

Fixed a regression caused by :ticket:`2812` where the repr() for
table and column names would fail if the name contained non-ascii
characters.

.. change::
:tags: bug, engine
:tickets: 2848

The :class:`.RowProxy` object is now sortable in Python as a regular
tuple is; this is accomplished via ensuring tuple() conversion on
both sides within the ``__eq__()`` method as well as
the addition of a ``__lt__()`` method.

.. seealso::

:ref:`migration_2848`

.. change::
:tags: bug, orm
:tickets: 2833

The ``viewonly`` flag on :func:`_orm.relationship` will now prevent
attribute history from being written on behalf of the target attribute.
This has the effect of the object not being written to the
Session.dirty list if it is mutated. Previously, the object would
be present in Session.dirty, but no change would take place on behalf
of the modified attribute during flush. The attribute still emits
events such as backref events and user-defined events and will still
receive mutations from backrefs.

.. seealso::

:ref:`migration_2833`

.. change::
:tags: bug, orm

Added support for new :attr:`.Session.info` attribute to
:class:`.scoped_session`.

.. change::
:tags: removed

The "informix" and "informixdb" dialects have been removed; the code
is now available as a separate repository on Bitbucket. The IBM-DB
project has provided production-level Informix support since the
informixdb dialect was first added.

.. change::
:tags: bug, orm

Fixed bug where usage of new :class:`.Bundle` object would cause
the :attr:`_query.Query.column_descriptions` attribute to fail.

.. change::
:tags: bug, examples

Fixed bug which prevented history_meta recipe from working with
joined inheritance schemes more than one level deep.

.. change::
:tags: bug, orm, sql, sqlite
:tickets: 2858

Fixed a regression introduced by the join rewriting feature of
:ticket:`2369` and :ticket:`2587` where a nested join with one side
already an aliased select would fail to translate the ON clause on the
outside correctly; in the ORM this could be seen when using a
SELECT statement as a "secondary" table.

.. changelog::
:version: 0.9.0b1
:released: October 26, 2013

.. change::
:tags: feature, orm
:tickets: 2810

The association proxy now returns ``None`` when fetching a scalar
attribute off of a scalar relationship, where the scalar relationship
itself points to ``None``, instead of raising an ``AttributeError``.

.. seealso::

:ref:`migration_2810`

.. change::
:tags: feature, sql, postgresql, mysql
:tickets: 2183

The PostgreSQL and MySQL dialects now support reflection/inspection
of foreign key options, including ON UPDATE, ON DELETE. PostgreSQL
also reflects MATCH, DEFERRABLE, and INITIALLY. Courtesy ijl.

.. change::
:tags: bug, mysql
:tickets: 2839

Fix and test parsing of MySQL foreign key options within reflection;
this complements the work in :ticket:`2183` where we begin to support
reflection of foreign key options such as ON UPDATE/ON DELETE
cascade.

.. change::
:tags: bug, orm
:tickets: 2787

:func:`.attributes.get_history()` when used with a scalar column-mapped
attribute will now honor the "passive" flag
passed to it; as this defaults to ``PASSIVE_OFF``, the function will
by default query the database if the value is not present.
This is a behavioral change vs. 0.8.

.. seealso::

:ref:`change_2787`

.. change::
:tags: feature, orm
:tickets: 2787

Added new method :meth:`.AttributeState.load_history`, works like
:attr:`.AttributeState.history` but also fires loader callables.

.. seealso::

:ref:`change_2787`


.. change::
:tags: feature, sql
:tickets: 2850

A :func:`.bindparam` construct with a "null" type (e.g. no type
specified) is now copied when used in a typed expression, and the
new copy is assigned the actual type of the compared column. Previously,
this logic would occur on the given :func:`.bindparam` in place.
Additionally, a similar process now occurs for :func:`.bindparam` constructs
passed to :meth:`.ValuesBase.values` for an :class:`_expression.Insert` or
:class:`_expression.Update` construct, within the compilation phase of the
construct.

These are both subtle behavioral changes which may impact some
usages.

.. seealso::

:ref:`migration_2850`

.. change::
:tags: feature, sql
:tickets: 2804, 2823, 2734

An overhaul of expression handling for special symbols particularly
with conjunctions, e.g.
``None`` :func:`_expression.null` :func:`_expression.true`
:func:`_expression.false`, including consistency in rendering NULL
in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_`
expressions which contain boolean constants, and rendering of
boolean constants and expressions as compared to "1" or "0" for backends
that don't feature ``true``/``false`` constants.

.. seealso::

:ref:`migration_2804`

.. change::
:tags: feature, sql
:tickets: 2838

The typing system now handles the task of rendering "literal bind" values,
e.g. values that are normally bound parameters but due to context must
be rendered as strings, typically within DDL constructs such as
CHECK constraints and indexes (note that "literal bind" values
become used by DDL as of :ticket:`2742`). A new method
:meth:`.TypeEngine.literal_processor` serves as the base, and
:meth:`.TypeDecorator.process_literal_param` is added to allow wrapping
of a native literal rendering method.

.. seealso::

:ref:`change_2838`

.. change::
:tags: feature, sql
:tickets: 2716

The :meth:`_schema.Table.tometadata` method now produces copies of
all :attr:`.SchemaItem.info` dictionaries from all :class:`.SchemaItem`
objects within the structure including columns, constraints,
foreign keys, etc. As these dictionaries
are copies, they are independent of the original dictionary.
Previously, only the ``.info`` dictionary of :class:`_schema.Column` was transferred
within this operation, and it was only linked in place, not copied.

.. change::
:tags: feature, postgresql
:tickets: 2840

Added support for rendering ``SMALLSERIAL`` when a :class:`.SmallInteger`
type is used on a primary key autoincrement column, based on server
version detection of PostgreSQL version 9.2 or greater.

.. change::
:tags: feature, mysql
:tickets: 2817

The MySQL :class:`.mysql.SET` type now features the same auto-quoting
behavior as that of :class:`.mysql.ENUM`. Quotes are not required when
setting up the value, but quotes that are present will be auto-detected
along with a warning. This also helps with Alembic where
the SET type doesn't render with quotes.

.. change::
:tags: feature, sql

The ``default`` argument of :class:`_schema.Column` now accepts a class
or object method as an argument, in addition to a standalone function;
will properly detect if the "context" argument is accepted or not.

.. change::
:tags: bug, sql
:tickets: 2835

The "name" attribute is set on :class:`.Index` before the "attach"
events are called, so that attachment events can be used to dynamically
generate a name for the index based on the parent table and/or
columns.

.. change::
:tags: bug, engine
:tickets: 2748

The method signature of :meth:`.Dialect.reflecttable`, which in
all known cases is provided by :class:`.DefaultDialect`, has been
tightened to expect ``include_columns`` and ``exclude_columns``
arguments without any kw option, reducing ambiguity - previously
``exclude_columns`` was missing.

.. change::
:tags: bug, sql
:tickets: 2831

The erroneous kw arg "schema" has been removed from the :class:`_schema.ForeignKey`
object. this was an accidental commit that did nothing; a warning is raised
in 0.8.3 when this kw arg is used.

.. change::
:tags: feature, orm
:tickets: 1418

Added a new load option :func:`_orm.load_only`. This allows a series
of column names to be specified as loading "only" those attributes,
deferring the rest.

.. change::
:tags: feature, orm
:tickets: 1418

The system of loader options has been entirely rearchitected to build
upon a much more comprehensive base, the :class:`_orm.Load` object. This
base allows any common loader option like :func:`_orm.joinedload`,
:func:`.defer`, etc. to be used in a "chained" style for the purpose
of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``.
The new system supersedes the usage of dot-separated path names,
multiple attributes within options, and the usage of ``_all()`` options.

.. seealso::

:ref:`feature_1418`

.. change::
:tags: feature, orm
:tickets: 2824

The :func:`.composite` construct now maintains the return object
when used in a column-oriented :class:`_query.Query`, rather than expanding
out into individual columns. This makes use of the new :class:`.Bundle`
feature internally. This behavior is backwards incompatible; to
select from a composite column which will expand out, use
``MyClass.some_composite.clauses``.

.. seealso::

:ref:`migration_2824`

.. change::
:tags: feature, orm
:tickets: 2824

A new construct :class:`.Bundle` is added, which allows for specification
of groups of column expressions to a :class:`_query.Query` construct.
The group of columns are returned as a single tuple by default. The
behavior of :class:`.Bundle` can be overridden however to provide
any sort of result processing to the returned row. The behavior
of :class:`.Bundle` is also embedded into composite attributes now
when they are used in a column-oriented :class:`_query.Query`.

.. seealso::

:ref:`change_2824`

:ref:`migration_2824`

.. change::
:tags: bug, sql
:tickets: 2812

A rework to the way that "quoted" identifiers are handled, in that
instead of relying upon various ``quote=True`` flags being passed around,
these flags are converted into rich string objects with quoting information
included at the point at which they are passed to common schema constructs
like :class:`_schema.Table`, :class:`_schema.Column`, etc. This solves the issue
of various methods that don't correctly honor the "quote" flag such
as :meth:`_engine.Engine.has_table` and related methods. The :class:`.quoted_name`
object is a string subclass that can also be used explicitly if needed;
the object will hold onto the quoting preferences passed and will
also bypass the "name normalization" performed by dialects that
standardize on uppercase symbols, such as Oracle, Firebird and DB2.
The upshot is that the "uppercase" backends can now work with force-quoted
names, such as lowercase-quoted names and new reserved words.

.. seealso::

:ref:`change_2812`

.. change::
:tags: feature, orm
:tickets: 2793

The ``version_id_generator`` parameter of ``Mapper`` can now be specified
to rely upon server generated version identifiers, using triggers
or other database-provided versioning features, or via an optional programmatic
value, by setting ``version_id_generator=False``.
When using a server-generated version identifier, the ORM will use RETURNING when
available to immediately
load the new version value, else it will emit a second SELECT.

.. change::
:tags: feature, orm
:tickets: 2793

The ``eager_defaults`` flag of :class:`_orm.Mapper` will now allow the
newly generated default values to be fetched using an inline
RETURNING clause, rather than a second SELECT statement, for backends
that support RETURNING.

.. change::
:tags: feature, core
:tickets: 2793

Added a new variant to :meth:`.UpdateBase.returning` called
:meth:`.ValuesBase.return_defaults`; this allows arbitrary columns
to be added to the RETURNING clause of the statement without interfering
with the compilers usual "implicit returning" feature, which is used to
efficiently fetch newly generated primary key values. For supporting
backends, a dictionary of all fetched values is present at
:attr:`_engine.ResultProxy.returned_defaults`.

.. change::
:tags: bug, mysql

Improved support for the cymysql driver, supporting version 0.6.5,
courtesy Hajime Nakagami.

.. change::
:tags: general

A large refactoring of packages has reorganized
the import structure of many Core modules as well as some aspects
of the ORM modules. In particular ``sqlalchemy.sql`` has been broken
out into several more modules than before so that the very large size
of ``sqlalchemy.sql.expression`` is now pared down. The effort
has focused on a large reduction in import cycles. Additionally,
the system of API functions in ``sqlalchemy.sql.expression`` and
``sqlalchemy.orm`` has been reorganized to eliminate redundancy
in documentation between the functions vs. the objects they produce.

.. change::
:tags: orm, feature, orm

Added a new attribute :attr:`.Session.info` to :class:`.Session`;
this is a dictionary where applications can store arbitrary
data local to a :class:`.Session`.
The contents of :attr:`.Session.info` can be also be initialized
using the ``info`` argument of :class:`.Session` or
:class:`.sessionmaker`.


.. change::
:tags: feature, general, py3k
:tickets: 2161

The C extensions are ported to Python 3 and will build under
any supported CPython 2 or 3 environment.

.. change::
:tags: feature, orm
:tickets: 2268

Removal of event listeners is now implemented. The feature is
provided via the :func:`.event.remove` function.

.. seealso::

:ref:`feature_2268`

.. change::
:tags: feature, orm
:tickets: 2789

The mechanism by which attribute events pass along an
:class:`.AttributeImpl` as an "initiator" token has been changed;
the object is now an event-specific object called :class:`.attributes.Event`.
Additionally, the attribute system no longer halts events based
on a matching "initiator" token; this logic has been moved to be
specific to ORM backref event handlers, which are the typical source
of the re-propagation of an attribute event onto subsequent append/set/remove
operations. End user code which emulates the behavior of backrefs
must now ensure that recursive event propagation schemes are halted,
if the scheme does not use the backref handlers. Using this new system,
backref handlers can now perform a
"two-hop" operation when an object is appended to a collection,
associated with a new many-to-one, de-associated with the previous
many-to-one, and then removed from a previous collection. Before this
change, the last step of removal from the previous collection would
not occur.

.. seealso::

:ref:`migration_2789`

.. change::
:tags: feature, sql
:tickets: 722

Added new method to the :func:`_expression.insert` construct
:meth:`_expression.Insert.from_select`. Given a list of columns and
a selectable, renders ``INSERT INTO (table) (columns) SELECT ..``.
While this feature is highlighted as part of 0.9 it is also
backported to 0.8.3.

.. seealso::

:ref:`feature_722`

.. change::
:tags: feature, engine
:tickets: 2770

New events added to :class:`_events.ConnectionEvents`:

* :meth:`_events.ConnectionEvents.engine_connect`
* :meth:`_events.ConnectionEvents.set_connection_execution_options`
* :meth:`_events.ConnectionEvents.set_engine_execution_options`

.. change::
:tags: bug, sql
:tickets: 1765

The resolution of :class:`_schema.ForeignKey` objects to their
target :class:`_schema.Column` has been reworked to be as
immediate as possible, based on the moment that the
target :class:`_schema.Column` is associated with the same
:class:`_schema.MetaData` as this :class:`_schema.ForeignKey`, rather
than waiting for the first time a join is constructed,
or similar. This along with other improvements allows
earlier detection of some foreign key configuration
issues. Also included here is a rework of the
type-propagation system, so that
it should be reliable now to set the type as ``None``
on any :class:`_schema.Column` that refers to another via
:class:`_schema.ForeignKey` - the type will be copied from the
target column as soon as that other column is associated,
and now works for composite foreign keys as well.

.. seealso::

:ref:`migration_1765`

.. change::
:tags: feature, sql
:tickets: 2744, 2734

Provided a new attribute for :class:`.TypeDecorator`
called :attr:`.TypeDecorator.coerce_to_is_types`,
to make it easier to control how comparisons using
``==`` or ``!=`` to ``None`` and boolean types goes
about producing an ``IS`` expression, or a plain
equality expression with a bound parameter.

.. change::
:tags: feature, pool
:tickets: 2752

Added pool logging for "rollback-on-return" and the less used
"commit-on-return". This is enabled with the rest of pool
"debug" logging.

.. change::
:tags: bug, orm, associationproxy
:tickets: 2751

Added additional criterion to the ==, != comparators, used with
scalar values, for comparisons to None to also take into account
the association record itself being non-present, in addition to the
existing test for the scalar endpoint on the association record
being NULL. Previously, comparing ``Cls.scalar == None`` would return
records for which ``Cls.associated`` were present and
``Cls.associated.scalar`` is None, but not rows for which
``Cls.associated`` is non-present. More significantly, the
inverse operation ``Cls.scalar != None`` *would* return ``Cls``
rows for which ``Cls.associated`` was non-present.

The case for ``Cls.scalar != 'somevalue'`` is also modified
to act more like a direct SQL comparison; only rows for
which ``Cls.associated`` is present and ``Associated.scalar``
is non-NULL and not equal to ``'somevalue'`` are returned.
Previously, this would be a simple ``NOT EXISTS``.

Also added a special use case where you
can call ``Cls.scalar.has()`` with no arguments,
when ``Cls.scalar`` is a column-based value - this returns whether or
not ``Cls.associated`` has any rows present, regardless of whether
or not ``Cls.associated.scalar`` is NULL or not.

.. seealso::

:ref:`migration_2751`


.. change::
:tags: feature, orm
:tickets: 2587

A major change regarding how the ORM constructs joins where
the right side is itself a join or left outer join. The ORM
is now configured to allow simple nesting of joins of
the form ``a JOIN (b JOIN c ON b.id=c.id) ON a.id=b.id``,
rather than forcing the right side into a ``SELECT`` subquery.
This should allow significant performance improvements on most
backends, most particularly MySQL. The one database backend
that has for many years held back this change, SQLite, is now addressed by
moving the production of the ``SELECT`` subquery from the
ORM to the SQL compiler; so that a right-nested join on SQLite will still
ultimately render with a ``SELECT``, while all other backends
are no longer impacted by this workaround.

As part of this change, a new argument ``flat=True`` has been added
to the :func:`_orm.aliased`, :meth:`_expression.Join.alias`, and
:func:`_orm.with_polymorphic` functions, which allows an "alias" of a
JOIN to be produced which applies an anonymous alias to each component
table within the join, rather than producing a subquery.

.. seealso::

:ref:`feature_joins_09`


.. change::
:tags: bug, orm
:tickets: 2369

Fixed an obscure bug where the wrong results would be
fetched when joining/joinedloading across a many-to-many
relationship to a single-table-inheriting
subclass with a specific discriminator value, due to "secondary"
rows that would come back. The "secondary" and right-side
tables are now inner joined inside of parenthesis for all
ORM joins on many-to-many relationships so that the left->right
join can accurately filtered. This change was made possible
by finally addressing the issue with right-nested joins
outlined in :ticket:`2587`.

.. seealso::

:ref:`feature_joins_09`

.. change::
:tags: bug, mssql, pyodbc
:tickets: 2355

Fixes to MSSQL with Python 3 + pyodbc, including that statements
are passed correctly.

.. change::
:tags: feature, sql
:tickets: 1068

A :func:`~sqlalchemy.sql.expression.label` construct will now render as its name alone
in an ``ORDER BY`` clause, if that label is also referred to
in the columns clause of the select, instead of rewriting the
full expression. This gives the database a better chance to
optimize the evaluation of the same expression in two different
contexts.

.. seealso::

:ref:`migration_1068`

.. change::
:tags: feature, firebird
:tickets: 2504

The ``fdb`` dialect is now the default dialect when
specified without a dialect qualifier, i.e. ``firebird://``,
per the Firebird project publishing ``fdb`` as their
official Python driver.

.. change::
:tags: feature, general, py3k
:tickets: 2671

The codebase is now "in-place" for Python
2 and 3, the need to run 2to3 has been removed.
Compatibility is now against Python 2.6 on forward.

.. change::
:tags: feature, oracle, py3k

The Oracle unit tests with cx_oracle now pass
fully under Python 3.

.. change::
:tags: bug, orm
:tickets: 2736

The "auto-aliasing" behavior of the :meth:`_query.Query.select_from`
method has been turned off. The specific behavior is now
available via a new method :meth:`_query.Query.select_entity_from`.
The auto-aliasing behavior here was never well documented and
is generally not what's desired, as :meth:`_query.Query.select_from`
has become more oriented towards controlling how a JOIN is
rendered. :meth:`_query.Query.select_entity_from` will also be made
available in 0.8 so that applications which rely on the auto-aliasing
can shift their applications to use this method.

.. seealso::

:ref:`migration_2736`


=============
1.0 Changelog
=============

.. changelog_imports::

.. include:: changelog_09.rst
:start-line: 5


.. include:: changelog_08.rst
:start-line: 5


.. include:: changelog_07.rst
:start-line: 5



.. changelog::

0.8.7

Not secure
:released: July 22, 2014

.. change::
:tags: bug, mssql
:versions: 1.0.0b1, 0.9.7

Added statement encoding to the "SET IDENTITY_INSERT"
statements which operate when an explicit INSERT is being
interjected into an IDENTITY column, to support non-ascii table
identifiers on drivers such as pyodbc + unix + py2k that don't
support unicode statements.

.. change::
:tags: bug, mssql
:versions: 1.0.0b1, 0.9.7
:tickets: 3091

In the SQL Server pyodbc dialect, repaired the implementation
for the ``description_encoding`` dialect parameter, which when
not explicitly set was preventing cursor.description from
being parsed correctly in the case of result sets that
contained names in alternate encodings. This parameter
shouldn't be needed going forward.

.. change::
:tags: bug, sql
:versions: 1.0.0b1, 0.9.7
:tickets: 3124

Fixed bug in :class:`.Enum` and other :class:`.SchemaType`
subclasses where direct association of the type with a
:class:`_schema.MetaData` would lead to a hang when events
(like create events) were emitted on the :class:`_schema.MetaData`.

.. change::
:tags: bug, sql
:versions: 1.0.0b1, 0.9.7
:tickets: 3102

Fixed a bug within the custom operator plus :meth:`.TypeEngine.with_variant`
system, whereby using a :class:`.TypeDecorator` in conjunction with
variant would fail with an MRO error when a comparison operator was used.

.. change::
:tags: bug, mysql
:versions: 1.0.0b1, 0.9.7
:tickets: 3101

MySQL error 2014 "commands out of sync" appears to be raised as a
ProgrammingError, not OperationalError, in modern MySQL-Python versions;
all MySQL error codes that are tested for "is disconnect" are now
checked within OperationalError and ProgrammingError regardless.

.. change::
:tags: bug, mysql
:versions: 1.0.0b1, 0.9.5
:tickets: 3085

Fixed bug where column names added to ``mysql_length`` parameter
on an index needed to have the same quoting for quoted names in
order to be recognized. The fix makes the quotes optional but
also provides the old behavior for backwards compatibility with those
using the workaround.

.. change::
:tags: bug, declarative
:versions: 1.0.0b1, 0.9.5
:tickets: 3062

The ``__mapper_args__`` dictionary is copied from a declarative
mixin or abstract class when accessed, so that modifications made
to this dictionary by declarative itself won't conflict with that
of other mappings. The dictionary is modified regarding the
``version_id_col`` and ``polymorphic_on`` arguments, replacing the
column within with the one that is officially mapped to the local
class/table.

.. change::
:tags: bug, sql
:versions: 0.9.5, 1.0.0b1
:tickets: 3044

Fixed bug in INSERT..FROM SELECT construct where selecting from a
UNION would wrap the union in an anonymous (e.g. unlabeled) subquery.

.. change::
:tags: bug, postgresql
:versions: 0.9.5, 1.0.0b1
:tickets: 3053

Added the ``hashable=False`` flag to the PG :class:`.HSTORE` type, which
is needed to allow the ORM to skip over trying to "hash" an ORM-mapped
HSTORE column when requesting it in a mixed column/entity list.
Patch courtesy Gunnlaugur Þór Briem.

.. change::
:tags: bug, orm
:versions: 0.9.5, 1.0.0b1
:tickets: 3055

Fixed bug in subquery eager loading where a long chain of
eager loads across a polymorphic-subclass boundary in conjunction
with polymorphic loading would fail to locate the subclass-link in the
chain, erroring out with a missing property name on an
:class:`.AliasedClass`.

.. change::
:tags: bug, ext
:versions: 0.9.5, 1.0.0b1
:tickets: 3051, 3093

Fixed bug in mutable extension where :class:`.MutableDict` did not
report change events for the ``setdefault()`` dictionary operation.

.. change::
:tags: bug, ext
:versions: 0.9.5, 1.0.0b1
:tickets: 3093, 3051

Fixed bug where :meth:`.MutableDict.setdefault` didn't return the
existing or new value (this bug was not released in any 0.8 version).
Pull request courtesy Thomas Hervé.

.. change::
:tags: bug, mysql
:versions: 0.9.5, 1.0.0b1

Added support for reflecting tables where an index includes
KEY_BLOCK_SIZE using an equal sign. Pull request courtesy
Sean McGivern.

.. change::
:tags: bug, orm
:tickets: 3047
:versions: 0.9.5, 1.0.0b1

Fixed ORM bug where the :func:`.class_mapper` function would mask
AttributeErrors or KeyErrors that should raise during mapper
configuration due to user errors. The catch for attribute/keyerror
has been made more specific to not include the configuration step.

.. change::
:tags: bug, sql
:tickets: 3045
:versions: 0.9.5, 1.0.0b1

Fixed bug where :meth:`_schema.Table.update` and :meth:`_schema.Table.delete`
would produce an empty WHERE clause when an empty :func:`.and_()`
or :func:`.or_()` or other blank expression were applied. This is
now consistent with that of :func:`_expression.select`.

.. change::
:tags: bug, postgresql
:versions: 0.9.5, 1.0.0b1

Added a new "disconnect" message "connection has been closed unexpectedly".
This appears to be related to newer versions of SSL.
Pull request courtesy Antti Haapala.

.. changelog::

0.8.6

Not secure
:released: March 28, 2014

.. change::
:tags: bug, orm
:tickets: 3006
:versions: 0.9.4

Fixed ORM bug where changing the primary key of an object, then marking
it for DELETE would fail to target the correct row for DELETE.

.. change::
:tags: feature, postgresql
:versions: 0.9.4

Enabled "sane multi-row count" checking for the psycopg2 DBAPI, as
this seems to be supported as of psycopg2 2.0.9.

.. change::
:tags: bug, postgresql
:tickets: 3000
:versions: 0.9.4

Fixed regression caused by release 0.8.5 / 0.9.3's compatibility
enhancements where index reflection on PostgreSQL versions specific
to only the 8.1, 8.2 series again
broke, surrounding the ever problematic int2vector type. While
int2vector supports array operations as of 8.1, apparently it only
supports CAST to a varchar as of 8.3.

.. change::
:tags: bug, orm
:tickets: 2995,
:versions: 0.9.4

Fixed regression from 0.8.3 as a result of :ticket:`2818`
where :meth:`_query.Query.exists` wouldn't work on a query that only
had a :meth:`_query.Query.select_from` entry but no other entities.

.. change::
:tags: bug, general
:tickets: 2986
:versions: 0.9.4

Adjusted ``setup.py`` file to support the possible future
removal of the ``setuptools.Feature`` extension from setuptools.
If this keyword isn't present, the setup will still succeed
with setuptools rather than falling back to distutils. C extension
building can be disabled now also by setting the
DISABLE_SQLALCHEMY_CEXT environment variable. This variable works
whether or not setuptools is even available.

.. change::
:tags: bug, ext
:versions: 0.9.4
:tickets: 2997

Fixed bug in mutable extension as well as
:func:`.attributes.flag_modified` where the change event would not be
propagated if the attribute had been reassigned to itself.

.. change::
:tags: bug, orm
:versions: 0.9.4

Improved an error message which would occur if a query() were made
against a non-selectable, such as a :func:`_expression.literal_column`, and then
an attempt was made to use :meth:`_query.Query.join` such that the "left"
side would be determined as ``None`` and then fail. This condition
is now detected explicitly.

.. change::
:tags: bug, sql
:versions: 0.9.4
:tickets: 2977

Fixed bug in :func:`.tuple_` construct where the "type" of essentially
the first SQL expression would be applied as the "comparison type"
to a compared tuple value; this has the effect in some cases of an
inappropriate "type coercion" occurring, such as when a tuple that
has a mix of String and Binary values improperly coerces target
values to Binary even though that's not what they are on the left
side. :func:`.tuple_` now expects heterogeneous types within its
list of values.

.. change::
:tags: orm, bug
:versions: 0.9.4
:tickets: 2975

Removed stale names from ``sqlalchemy.orm.interfaces.__all__`` and
refreshed with current names, so that an ``import *`` from this
module again works.

.. changelog::

0.8.5

Not secure
:released: February 19, 2014

.. change::
:tags: postgresql, bug
:versions: 0.9.3
:tickets: 2936

Added an additional message to psycopg2 disconnect detection,
"could not send data to server", which complements the existing
"could not receive data from server" and has been observed by users.

.. change::
:tags: postgresql, bug
:versions: 0.9.3

Support has been improved for PostgreSQL reflection behavior on very old
(pre 8.1) versions of PostgreSQL, and potentially other PG engines
such as Redshift (assuming Redshift reports the version as < 8.1).
The query for "indexes" as well as "primary keys" relies upon inspecting
a so-called "int2vector" datatype, which refuses to coerce to an array
prior to 8.1 causing failures regarding the "ANY()" operator used
in the query. Extensive googling has located the very hacky, but
recommended-by-PG-core-developer query to use when PG version < 8.1
is in use, so index and primary key constraint reflection now work
on these versions.


.. change::
:tags: feature, mysql
:versions: 0.9.3
:tickets: 2941

Added new MySQL-specific :class:`.mysql.DATETIME` which includes
fractional seconds support; also added fractional seconds support
to :class:`.mysql.TIMESTAMP`. DBAPI support is limited, though
fractional seconds are known to be supported by MySQL Connector/Python.
Patch courtesy Geert JM Vanderkelen.

.. change::
:tags: bug, mysql
:versions: 0.9.3
:tickets: 2966

Added support for the ``PARTITION BY`` and ``PARTITIONS``
MySQL table keywords, specified as ``mysql_partition_by='value'`` and
``mysql_partitions='value'`` to :class:`_schema.Table`. Pull request
courtesy Marcus McCurdy.

.. change::
:tags: bug, sql
:versions: 0.9.3
:tickets: 2944

Fixed bug where calling :meth:`_expression.Insert.values` with an empty list
or tuple would raise an IndexError. It now produces an empty
insert construct as would be the case with an empty dictionary.

.. change::
:tags: bug, engine, pool
:versions: 0.9.3
:tickets: 2880, 2964

Fixed a critical regression caused by :ticket:`2880` where the newly
concurrent ability to return connections from the pool means that the
"first_connect" event is now no longer synchronized either, thus leading
to dialect mis-configurations under even minimal concurrency situations.

.. change::
:tags: bug, sqlite

Restored a change that was missed in the backport of unique
constraint reflection to 0.8, where :class:`.UniqueConstraint`
with SQLite would fail if reserved keywords were included in the
names of columns. Pull request courtesy Roman Podolyaka.

.. change::
:tags: bug, postgresql
:tickets: 2291
:versions: 0.9.3

Revised this very old issue where the PostgreSQL "get primary key"
reflection query were updated to take into account primary key constraints
that were renamed; the newer query fails on very old versions of
PostgreSQL such as version 7, so the old query is restored in those cases
when server_version_info < (8, 0) is detected.

.. change::
:tags: bug, sql
:tickets: 2957
:versions: 0.9.3

Fixed bug where :meth:`.ColumnOperators.in_` would go into an endless
loop if erroneously passed a column expression whose comparator
included the ``__getitem__()`` method, such as a column that uses the
:class:`_postgresql.ARRAY` type.

.. change::
:tags: bug, orm
:tickets: 2951
:versions: 0.9.3

Fixed bug where :meth:`_query.Query.get` would fail to consistently
raise the :class:`.InvalidRequestError` that invokes when called
on a query with existing criterion, when the given identity is
already present in the identity map.

.. change::
:tags: bug, mysql
:tickets: 2933
:versions: 0.9.3

Fixed bug which prevented MySQLdb-based dialects (e.g.
pymysql) from working in Py3K, where a check for "connection
charset" would fail due to Py3K's more strict value comparison
rules. The call in question wasn't taking the database
version into account in any case as the server version was
still None at that point, so the method overall has been
simplified to rely upon connection.character_set_name().

.. change::
:tags: bug, mysql
:versions: 0.9.2

Some missing methods added to the cymysql dialect, including
_get_server_version_info() and _detect_charset(). Pullreq
courtesy Hajime Nakagami.

.. change::
:tags: bug, py3k

Fixed Py3K bug where a missing import would cause "literal binary"
mode to fail to import "util.binary_type" when rendering a bound
parameter. 0.9 handles this differently. Pull request courtesy
Andreas Zeidler.

.. change::
:tags: bug, orm
:versions: 0.9.2

Fixed error message when an iterator object is passed to
:func:`.class_mapper` or similar, where the error would fail to
render on string formatting. Pullreq courtesy Kyle Stark.

.. change::
:tags: bug, firebird
:versions: 0.9.0
:tickets: 2897

The firebird dialect will quote identifiers which begin with an
underscore. Courtesy Treeve Jelbert.

.. change::
:tags: bug, firebird
:versions: 0.9.0

Fixed bug in Firebird index reflection where the columns within the
index were not sorted correctly; they are now sorted
in order of RDB$FIELD_POSITION.

.. change::
:tags: bug, mssql, firebird
:versions: 0.9.0

The "asdecimal" flag used with the :class:`.Float` type will now
work with Firebird as well as the mssql+pyodbc dialects; previously the
decimal conversion was not occurring.

.. change::
:tags: bug, mssql, pymssql
:versions: 0.9.0

Added "Net-Lib error during Connection reset by peer" message
to the list of messages checked for "disconnect" within the
pymssql dialect. Courtesy John Anderson.

.. change::
:tags: bug, sql
:versions: 0.9.0
:tickets: 2896

Fixed issue where a primary key column that has a Sequence on it,
yet the column is not the "auto increment" column, either because
it has a foreign key constraint or ``autoincrement=False`` set,
would attempt to fire the Sequence on INSERT for backends that don't
support sequences, when presented with an INSERT missing the primary
key value. This would take place on non-sequence backends like
SQLite, MySQL.

.. change::
:tags: bug, sql
:versions: 0.9.0
:tickets: 2895

Fixed bug with :meth:`_expression.Insert.from_select` method where the order
of the given names would not be taken into account when generating
the INSERT statement, thus producing a mismatch versus the column
names in the given SELECT statement. Also noted that
:meth:`_expression.Insert.from_select` implies that Python-side insert defaults
cannot be used, since the statement has no VALUES clause.

.. change::
:tags: enhancement, sql
:versions: 0.9.0

The exception raised when a :class:`.BindParameter` is present
in a compiled statement without a value now includes the key name
of the bound parameter in the error message.

.. change::
:tags: bug, orm
:versions: 0.9.0
:tickets: 2887

An adjustment to the :func:`.subqueryload` strategy which ensures that
the query runs after the loading process has begun; this is so that
the subqueryload takes precedence over other loaders that may be
hitting the same attribute due to other eager/noload situations
at the wrong time.

.. change::
:tags: bug, orm
:versions: 0.9.0
:tickets: 2885

Fixed bug when using joined table inheritance from a table to a
select/alias on the base, where the PK columns were also not same
named; the persistence system would fail to copy primary key values
from the base table to the inherited table upon INSERT.

.. change::
:tags: bug, orm
:versions: 0.9.0
:tickets: 2889

:func:`.composite` will raise an informative error message when the
columns/attribute (names) passed don't resolve to a Column or mapped
attribute (such as an erroneous tuple); previously raised an unbound
local.

.. change::
:tags: bug, declarative
:versions: 0.9.0
:tickets: 2888

Error message when a string arg sent to :func:`_orm.relationship` which
doesn't resolve to a class or mapper has been corrected to work
the same way as when a non-string arg is received, which indicates
the name of the relationship which had the configurational error.

.. changelog::

0.8.4

Not secure
:released: December 8, 2013

.. change::
:tags: bug, engine
:versions: 0.9.0
:tickets: 2881

A DBAPI that raises an error on ``connect()`` which is not a subclass
of dbapi.Error (such as ``TypeError``, ``NotImplementedError``, etc.)
will propagate the exception unchanged. Previously,
the error handling specific to the ``connect()`` routine would both
inappropriately run the exception through the dialect's
:meth:`.Dialect.is_disconnect` routine as well as wrap it in
a :class:`sqlalchemy.exc.DBAPIError`. It is now propagated unchanged
in the same way as occurs within the execute process.

.. change::
:tags: bug, engine, pool
:versions: 0.9.0
:tickets: 2880

The :class:`.QueuePool` has been enhanced to not block new connection
attempts when an existing connection attempt is blocking. Previously,
the production of new connections was serialized within the block
that monitored overflow; the overflow counter is now altered within
its own critical section outside of the connection process itself.

.. change::
:tags: bug, engine, pool
:versions: 0.9.0
:tickets: 2522

Made a slight adjustment to the logic which waits for a pooled
connection to be available, such that for a connection pool
with no timeout specified, it will every half a second break out of
the wait to check for the so-called "abort" flag, which allows the
waiter to break out in case the whole connection pool was dumped;
normally the waiter should break out due to a notify_all() but it's
possible this notify_all() is missed in very slim cases.
This is an extension of logic first introduced in 0.8.0, and the
issue has only been observed occasionally in stress tests.

.. change::
:tags: bug, mssql
:versions: 0.9.0

Fixed bug introduced in 0.8.0 where the ``DROP INDEX``
statement for an index in MSSQL would render incorrectly if the
index were in an alternate schema; the schemaname/tablename
would be reversed. The format has been also been revised to
match current MSSQL documentation. Courtesy Derek Harland.

.. change::
:tags: feature, sql
:tickets: 1443
:versions: 0.9.0b1

Added support for "unique constraint" reflection, via the
:meth:`_reflection.Inspector.get_unique_constraints` method.
Thanks for Roman Podolyaka for the patch.

.. change::
:tags: bug, oracle
:tickets: 2864
:versions: 0.9.0

Added ORA-02396 "maximum idle time" error code to list of
"is disconnect" codes with cx_oracle.

.. change::
:tags: bug, engine
:tickets: 2871
:versions: 0.9.0

Fixed bug where SQL statement would be improperly ASCII-encoded
when a pre-DBAPI :class:`.StatementError` were raised within
:meth:`_engine.Connection.execute`, causing encoding errors for
non-ASCII statements. The stringification now remains within
Python unicode thus avoiding encoding errors.

.. change::
:tags: bug, oracle
:tickets: 2870
:versions: 0.9.0

Fixed bug where Oracle ``VARCHAR`` types given with no length
(e.g. for a ``CAST`` or similar) would incorrectly render ``None CHAR``
or similar.

.. change::
:tags: bug, ext
:tickets: 2869
:versions: 0.9.0

Fixed bug which prevented the ``serializer`` extension from working
correctly with table or column names that contain non-ASCII
characters.

.. change::
:tags: bug, orm
:tickets: 2818
:versions: 0.9.0

Fixed a regression introduced by :ticket:`2818` where the EXISTS
query being generated would produce a "columns being replaced"
warning for a statement with two same-named columns,
as the internal SELECT wouldn't have use_labels set.

.. change::
:tags: bug, postgresql
:tickets: 2855
:versions: 0.9.0

Fixed bug where index reflection would mis-interpret indkey values
when using the pypostgresql adapter, which returns these values
as lists vs. psycopg2's return type of string.

.. changelog::

0.8.3

Not secure
:released: October 26, 2013

.. change::
:tags: bug, oracle
:tickets: 2853
:versions: 0.9.0b1

Fixed bug where Oracle table reflection using synonyms would fail
if the synonym and the table were in different remote schemas.
Patch to fix courtesy Kyle Derr.

.. change::
:tags: bug, sql
:tickets: 2849
:versions: 0.9.0b1

Fixed bug where :func:`.type_coerce` would not interpret ORM
elements with a ``__clause_element__()`` method properly.

.. change::
:tags: bug, sql
:tickets: 2842
:versions: 0.9.0b1

The :class:`.Enum` and :class:`.Boolean` types now bypass
any custom (e.g. TypeDecorator) type in use when producing the
CHECK constraint for the "non native" type. This so that the custom type
isn't involved in the expression within the CHECK, since this
expression is against the "impl" value and not the "decorated" value.

.. change::
:tags: bug, postgresql
:tickets: 2844
:versions: 0.9.0b1

Removed a 128-character truncation from the reflection of the
server default for a column; this code was original from
PG system views which truncated the string for readability.

.. change::
:tags: bug, mysql
:tickets: 2721, 2839
:versions: 0.9.0b1

The change in :ticket:`2721`, which is that the ``deferrable`` keyword
of :class:`_schema.ForeignKeyConstraint` is silently ignored on the MySQL
backend, will be reverted as of 0.9; this keyword will now render again, raising
errors on MySQL as it is not understood - the same behavior will also
apply to the ``initially`` keyword. In 0.8, the keywords will remain
ignored but a warning is emitted. Additionally, the ``match`` keyword
now raises a :exc:`.CompileError` on 0.9 and emits a warning on 0.8;
this keyword is not only silently ignored by MySQL but also breaks
the ON UPDATE/ON DELETE options.

To use a :class:`_schema.ForeignKeyConstraint`
that does not render or renders differently on MySQL, use a custom
compilation option. An example of this usage has been added to the
documentation, see :ref:`mysql_foreign_keys`.

.. change::
:tags: bug, sql
:tickets: 2825
:versions: 0.9.0b1

The ``.unique`` flag on :class:`.Index` could be produced as ``None``
if it was generated from a :class:`_schema.Column` that didn't specify ``unique``
(where it defaults to ``None``). The flag will now always be ``True`` or
``False``.

.. change::
:tags: feature, orm
:tickets: 2836
:versions: 0.9.0b1

Added new option to :func:`_orm.relationship` ``distinct_target_key``.
This enables the subquery eager loader strategy to apply a DISTINCT
to the innermost SELECT subquery, to assist in the case where
duplicate rows are generated by the innermost query which corresponds
to this relationship (there's not yet a general solution to the issue
of dupe rows within subquery eager loading, however, when joins outside
of the innermost subquery produce dupes). When the flag
is set to ``True``, the DISTINCT is rendered unconditionally, and when
it is set to ``None``, DISTINCT is rendered if the innermost relationship
targets columns that do not comprise a full primary key.
The option defaults to False in 0.8 (e.g. off by default in all cases),
None in 0.9 (e.g. automatic by default). Thanks to Alexander Koval
for help with this.

.. seealso::

:ref:`change_2836`

.. change::
:tags: bug, mysql
:tickets: 2515
:versions: 0.9.0b1

MySQL-connector dialect now allows options in the create_engine
query string to override those defaults set up in the connect,
including "buffered" and "raise_on_warnings".

.. change::
:tags: bug, postgresql
:tickets: 2742
:versions: 0.9.0b1

Parenthesis will be applied to a compound SQL expression as
rendered in the column list of a CREATE INDEX statement.

.. change::
:tags: bug, sql
:tickets: 2742
:versions: 0.9.0b1

Fixed bug in default compiler plus those of postgresql, mysql, and
mssql to ensure that any literal SQL expression values are
rendered directly as literals, instead of as bound parameters,
within a CREATE INDEX statement. This also changes the rendering
scheme for other DDL such as constraints.

.. change::
:tags: bug, sql
:tickets: 2815
:versions: 0.9.0b1

A :func:`_expression.select` that is made to refer to itself in its FROM clause,
typically via in-place mutation, will raise an informative error
message rather than causing a recursion overflow.

.. change::
:tags: bug, orm
:tickets: 2813
:versions: 0.9.0b1

Fixed bug where using an annotation such as :func:`.remote` or
:func:`.foreign` on a :class:`_schema.Column` before association with a parent
:class:`_schema.Table` could produce issues related to the parent table not
rendering within joins, due to the inherent copy operation performed
by an annotation.

.. change::
:tags: bug, sql
:tickets: 2831

Non-working "schema" argument on :class:`_schema.ForeignKey` is deprecated;
raises a warning. Removed in 0.9.

.. change::
:tags: bug, postgresql
:tickets: 2819
:versions: 0.9.0b1

Fixed bug where PostgreSQL version strings that had a prefix preceding
the words "PostgreSQL" or "EnterpriseDB" would not parse.
Courtesy Scott Schaefer.

.. change::
:tags: feature, engine
:tickets: 2821
:versions: 0.9.0b1

``repr()`` for the :class:`.URL` of an :class:`_engine.Engine`
will now conceal the password using asterisks.
Courtesy Gunnlaugur Þór Briem.

.. change::
:tags: bug, orm
:tickets: 2818
:versions: 0.9.0b1

Fixed bug where :meth:`_query.Query.exists` failed to work correctly
without any WHERE criterion. Courtesy Vladimir Magamedov.

.. change::
:tags: bug, sql
:tickets: 2811
:versions: 0.9.0b1

Fixed bug where using the ``column_reflect`` event to change the ``.key``
of the incoming :class:`_schema.Column` would prevent primary key constraints,
indexes, and foreign key constraints from being correctly reflected.

.. change::
:tags: feature
:versions: 0.9.0b1

Added a new flag ``system=True`` to :class:`_schema.Column`, which marks
the column as a "system" column which is automatically made present
by the database (such as PostgreSQL ``oid`` or ``xmin``). The
column will be omitted from the ``CREATE TABLE`` statement but will
otherwise be available for querying. In addition, the
:class:`.CreateColumn` construct can be applied to a custom
compilation rule which allows skipping of columns, by producing
a rule that returns ``None``.

.. change::
:tags: bug, orm
:tickets: 2779

Backported a change from 0.9 whereby the iteration of a hierarchy
of mappers used in polymorphic inheritance loads is sorted,
which allows the SELECT statements generated for polymorphic queries
to have deterministic rendering, which in turn helps with caching
schemes that cache on the SQL string itself.

.. change::
:tags: bug, orm
:tickets: 2794
:versions: 0.9.0b1

Fixed a potential issue in an ordered sequence implementation used
by the ORM to iterate mapper hierarchies; under the Jython interpreter
this implementation wasn't ordered, even though cPython and PyPy
maintained ordering.

.. change::
:tags: bug, examples
:versions: 0.9.0b1

Added "autoincrement=False" to the history table created in the
versioning example, as this table shouldn't have autoinc on it
in any case, courtesy Patrick Schmid.

.. change::
:tags: bug, sql
:versions: 0.9.0b1

The :meth:`.ColumnOperators.notin_` operator added in 0.8 now properly
produces the negation of the expression "IN" returns
when used against an empty collection.

.. change::
:tags: feature, examples
:versions: 0.9.0b1

Improved the examples in ``examples/generic_associations``, including
that ``discriminator_on_association.py`` makes use of single table
inheritance do the work with the "discriminator". Also
added a true "generic foreign key" example, which works similarly
to other popular frameworks in that it uses an open-ended integer
to point to any other table, foregoing traditional referential
integrity. While we don't recommend this pattern, information wants
to be free.

.. change::
:tags: feature, orm, declarative
:versions: 0.9.0b1

Added a convenience class decorator :func:`.as_declarative`, is
a wrapper for :func:`.declarative_base` which allows an existing base
class to be applied using a nifty class-decorated approach.

.. change::
:tags: bug, orm
:tickets: 2786
:versions: 0.9.0b1

Fixed bug in ORM-level event registration where the "raw" or
"propagate" flags could potentially be mis-configured in some
"unmapped base class" configurations.

.. change::
:tags: bug, orm
:tickets: 2778
:versions: 0.9.0b1

A performance fix related to the usage of the :func:`.defer` option
when loading mapped entities. The function overhead of applying
a per-object deferred callable to an instance at load time was
significantly higher than that of just loading the data from the row
(note that ``defer()`` is meant to reduce DB/network overhead, not
necessarily function call count); the function call overhead is now
less than that of loading data from the column in all cases. There
is also a reduction in the number of "lazy callable" objects created
per load from N (total deferred values in the result) to 1 (total
number of deferred cols).

.. change::
:tags: bug, sqlite
:tickets: 2781
:versions: 0.9.0b1

The newly added SQLite DATETIME arguments storage_format and
regexp apparently were not fully implemented correctly; while the
arguments were accepted, in practice they would have no effect;
this has been fixed.

.. change::
:tags: bug, sql, postgresql
:tickets: 2780
:versions: 0.9.0b1

Fixed bug where the expression system relied upon the ``str()``
form of a some expressions when referring to the ``.c`` collection
on a ``select()`` construct, but the ``str()`` form isn't available
since the element relies on dialect-specific compilation constructs,
notably the ``__getitem__()`` operator as used with a PostgreSQL
``ARRAY`` element. The fix also adds a new exception class
:exc:`.UnsupportedCompilationError` which is raised in those cases
where a compiler is asked to compile something it doesn't know
how to.

.. change::
:tags: bug, engine, oracle
:tickets: 2776
:versions: 0.9.0b1

Dialect.initialize() is not called a second time if an :class:`_engine.Engine`
is recreated, due to a disconnect error. This fixes a particular
issue in the Oracle 8 dialect, but in general the dialect.initialize()
phase should only be once per dialect.

.. change::
:tags: feature, sql
:tickets: 722

Added new method to the :func:`_expression.insert` construct
:meth:`_expression.Insert.from_select`. Given a list of columns and
a selectable, renders ``INSERT INTO (table) (columns) SELECT ..``.

.. change::
:tags: feature, sql
:versions: 0.9.0b1

The :func:`_expression.update`, :func:`_expression.insert`, and :func:`_expression.delete` constructs
will now interpret ORM entities as target tables to be operated upon,
e.g.::

from sqlalchemy import insert, update, delete

ins = insert(SomeMappedClass).values(x=5)

del_ = delete(SomeMappedClass).where(SomeMappedClass.id == 5)

upd = update(SomeMappedClass).where(SomeMappedClass.id == 5).values(name="ed")

.. change::
:tags: bug, orm
:tickets: 2773
:versions: 0.9.0b1

Fixed bug whereby attribute history functions would fail
when an object we moved from "persistent" to "pending"
using the :func:`.make_transient` function, for operations
involving collection-based backrefs.

.. change::
:tags: bug, engine, pool
:tickets: 2772
:versions: 0.9.0b1

Fixed bug where :class:`.QueuePool` would lose the correct
checked out count if an existing pooled connection failed to reconnect
after an invalidate or recycle event.

.. changelog::

Page 36 of 51

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.