Changelog
### 2.0.0
```
Features
- Port redis-py's client implementation to aioredis.
(see 891)
- Make hiredis an optional dependency.
(see 917)
```
Links
- PyPI: https://pypi.org/project/aioredis
- Changelog: https://pyup.io/changelogs/aioredis/
- Repo: https://github.com/aio-libs/aioredis
Changelog
### 1.7.1
```
:released: August 30, 2021
.. change::
:tags: bug, installation
:tickets: 893
Corrected "universal wheel" directive in setup.cfg so that building a wheel
does not target Python 2. The PyPi files index for 1.7.0 was corrected
manually. Pull request courtesy layday.
.. change::
:tags: bug, pep484
:tickets: 895
Fixed issue in generated .pyi files where default values for ``Optional``
arguments were missing, thereby causing mypy to consider them as required.
.. change::
:tags: bug, regression, batch
:tickets: 896
Fixed regression in batch mode due to :ticket:`883` where the "auto" mode
of batch would fail to accommodate any additional migration directives
beyond encountering an ``add_column()`` directive, due to a mis-application
of the conditional logic that was added as part of this change, leading to
"recreate" mode not being used in cases where it is required for SQLite
such as for unique constraints.
.. changelog::
```
### 1.7.0
```
:released: August 30, 2021
.. change::
:tags: bug, operations
:tickets: 879
Fixed regression due to :ticket:`803` where the ``.info`` and ``.comment``
attributes of ``Table`` would be lost inside of the :class:`.DropTableOp`
class, which when "reversed" into a :class:`.CreateTableOp` would then have
lost these elements. Pull request courtesy Nicolas CANIART.
.. change::
:tags: feature, environment
:tickets: 842
Enhance ``version_locations`` parsing to handle paths containing spaces.
The new configuration option ``version_path_separator`` specifies the
character to use when splitting the ``version_locations`` string. The
default for new configurations is ``version_path_separator = os``,
which will use ``os.pathsep`` (e.g., ``;`` on Windows).
.. change::
:tags: installation, changed
Alembic 1.7 now supports Python 3.6 and above; support for prior versions
including Python 2.7 has been dropped.
.. change::
:tags: bug, sqlite, batch
:tickets: 883
Batch "auto" mode will now select for "recreate" if the ``add_column()``
operation is used on SQLite, and the column itself meets the criteria for
SQLite where ADD COLUMN is not allowed, in this case a functional or
parenthesized SQL expression or a ``Computed`` (i.e. generated) column.
.. change::
:tags: changed, installation
:tickets: 674
Make the ``python-dateutil`` library an optional dependency.
This library is only required if the ``timezone`` option
is used in the Alembic configuration.
An extra require named ``tz`` is available with
``pip install alembic[tz]`` to install it.
.. change::
:tags: bug, commands
:tickets: 856
Re-implemented the ``python-editor`` dependency as a small internal
function to avoid the need for external dependencies.
.. change::
:tags: usecase, batch
:tickets: 884
Named CHECK constraints are now supported by batch mode, and will
automatically be part of the recreated table assuming they are named. They
also can be explicitly dropped using ``op.drop_constraint()``. For
"unnamed" CHECK constraints, these are still skipped as they cannot be
distinguished from the CHECK constraints that are generated by the
``Boolean`` and ``Enum`` datatypes.
Note that this change may require adjustments to migrations that drop or
rename columns which feature an associated named check constraint, such
that an additional ``op.drop_constraint()`` directive should be added for
that named constraint as there will no longer be an associated column
for it; for the ``Boolean`` and ``Enum`` datatypes, an ``existing_type``
keyword may be passed to ``BatchOperations.drop_constraint`` as well.
.. seealso::
:ref:`batch_schematype_constraints`
:ref:`batch_check_constraints`
.. change::
:tags: changed, installation
:tickets: 885
The dependency on ``pkg_resources`` which is part of ``setuptools`` has
been removed, so there is no longer any runtime dependency on
``setuptools``. The functionality has been replaced with
``importlib.metadata`` and ``importlib.resources`` which are both part of
Python std.lib, or via pypy dependency ``importlib-metadata`` for Python
version < 3.8 and ``importlib-resources`` for Python version < 3.9
(while importlib.resources was added to Python in 3.7, it did not include
the "files" API until 3.9).
.. change::
:tags: feature, tests
:tickets: 855
Created a "test suite" similar to the one for SQLAlchemy, allowing
developers of third-party dialects to test their code against a set of
Alembic tests that have been specially selected to exercise
back-end database operations. At the time of release,
third-party dialects that have adopted the Alembic test suite to verify
compatibility include
`CockroachDB <https://pypi.org/project/sqlalchemy-cockroachdb/>`_ and
`SAP ASE (Sybase) <https://pypi.org/project/sqlalchemy-sybase/>`_.
.. change::
:tags: bug, postgresql
:tickets: 874
Fixed issue where usage of the PostgreSQL ``postgresql_include`` option
within a :meth:`.Operations.create_index` would raise a KeyError, as the
additional column(s) need to be added to the table object used by the
construct internally. The issue is equivalent to the SQL Server issue fixed
in :ticket:`513`. Pull request courtesy Steven Bronson.
.. change::
:tags: feature, general
pep-484 type annotations have been added throughout the library.
Additionally, stub .pyi files have been added for the "dynamically"
generated Alembic modules ``alembic.op`` and ``alembic.config``, which
include complete function signatures and docstrings, so that the functions
in these namespaces will have both IDE support (vscode, pycharm, etc) as
well as support for typing tools like Mypy. The files themselves are
statically generated from their source functions within the source tree.
.. changelog::
```
### 1.6.5
```
:released: May 27, 2021
.. change::
:tags: bug, autogenerate
:tickets: 849
Fixed issue where dialect-specific keyword arguments within the
:class:`.DropIndex` operation directive would not render in the
autogenerated Python code. As support was improved for adding dialect
specific arguments to directives as part of :ticket:`803`, in particular
arguments such as "postgresql_concurrently" which apply to the actual
create/drop of the index, support was needed for these to render even in a
drop index operation. Pull request courtesy Jet Zhou.
.. changelog::
```
### 1.6.4
```
:released: May 24, 2021
.. change::
:tags: bug, regression, op directives
:tickets: 848
Fixed regression caused by just fixed :ticket:`844` that scaled back the
filter for ``unique=True/index=True`` too far such that these directives no
longer worked for the ``op.create_table()`` op, this has been fixed.
.. changelog::
```
### 1.6.3
```
:released: May 21, 2021
.. change::
:tags: bug, regression, autogenerate
:tickets: 844
Fixed 1.6-series regression where ``UniqueConstraint`` and to a lesser
extent ``Index`` objects would be doubled up in the generated model when
the ``unique=True`` / ``index=True`` flags were used.
.. change::
:tags: bug, autogenerate
:tickets: 839
Fixed a bug where paths defined in post-write hook options
would be wrongly escaped in non posix environment (Windows).
.. change::
:tags: bug, regression, versioning
:tickets: 843
Fixed regression where a revision file that contained its own down revision
as a dependency would cause an endless loop in the traversal logic.
.. changelog::
```
### 1.6.2
```
:released: May 6, 2021
.. change::
:tags: bug, versioning, regression
:tickets: 839
Fixed additional regression nearly the same as that of :ticket:`838` just
released in 1.6.1 but within a slightly different codepath, where "alembic
downgrade head" (or equivalent) would fail instead of iterating no
revisions.
.. changelog::
```
### 1.6.1
```
:released: May 6, 2021
.. change::
:tags: bug, versioning, regression
:tickets: 838
Fixed regression in new revisioning traversal where "alembic downgrade
base" would fail if the database itself were clean and unversioned;
additionally repairs the case where downgrade would fail if attempting
to downgrade to the current head that is already present.
.. changelog::
```
### 1.6.0
```
:released: May 3, 2021
.. change::
:tags: bug, autogenerate
:tickets: 803
Refactored the implementation of :class:`.MigrateOperation` constructs such
as :class:`.CreateIndexOp`, :class:`.CreateTableOp`, etc. so that they no
longer rely upon maintaining a persistent version of each schema object
internally; instead, the state variables of each operation object will be
used to produce the corresponding construct when the operation is invoked.
The rationale is so that environments which make use of
operation-manipulation schemes such as those those discussed in
:ref:`autogen_rewriter` are better supported, allowing end-user code to
manipulate the public attributes of these objects which will then be
expressed in the final output, an example is
``some_create_index_op.kw["postgresql_concurrently"] = True``.
Previously, these objects when generated from autogenerate would typically
hold onto the original, reflected element internally without honoring the
other state variables of each construct, preventing the public API from
working.
.. change::
:tags: bug, environment
:tickets: 829
Fixed regression caused by the SQLAlchemy 1.4/2.0 compatibility switch
where calling ``.rollback()`` or ``.commit()`` explicitly within the
``context.begin_transaction()`` context manager would cause it to fail when
the block ended, as it did not expect that the transaction was manually
closed.
.. change::
:tags: bug, autogenerate
:tickets: 827
Improved the rendering of ``op.add_column()`` operations when adding
multiple columns to an existing table, so that the order of these
statements matches the order in which the columns were declared in the
application's table metadata. Previously the added columns were being
sorted alphabetically.
.. change::
:tags: feature, autogenerate
:tickets: 819
Fix the documentation regarding the default command-line argument position of
the revision script filename within the post-write hook arguments. Implement a
``REVISION_SCRIPT_FILENAME`` token, enabling the position to be changed. Switch
from ``str.split()`` to ``shlex.split()`` for more robust command-line argument
parsing.
.. change::
:tags: feature
:tickets: 822
Implement a ``.cwd`` (current working directory) suboption for post-write hooks
(of type ``console_scripts``). This is useful for tools like pre-commit, which
rely on the working directory to locate the necessary config files. Add
pre-commit as an example to the documentation. Minor change: rename some variables
from ticket 819 to improve readability.
.. change::
:tags: bug, versioning
:tickets: 765, 464
The algorithm used for calculating downgrades/upgrades/iterating
revisions has been rewritten, to resolve ongoing issues of branches
not being handled consistently particularly within downgrade operations,
as well as for overall clarity and maintainability. This change includes
that a deprecation warning is emitted if an ambiguous command such
as "downgrade -1" when multiple heads are present is given.
In particular, the change implements a long-requested use case of allowing
downgrades of a single branch to a branchpoint.
Huge thanks to Simon Bowly for their impressive efforts in successfully
tackling this very difficult problem.
.. change::
:tags: bug, batch
:tickets: 799
Added missing ``batch_op.create_table_comment()``,
``batch_op.drop_table_comment()`` directives to batch ops.
.. changelog::
```
Links
- PyPI: https://pypi.org/project/alembic
- Changelog: https://pyup.io/changelogs/alembic/
- Homepage: https://alembic.sqlalchemy.org
- Docs: https://pythonhosted.org/alembic/
Changelog
### 3.13.0
```
*******************
Features:
- Replace ``missing``/``default`` field parameters with
``load_default``/``dump_default`` (:pr:`1742`).
Thanks :user:`sirosen` for the PR.
Deprecations:
- The use of ``missing``/``default`` field parameters is deprecated and will be
removed in marshmallow 4. ``load_default``/``dump_default`` should be used
instead.
```
### 3.12.2
```
*******************
Bug fixes:
- Don't expose ``Field``\s as ``Schema`` attributes. This reverts a change
introduced in 3.12.0 that causes issues when field names conflict with
``Schema`` attributes or methods. ``Fields``\s are still accessible on a
``Schema`` instance throught the ``fields`` attribute. (:pr:`1843`)
```
### 3.12.1
```
*******************
Bug fixes:
- Fix bug that raised an ``AttributeError`` when instantiating a
``Schema`` with a field named ``parent`` (:issue:`1808`).
Thanks :user:`flying-sheep` for reporting and helping with the fix.
```
### 3.12.0
```
*******************
Features:
- Add ``validate.And`` (:issue:`1768`).
Thanks :user:`rugleb` for the suggestion.
- Add type annotations to ``marshmallow.decorators`` (:issue:`1788`, :pr:`1789`).
Thanks :user:`michaeldimchuk` for the PR.
- Let ``Field``\s be accessed by name as ``Schema`` attributes (:pr:`1631`).
Other changes:
- Improve types in ``marshmallow.validate`` (:pr:`1786`).
- Make ``marshmallow.validate.Validator`` an abstract base class (:pr:`1786`).
- Remove unnecessary list cast (:pr:`1785`).
```
Links
- PyPI: https://pypi.org/project/marshmallow
- Changelog: https://pyup.io/changelogs/marshmallow/
- Repo: https://github.com/marshmallow-code/marshmallow
Changelog
### 0.16.0
```
This release adds Python 3.10 support, updates bundled libuv to 1.42.0
and fixes a handful of issues.
Changes
=======
* Python 3.10 support (432)
(by elprans in 2519e2df for 432)
* Bump vendored libuv to 1.42.0 (433)
(by elprans in a62f7818 for 433)
* Use cibuildwheel to build wheels (435)
(by elprans in 20febe0b for 435)
* Add support for `<timer handle>.when()`
(by Jens Jorgensen in 62b2af9c)
Fixes
=====
* Fix ref issue when protocol is in Cython
(by fantix in 70cafc82 for 2222)
* Set `python_requires` in setup.py
(by graingert in c808a663)
* SSL: schedule first data after waiter wakeup
(by fantix in 2081db89)
* Fix a possible race condition in sslproto test
(by fantix in b0526cd5 for 412)
* Fix `call_soon_threadsafe` thread safety
(by fantix in 4b803b15)
```
### 0.15.3
```
Bug Fixes
* SSL: schedule first data after waiter wakeup
(by fantix in 0df12282)
* Fix a possible race condition in sslproto test
(by fantix in 2e71c4c2 for 412)
* Fix `call_soon_threadsafe` thread safety
(by fantix and hehaha in 6387a4e4 for 408)
```
Links
- PyPI: https://pypi.org/project/uvloop
- Changelog: https://pyup.io/changelogs/uvloop/
- Repo: http://github.com/MagicStack/uvloop
Changelog
### 1.4.23
```
:released: August 18, 2021
.. change::
:tags: bug, sql
:tickets: 6752
Fix issue in :class:`_sql.CTE` where new :meth:`_sql.HasCTE.add_cte` method
added in version 1.4.21 / :ticket:`6752` failed to function correctly for
"compound select" structures such as :func:`_sql.union`,
:func:`_sql.union_all`, :func:`_sql.except`, etc. Pull request courtesy
Eric Masseran.
.. change::
:tags: orm, usecase
:tickets: 6808
Added new attribute :attr:`_sql.Select.columns_clause_froms` that will
retrieve the FROM list implied by the columns clause of the
:class:`_sql.Select` statement. This differs from the old
:attr:`_sql.Select.froms` collection in that it does not perform any ORM
compilation steps, which necessarily deannotate the FROM elements and do
things like compute joinedloads etc., which makes it not an appropriate
candidate for the :meth:`_sql.Select.select_from` method. Additionally adds
a new parameter
:paramref:`_sql.Select.with_only_columns.maintain_column_froms` that
transfers this collection to :meth:`_sql.Select.select_from` before
replacing the columns collection.
In addition, the :attr:`_sql.Select.froms` is renamed to
:meth:`_sql.Select.get_final_froms`, to stress that this collection is not
a simple accessor and is instead calculated given the full state of the
object, which can be an expensive call when used in an ORM context.
Additionally fixes a regression involving the
:func:`_orm.with_only_columns` function to support applying criteria to
column elements that were replaced with either
:meth:`_sql.Select.with_only_columns` or :meth:`_orm.Query.with_entities` ,
which had broken as part of :ticket:`6503` released in 1.4.19.
.. change::
:tags: bug, orm, sql
:tickets: 6824
Fixed issue where a bound parameter object that was "cloned" would cause a
name conflict in the compiler, if more than one clone of this parameter
were used at the same time in a single statement. This could occur in
particular with things like ORM single table inheritance queries that
indicated the same "discriminator" value multiple times in one query.
.. change::
:tags: bug, mssql, sql
:tickets: 6863
Fixed issue where the ``literal_binds`` compiler flag, as used externally
to render bound parameters inline, would fail to work when used with a
certain class of parameters known as "literal_execute", which covers things
like LIMIT and OFFSET values for dialects where the drivers don't allow a
bound parameter, such as SQL Server's "TOP" clause. The issue locally
seemed to affect only the MSSQL dialect.
.. change::
:tags: bug, orm
:tickets: 6869
Fixed issue in loader strategies where the use of the
:meth:`_orm.Load.options` method, particularly when nesting multiple calls,
would generate an overly long and more importantly non-deterministic cache
key, leading to very large cache keys which were also not allowing
efficient cache usage, both in terms of total memory used as well as number
of entries used in the cache itself.
.. change::
:tags: bug, sql
:tickets: 6858
Fixed an issue in the ``CacheKey.to_offline_string()`` method used by the
dogpile.caching example where attempting to create a proper cache key from
the special "lambda" query generated by the lazy loader would fail to
include the parameter values, leading to an incorrect cache key.
.. change::
:tags: bug, orm
:tickets: 6887
Revised the means by which the
:attr:`_orm.ORMExecuteState.user_defined_options` accessor receives
:class:`_orm.UserDefinedOption` and related option objects from the
context, with particular emphasis on the "selectinload" on the loader
strategy where this previously was not working; other strategies did not
have this problem. The objects that are associated with the current query
being executed, and not that of a query being cached, are now propagated
unconditionally. This essentially separates them out from the "loader
strategy" options which are explicitly associated with the compiled state
of a query and need to be used in relation to the cached query.
The effect of this fix is that a user-defined option, such as those used
by the dogpile.caching example as well as for other recipes such as
defining a "shard id" for the horizontal sharing extension, will be
correctly propagated to eager and lazy loaders regardless of whether
a cached query was ultimately invoked.
.. change::
:tags: bug, sql
:tickets: 6886
Adjusted the "from linter" warning feature to accommodate for a chain of
joins more than one level deep where the ON clauses don't explicitly match
up the targets, such as an expression such as "ON TRUE". This mode of use
is intended to cancel the cartesian product warning simply by the fact that
there's a JOIN from "a to b", which was not working for the case where the
chain of joins had more than one element.
.. change::
:tags: bug, postgresql
:tickets: 6886
Added the "is_comparison" flag to the PostgreSQL "overlaps",
"contained_by", "contains" operators, so that they work in relevant ORM
contexts as well as in conjunction with the "from linter" feature.
.. change::
:tags: bug, orm
:tickets: 6812
Fixed issue where the unit of work would internally use a 2.0-deprecated
SQL expression form, emitting a deprecation warning when SQLALCHEMY_WARN_20
were enabled.
.. change::
:tags: bug, orm
:tickets: 6881
Fixed issue in :func:`_orm.selectinload` where use of the new
:meth:`_orm.PropComparator.and_` feature within options that were nested
more than one level deep would fail to update bound parameter values that
were in the nested criteria, as a side effect of SQL statement caching.
.. change::
:tags: bug, general
:tickets: 6136
The setup requirements have been modified such ``greenlet`` is a default
requirement only for those platforms that are well known for ``greenlet``
to be installable and for which there is already a pre-built binary on
pypi; the current list is ``x86_64 aarch64 ppc64le amd64 win32``. For other
platforms, greenlet will not install by default, which should enable
installation and test suite running of SQLAlchemy 1.4 on platforms that
don't support ``greenlet``, excluding any asyncio features. In order to
install with the ``greenlet`` dependency included on a machine architecture
outside of the above list, the ``[asyncio]`` extra may be included by
running ``pip install sqlalchemy[asyncio]`` which will then attempt to
install ``greenlet``.
Additionally, the test suite has been repaired so that tests can complete
fully when greenlet is not installed, with appropriate skips for
asyncio-related tests.
.. change::
:tags: enum, schema
:tickets: 6146
Unify behaviour :class:`_schema.Enum` in native and non-native
implementations regarding the accepted values for an enum with
aliased elements.
When :paramref:`_schema.Enum.omit_aliases` is ``False`` all values,
alias included, are accepted as valid values.
When :paramref:`_schema.Enum.omit_aliases` is ``True`` only non aliased values
are accepted as valid values.
.. change::
:tags: bug, ext
:tickets: 6816
Fixed issue where the horizontal sharding extension would not correctly
accommodate for a plain textual SQL statement passed to
:meth:`_orm.Session.execute`.
.. change::
:tags: bug, orm
:tickets: 6889, 6079
Adjusted ORM loader internals to no longer use the "lambda caching" system
that was added in 1.4, as well as repaired one location that was still
using the previous "baked query" system for a query. The lambda caching
system remains an effective way to reduce the overhead of building up
queries that have relatively fixed usage patterns. In the case of loader
strategies, the queries used are responsible for moving through lots of
arbitrary options and criteria, which is both generated and sometimes
consumed by end-user code, that make the lambda cache concept not any more
efficient than not using it, at the cost of more complexity. In particular
the problems noted by :ticket:`6881` and :ticket:`6887` are made are made
considerably less complicated by removing this feature internally.
.. change::
:tags: bug, orm
:tickets: 6889
Fixed an issue where the :class:`_orm.Bundle` construct would not create
proper cache keys, leading to inefficient use of the query cache. This
had some impact on the "selectinload" strategy and was identified as
part of :ticket:`6889`.
.. change::
:tags: usecase, mypy
:tickets: 6804, 6759
Added support for SQLAlchemy classes to be defined in user code using
"generic class" syntax as defined by ``sqlalchemy2-stubs``, e.g.
``Column[String]``, without the need for qualifying these constructs within
a ``TYPE_CHECKING`` block by implementing the Python special method
``__class_getitem__()``, which allows this syntax to pass without error at
runtime.
.. change::
:tags: bug, sql
Fixed issue in lambda caching system where an element of a query that
produces no cache key, like a custom option or clause element, would still
populate the expression in the "lambda cache" inappropriately.
.. changelog::
```
### 1.4.22
```
:released: July 21, 2021
.. change::
:tags: bug, sql
:tickets: 6786
Fixed issue where use of the :paramref:`_sql.case.whens` parameter passing
a dictionary positionally and not as a keyword argument would emit a 2.0
deprecation warning, referring to the deprecation of passing a list
positionally. The dictionary format of "whens", passed positionally, is
still supported and was accidentally marked as deprecated.
.. change::
:tags: bug, orm
:tickets: 6775
Fixed issue in new :meth:`_schema.Table.table_valued` method where the
resulting :class:`_sql.TableValuedColumn` construct would not respond
correctly to alias adaptation as is used throughout the ORM, such as for
eager loading, polymorphic loading, etc.
.. change::
:tags: bug, orm
:tickets: 6769
Fixed issue where usage of the :meth:`_result.Result.unique` method with an
ORM result that included column expressions with unhashable types, such as
``JSON`` or ``ARRAY`` using non-tuples would silently fall back to using
the ``id()`` function, rather than raising an error. This now raises an
error when the :meth:`_result.Result.unique` method is used in a 2.0 style
ORM query. Additionally, hashability is assumed to be True for result
values of unknown type, such as often happens when using SQL functions of
unknown return type; if values are truly not hashable then the ``hash()``
itself will raise.
For legacy ORM queries, since the legacy :class:`_orm.Query` object
uniquifies in all cases, the old rules remain in place, which is to use
``id()`` for result values of unknown type as this legacy uniquing is
mostly for the purpose of uniquing ORM entities and not column values.
.. change::
:tags: orm, bug
:tickets: 6771
Fixed an issue where clearing of mappers during things like test suite
teardowns could cause a "dictionary changed size" warning during garbage
collection, due to iteration of a weak-referencing dictionary. A ``list()``
has been applied to prevent concurrent GC from affecting this operation.
.. change::
:tags: bug, sql
:tickets: 6770
Fixed issue where type-specific bound parameter handlers would not be
called upon in the case of using the :meth:`_sql.Insert.values` method with
the Python ``None`` value; in particular, this would be noticed when using
the :class:`_types.JSON` datatype as well as related PostgreSQL specific
types such as :class:`_postgresql.JSONB` which would fail to encode the
Python ``None`` value into JSON null, however the issue was generalized to
any bound parameter handler in conjunction with this specific method of
:class:`_sql.Insert`.
.. change::
:tags: bug, engine
:tickets: 6740
Added some guards against ``KeyError`` in the event system to accommodate
the case that the interpreter is shutting down at the same time
:meth:`_engine.Engine.dispose` is being called, which would cause stack
trace warnings.
.. change::
:tags: bug, orm, regression
:tickets: 6793
Fixed critical caching issue where the ORM's persistence feature using
INSERT..RETURNING would cache an incorrect query when mixing the "bulk
save" and standard "flush" forms of INSERT.
.. changelog::
```
### 1.4.21
```
:released: July 14, 2021
.. change::
:tags: usecase, orm
:tickets: 6708
Modified the approach used for history tracking of scalar object
relationships that are not many-to-one, i.e. one-to-one relationships that
would otherwise be one-to-many. When replacing a one-to-one value, the
"old" value that would be replaced is no longer loaded immediately, and is
instead handled during the flush process. This eliminates an historically
troublesome lazy load that otherwise often occurs when assigning to a
one-to-one attribute, and is particularly troublesome when using
"lazy='raise'" as well as asyncio use cases.
This change does cause a behavioral change within the
:meth:`_orm.AttributeEvents.set` event, which is nonetheless currently
documented, which is that the event applied to such a one-to-one attribute
will no longer receive the "old" parameter if it is unloaded and the
:paramref:`_orm.relationship.active_history` flag is not set. As is
documented in :meth:`_orm.AttributeEvents.set`, if the event handler needs
to receive the "old" value when the event fires off, the active_history
flag must be established either with the event listener or with the
relationship. This is already the behavior with other kinds of attributes
such as many-to-one and column value references.
The change additionally will defer updating a backref on the "old" value
in the less common case that the "old" value is locally present in the
session, but isn't loaded on the relationship in question, until the
next flush occurs. If this causes an issue, again the normal
:paramref:`_orm.relationship.active_history` flag can be set to ``True``
on the relationship.
.. change::
:tags: usecase, sql
:tickets: 6752
Added new method :meth:`_sql.HasCTE.add_cte` to each of the
:func:`_sql.select`, :func:`_sql.insert`, :func:`_sql.update` and
:func:`_sql.delete` constructs. This method will add the given
:class:`_sql.CTE` as an "independent" CTE of the statement, meaning it
renders in the WITH clause above the statement unconditionally even if it
is not otherwise referenced in the primary statement. This is a popular use
case on the PostgreSQL database where a CTE is used for a DML statement
that runs against database rows independently of the primary statement.
.. change::
:tags: bug, postgresql
:tickets: 6755
Fixed issue in :meth:`_postgresql.Insert.on_conflict_do_nothing` and
:meth:`_postgresql.Insert.on_conflict_do_update` where the name of a unique
constraint passed as the ``constraint`` parameter would not be properly
truncated for length if it were based on a naming convention that generated
a too-long name for the PostgreSQL max identifier length of 63 characters,
in the same way which occurs within a CREATE TABLE statement.
.. change::
:tags: bug, sql
:tickets: 6710
Fixed issue in CTE constructs where a recursive CTE that referred to a
SELECT that has duplicate column names, which are typically deduplicated
using labeling logic in 1.4, would fail to refer to the deduplicated label
name correctly within the WITH clause.
.. change::
:tags: bug, regression, mssql
:tickets: 6697
Fixed regression where the special dotted-schema name handling for the SQL
Server dialect would not function correctly if the dotted schema name were
used within the ``schema_translate_map`` feature.
.. change::
:tags: orm, regression
:tickets: 6718
Fixed ORM regression where ad-hoc label names generated for hybrid
properties and potentially other similar types of ORM-enabled expressions
would usually be propagated outwards through subqueries, allowing the name
to be retained in the final keys of the result set even when selecting from
subqueries. Additional state is now tracked in this case that isn't lost
when a hybrid is selected out of a Core select / subquery.
.. change::
:tags: bug, postgresql
:tickets: 6739
Fixed issue where the PostgreSQL ``ENUM`` datatype as embedded in the
``ARRAY`` datatype would fail to emit correctly in create/drop when the
``schema_translate_map`` feature were also in use. Additionally repairs a
related issue where the same ``schema_translate_map`` feature would not
work for the ``ENUM`` datatype in combination with a ``CAST``, that's also
intrinsic to how the ``ARRAY(ENUM)`` combination works on the PostgreSQL
dialect.
.. change::
:tags: bug, sql, regression
:tickets: 6735
Fixed regression where the :func:`_sql.tablesample` construct would fail to
be executable when constructed given a floating-point sampling value not
embedded within a SQL function.
.. change::
:tags: bug, postgresql
:tickets: 6696
Fixed issue in :meth:`_postgresql.Insert.on_conflict_do_nothing` and
:meth:`_postgresql.Insert.on_conflict_do_update` where the name of a unique
constraint passed as the ``constraint`` parameter would not be properly
quoted if it contained characters which required quoting.
.. change::
:tags: bug, regression, orm
:tickets: 6698
Fixed regression caused in 1.4.19 due to :ticket:`6503` and related
involving :meth:`_orm.Query.with_entities` where the new structure used
would be inappropriately transferred to an enclosing :class:`_orm.Query`
when making use of set operations such as :meth:`_orm.Query.union`, causing
the JOIN instructions within to be applied to the outside query as well.
.. change::
:tags: bug, orm, regression
:tickets: 6762
Fixed regression which appeared in version 1.4.3 due to :ticket:`6060`
where rules that limit ORM adaptation of derived selectables interfered
with other ORM-adaptation based cases, in this case when applying
adaptations for a :func:`_orm.with_polymorphic` against a mapping which
uses a :func:`_orm.column_property` which in turn makes use of a scalar
select that includes a :func:`_orm.aliased` object of the mapped table.
.. changelog::
```
### 1.4.20
```
:released: June 28, 2021
.. change::
:tags: bug, regression, orm
:tickets: 6680
Fixed regression in ORM regarding an internal reconstitution step for the
:func:`_orm.with_polymorphic` construct, when the user-facing object is
garbage collected as the query is processed. The reconstitution was not
ensuring the sub-entities for the "polymorphic" case were handled, leading
to an ``AttributeError``.
.. change::
:tags: usecase, sql
:tickets: 6646
Add a impl parameter to :class:`_types.PickleType` constructor, allowing
any arbitary type to be used in place of the default implementation of
:class:`_types.LargeBinary`. Pull request courtesy jason3gb.
.. change::
:tags: bug, engine
:tickets: 5348
Fixed an issue in the C extension for the :class:`_result.Row` class which
could lead to a memory leak in the unlikely case of a :class:`_result.Row`
object which referred to an ORM object that then was mutated to refer back
to the ``Row`` itself, creating a cycle. The Python C APIs for tracking GC
cycles has been added to the native :class:`_result.Row` implementation to
accommodate for this case.
.. change::
:tags: bug, engine
:tickets: 6665
Fixed old issue where a :func:`_sql.select()` made against the token "*",
which then yielded exactly one column, would fail to correctly organize the
``cursor.description`` column name into the keys of the result object.
.. change::
:tags: usecase, mysql
:tickets: 6659
Made a small adjustment in the table reflection feature of the MySQL
dialect to accommodate for alternate MySQL-oriented databases such as TiDB
which include their own "comment" directives at the end of a constraint
directive within "CREATE TABLE" where the format doesn't have the
additional space character after the comment, in this case the TiDB
"clustered index" feature. Pull request courtesy Daniël van Eeden.
.. change::
:tags: bug, schema
:tickets: 6685
Fixed issue where passing ``None`` for the value of
:paramref:`_schema.Table.prefixes` would not store an empty list, but
rather the constant ``None``, which may be unexpected by third party
dialects. The issue is revealed by a usage in recent versions of Alembic
that are passing ``None`` for this value. Pull request courtesy Kai
Mueller.
.. change::
:tags: bug, regression, ext
:tickets: 6679
Fixed regression in :mod:`sqlalchemy.ext.automap` extension such that the
use case of creating an explicit mapped class to a table that is also the
:paramref:`_orm.relationship.secondary` element of a
:func:`_orm.relationship` that automap will be generating would emit the
"overlaps" warnings introduced in 1.4 and discussed at :ref:`error_qzyx`.
While generating this case from automap is still subject to the same
caveats that the "overlaps" warning refers towards, as automap is intended
for more ad-hoc use cases, the condition which produces the warning is
disabled when a many-to-many relationship with this particular pattern is
generated.
.. change::
:tags: bug, regression, orm
:tickets: 6678
Adjusted :meth:`_orm.Query.union` and similar set operations to be
correctly compatible with the new capabilities just added in
:ticket:`6661`, with SQLAlchemy 1.4.19, such that the SELECT statements
rendered as elements of the UNION or other set operation will include
directly mapped columns that are mapped as deferred; this both fixes a
regression involving unions with multiple levels of nesting that would
produce a column mismatch, and also allows the :func:`_orm.undefer` option
to be used at the top level of such a :class:`_orm.Query` without having to
apply the option to each of the elements within the UNION.
.. change::
:tags: bug, sql, orm
:tickets: 6668
Fixed the class hierarchy for the :class:`_schema.Sequence` and the more
general :class:`_schema.DefaultGenerator` base, as these are "executable"
as statements they need to include :class:`_sql.Executable` in their
hierarchy, not just :class:`_roles.StatementRole` as was applied
arbitrarily to :class:`_schema.Sequence` previously. The fix allows
:class:`_schema.Sequence` to work in all ``.execute()`` methods including
with :meth:`_orm.Session.execute` which was not working in the case that a
:meth:`_orm.SessionEvents.do_orm_execute` handler was also established.
.. change::
:tags: bug, orm
:tickets: 6538
Adjusted the check in the mapper for a callable object that is used as a
``validates`` validator function or a ``reconstructor`` reconstruction
function, to check for "callable" more liberally such as to accommodate
objects based on fundamental attributes like ``__func__`` and
``__call___``, rather than testing for ``MethodType`` / ``FunctionType``,
allowing things like cython functions to work properly. Pull request
courtesy Miłosz Stypiński.
.. changelog::
```
### 1.4.19
```
:released: June 22, 2021
.. change::
:tags: bug, mssql
:tickets: 6658
Fixed bug where the "schema_translate_map" feature would fail to function
correctly in conjunction with an INSERT into a table that has an IDENTITY
column, where the value of the IDENTITY column were specified in the values
of the INSERT thus triggering SQLAlchemy's feature of setting IDENTITY
INSERT to "on"; it's in this directive where the schema translate map would
fail to be honored.
.. change::
:tags: bug, sql
:tickets: 6663
Fixed issue in CTE constructs mostly relevant to ORM use cases where a
recursive CTE against "anonymous" labels such as those seen in ORM
``column_property()`` mappings would render in the
``WITH RECURSIVE xyz(...)`` section as their raw internal label and not a
cleanly anonymized name.
.. change::
:tags: mssql, change
:tickets: 6503, 6253
Made improvements to the server version regexp used by the pymssql dialect
to prevent a regexp overflow in case of an invalid version string.
.. change::
:tags: bug, orm, regression
:tickets: 6503, 6253
Fixed further regressions in the same area as that of :ticket:`6052` where
loader options as well as invocations of methods like
:meth:`_orm.Query.join` would fail if the left side of the statement for
which the option/join depends upon were replaced by using the
:meth:`_orm.Query.with_entities` method, or when using 2.0 style queries
when using the :meth:`_sql.Select.with_only_columns` method. A new set of
state has been added to the objects which tracks the "left" entities that
the options / join were made against which is memoized when the lead
entities are changed.
.. change::
:tags: bug, asyncio, postgresql
:tickets: 6652
Fixed bug in asyncio implementation where the greenlet adaptation system
failed to propagate ``BaseException`` subclasses, most notably including
``asyncio.CancelledError``, to the exception handling logic used by the
engine to invalidate and clean up the connection, thus preventing
connections from being correctly disposed when a task was cancelled.
.. change::
:tags: usecase, asyncio
:tickets: 6583
Implemented :class:`_asyncio.async_scoped_session` to address some
asyncio-related incompatibilities between :class:`_orm.scoped_session` and
:class:`_asyncio.AsyncSession`, in which some methods (notably the
:meth:`_asyncio.async_scoped_session.remove` method) should be used with
the ``await`` keyword.
.. seealso::
:ref:`asyncio_scoped_session`
.. change::
:tags: usecase, mysql
:tickets: 6132
Added new construct :class:`_mysql.match`, which provides for the full
range of MySQL's MATCH operator including multiple column support and
modifiers. Pull request courtesy Anton Kovalevich.
.. seealso::
:class:`_mysql.match`
.. change::
:tags: bug, postgresql, oracle
:tickets: 6649
Fixed issue where the ``INTERVAL`` datatype on PostgreSQL and Oracle would
produce an ``AttributeError`` when used in the context of a comparison
operation against a ``timedelta()`` object. Pull request courtesy
MajorDallas.
.. change::
:tags: bug, mypy
:tickets: 6476
Fixed issue in mypy plugin where class info for a custom declarative base
would not be handled correctly on a cached mypy pass, leading to an
AssertionError being raised.
.. change::
:tags: bug, orm
:tickets: 6661
Refined the behavior of ORM subquery rendering with regards to deferred
columns and column properties to be more compatible with that of 1.3 while
also providing for 1.4's newer features. As a subquery in 1.4 does not make
use of loader options, including :func:`_orm.undefer`, a subquery that is
against an ORM entity with deferred attributes will now render those
deferred attributes that refer directly to mapped table columns, as these
are needed in the outer SELECT if that outer SELECT makes use of these
columns; however a deferred attribute that refers to a composed SQL
expression as we normally do with :func:`_orm.column_property` will not be
part of the subquery, as these can be selected explicitly if needed in the
subquery. If the entity is being SELECTed from this subquery, the column
expression can still render on "the outside" in terms of the derived
subquery columns. This produces essentially the same behavior as when
working with 1.3. However in this case the fix has to also make sure that
the ``.selected_columns`` collection of an ORM-enabled :func:`_sql.select`
also follows these rules, which in particular allows recursive CTEs to
render correctly in this scenario, which were previously failing to render
correctly due to this issue.
.. change::
:tags: bug, postgresql
:tickets: 6621
Fixed issue where the pool "pre ping" feature would implicitly start a
transaction, which would then interfere with custom transactional flags
such as PostgreSQL's "read only" mode when used with the psycopg2 driver.
.. changelog::
```
### 1.4.18
```
:released: June 10, 2021
.. change::
:tags: bug, orm
:tickets: 6072, 6487
Clarified the current purpose of the
:paramref:`_orm.relationship.bake_queries` flag, which in 1.4 is to enable
or disable "lambda caching" of statements within the "lazyload" and
"selectinload" loader strategies; this is separate from the more
foundational SQL query cache that is used for most statements.
Additionally, the lazy loader no longer uses its own cache for many-to-one
SQL queries, which was an implementation quirk that doesn't exist for any
other loader scenario. Finally, the "lru cache" warning that the lazyloader
and selectinloader strategies could emit when handling a wide array of
class/relationship combinations has been removed; based on analysis of some
end-user cases, this warning doesn't suggest any significant issue. While
setting ``bake_queries=False`` for such a relationship will remove this
cache from being used, there's no particular performance gain in this case
as using no caching vs. using a cache that needs to refresh often likely
still wins out on the caching being used side.
.. change::
:tags: bug, asyncio
:tickets: 6575
Fixed an issue that presented itself when using the :class:`_pool.NullPool`
or the :class:`_pool.StaticPool` with an async engine. This mostly affected
the aiosqlite dialect.
.. change::
:tags: bug, sqlite, regression
:tickets: 6586
The fix for pysqlcipher released in version 1.4.3 :ticket:`5848` was
unfortunately non-working, in that the new ``on_connect_url`` hook was
erroneously not receiving a ``URL`` object under normal usage of
:func:`_sa.create_engine` and instead received a string that was unhandled;
the test suite failed to fully set up the actual conditions under which
this hook is called. This has been fixed.
.. change::
:tags: bug, postgresql, regression
:tickets: 6581
Fixed regression where using the PostgreSQL "INSERT..ON CONFLICT" structure
would fail to work with the psycopg2 driver if it were used in an
"executemany" context along with bound parameters in the "SET" clause, due
to the implicit use of the psycopg2 fast execution helpers which are not
appropriate for this style of INSERT statement; as these helpers are the
default in 1.4 this is effectively a regression. Additional checks to
exclude this kind of statement from that particular extension have been
added.
.. change::
:tags: bug, orm, regression
:tickets: 6285
Adjusted the means by which classes such as :class:`_orm.scoped_session`
and :class:`_asyncio.AsyncSession` are generated from the base
:class:`_orm.Session` class, such that custom :class:`_orm.Session`
subclasses such as that used by Flask-SQLAlchemy don't need to implement
positional arguments when they call into the superclass method, and can
continue using the same argument styles as in previous releases.
.. change::
:tags: bug, orm, regression
:tickets: 6595
Fixed issue where query production for joinedload against a complex left
hand side involving joined-table inheritance could fail to produce a
correct query, due to a clause adaption issue.
.. change::
:tags: bug, orm, regression, performance
:tickets: 6596
Fixed regression involving how the ORM would resolve a given mapped column
to a result row, where under cases such as joined eager loading, a slightly
more expensive "fallback" could take place to set up this resolution due to
some logic that was removed since 1.3. The issue could also cause
deprecation warnings involving column resolution to be emitted when using a
1.4 style query with joined eager loading.
.. change::
:tags: bug, orm
:tickets: 6591
Fixed issue in experimental "select ORM objects from INSERT/UPDATE" use
case where an error was raised if the statement were against a
single-table-inheritance subclass.
.. change::
:tags: bug, asyncio
:tickets: 6592
Added ``asyncio.exceptions.TimeoutError``,
``asyncio.exceptions.CancelledError`` as so-called "exit exceptions", a
class of exceptions that include things like ``GreenletExit`` and
``KeyboardInterrupt``, which are considered to be events that warrant
considering a DBAPI connection to be in an unusable state where it should
be recycled.
.. change::
:tags: bug, orm
:tickets: 6400
The warning that's emitted for :func:`_orm.relationship` when multiple
relationships would overlap with each other as far as foreign key
attributes written towards, now includes the specific "overlaps" argument
to use for each warning in order to silence the warning without changing
the mapping.
.. change::
:tags: usecase, asyncio
:tickets: 6319
Implemented a new registry architecture that allows the ``Async`` version
of an object, like ``AsyncSession``, ``AsyncConnection``, etc., to be
locatable given the proxied "sync" object, i.e. ``Session``,
``Connection``. Previously, to the degree such lookup functions were used,
an ``Async`` object would be re-created each time, which was less than
ideal as the identity and state of the "async" object would not be
preserved across calls.
From there, new helper functions :func:`_asyncio.async_object_session`,
:func:`_asyncio.async_session` as well as a new :class:`_orm.InstanceState`
attribute :attr:`_orm.InstanceState.async_session` have been added, which
are used to retrieve the original :class:`_asyncio.AsyncSession` associated
with an ORM mapped object, a :class:`_orm.Session` associated with an
:class:`_asyncio.AsyncSession`, and an :class:`_asyncio.AsyncSession`
associated with an :class:`_orm.InstanceState`, respectively.
This patch also implements new methods
:meth:`_asyncio.AsyncSession.in_nested_transaction`,
:meth:`_asyncio.AsyncSession.get_transaction`,
:meth:`_asyncio.AsyncSession.get_nested_transaction`.
.. changelog::
```
### 1.4.17
```
:released: May 29, 2021
.. change::
:tags: bug, orm, regression
:tickets: 6558
Fixed regression caused by just-released performance fix mentioned in 6550
where a query.join() to a relationship could produce an AttributeError if
the query were made against non-ORM structures only, a fairly unusual
calling pattern.
.. changelog::
```
### 1.4.16
```
:released: May 28, 2021
.. change::
:tags: bug, engine
:tickets: 6482
Fixed issue where an ` sign in the database portion of a URL would not
be interpreted correctly if the URL also had a username:password section.
.. change::
:tags: bug, ext
:tickets: 6529
Fixed a deprecation warning that was emitted when using
:func:`_automap.automap_base` without passing an existing
``Base``.
.. change::
:tags: bug, pep484
:tickets: 6461
Remove pep484 types from the code.
Current effort is around the stub package, and having typing in
two places makes thing worse, since the types in the SQLAlchemy
source were usually outdated compared to the version in the stubs.
.. change::
:tags: usecase, mssql
:tickets: 6464
Implemented support for a :class:`_sql.CTE` construct to be used directly
as the target of a :func:`_sql.delete` construct, i.e. "WITH ... AS cte
DELETE FROM cte". This appears to be a useful feature of SQL Server.
.. change::
:tags: bug, general
:tickets: 6540, 6543
Resolved various deprecation warnings which were appearing as of Python
version 3.10.0b1.
.. change::
:tags: bug, orm
:tickets: 6471
Fixed issue when using :paramref:`_orm.relationship.cascade_backrefs`
parameter set to ``False``, which per :ref:`change_5150` is set to become
the standard behavior in SQLAlchemy 2.0, where adding the item to a
collection that uniquifies, such as ``set`` or ``dict`` would fail to fire
a cascade event if the object were already associated in that collection
via the backref. This fix represents a fundamental change in the collection
mechanics by introducing a new event state which can fire off for a
collection mutation even if there is no net change on the collection; the
action is now suited using a new event hook
:meth:`_orm.AttributeEvents.append_wo_mutation`.
.. change::
:tags: bug, orm, regression
:tickets: 6550
Fixed regression involving clause adaption of labeled ORM compound
elements, such as single-table inheritance discriminator expressions with
conditionals or CASE expressions, which could cause aliased expressions
such as those used in ORM join / joinedload operations to not be adapted
correctly, such as referring to the wrong table in the ON clause in a join.
This change also improves a performance bump that was located within the
process of invoking :meth:`_sql.Select.join` given an ORM attribute
as a target.
.. change::
:tags: bug, orm, regression
:tickets: 6495
Fixed regression where the full combination of joined inheritance, global
with_polymorphic, self-referential relationship and joined loading would
fail to be able to produce a query with the scope of lazy loads and object
refresh operations that also attempted to render the joined loader.
.. change::
:tags: bug, engine
:tickets: 6329
Fixed a long-standing issue with :class:`.URL` where query parameters
following the question mark would not be parsed correctly if the URL did
not contain a database portion with a backslash.
.. change::
:tags: bug, sql, regression
:tickets: 6549
Fixed regression in dynamic loader strategy and :func:`_orm.relationship`
overall where the :paramref:`_orm.relationship.order_by` parameter were
stored as a mutable list, which could then be mutated when combined with
additional "order_by" methods used against the dynamic query object,
causing the ORDER BY criteria to continue to grow repetitively.
.. change::
:tags: bug, orm
:tickets: 6484
Enhanced the bind resolution rules for :meth:`_orm.Session.execute` so that
when a non-ORM statement such as an :func:`_sql.insert` construct
nonetheless is built against ORM objects, to the greatest degree possible
the ORM entity will be used to resolve the bind, such as for a
:class:`_orm.Session` that has a bind map set up on a common superclass
without specific mappers or tables named in the map.
.. change::
:tags: bug, regression, ext
:tickets: 6390
Fixed regression in the ``sqlalchemy.ext.instrumentation`` extension that
prevented instrumentation disposal from working completely. This fix
includes both a 1.4 regression fix as well as a fix for a related issue
that existed in 1.3 also. As part of this change, the
:class:`sqlalchemy.ext.instrumentation.InstrumentationManager` class now
has a new method ``unregister()``, which replaces the previous method
``dispose()``, which was not called as of version 1.4.
.. changelog::
```
### 1.4.15
```
:released: May 11, 2021
.. change::
:tags: bug, documentation, mysql
:tickets: 5397
Added support for the ``ssl_check_hostname=`` parameter in mysql connection
URIs and updated the mysql dialect documentation regarding secure
connections. Original pull request courtesy of Jerry Zhao.
.. change::
:tags: bug, orm, regression
:tickets: 6449
Fixed additional regression caused by "eager loaders run on unexpire"
feature :ticket:`1763` where the feature would run for a
``contains_eager()`` eagerload option in the case that the
``contains_eager()`` were chained to an additional eager loader option,
which would then produce an incorrect query as the original query-bound
join criteria were no longer present.
.. change::
:tags: feature, general
:tickets: 6241
A new approach has been applied to the warnings system in SQLAlchemy to
accurately predict the appropriate stack level for each warning
dynamically. This allows evaluating the source of SQLAlchemy-generated
warnings and deprecation warnings to be more straightforward as the warning
will indicate the source line within end-user code, rather than from an
arbitrary level within SQLAlchemy's own source code.
.. change::
:tags: bug, orm
:tickets: 6459
Fixed issue in subquery loader strategy which prevented caching from
working correctly. This would have been seen in the logs as a "generated"
m
Update aiohttp-jinja2 from 1.4.2 to 1.5.
Changelog
### 1.5 ``` ---------------- - Drop support for jinaj2 <3. Add support for 3+. - Don't require ``typing_extensions`` on Python 3.8+. ```Links
- PyPI: https://pypi.org/project/aiohttp-jinja2 - Changelog: https://pyup.io/changelogs/aiohttp-jinja2/ - Repo: https://github.com/aio-libs/aiohttp_jinja2/Update aioredis from 1.3.1 to 2.0.0.
Changelog
### 2.0.0 ``` Features - Port redis-py's client implementation to aioredis. (see 891) - Make hiredis an optional dependency. (see 917) ```Links
- PyPI: https://pypi.org/project/aioredis - Changelog: https://pyup.io/changelogs/aioredis/ - Repo: https://github.com/aio-libs/aioredisUpdate alembic from 1.5.8 to 1.7.1.
Changelog
### 1.7.1 ``` :released: August 30, 2021 .. change:: :tags: bug, installation :tickets: 893 Corrected "universal wheel" directive in setup.cfg so that building a wheel does not target Python 2. The PyPi files index for 1.7.0 was corrected manually. Pull request courtesy layday. .. change:: :tags: bug, pep484 :tickets: 895 Fixed issue in generated .pyi files where default values for ``Optional`` arguments were missing, thereby causing mypy to consider them as required. .. change:: :tags: bug, regression, batch :tickets: 896 Fixed regression in batch mode due to :ticket:`883` where the "auto" mode of batch would fail to accommodate any additional migration directives beyond encountering an ``add_column()`` directive, due to a mis-application of the conditional logic that was added as part of this change, leading to "recreate" mode not being used in cases where it is required for SQLite such as for unique constraints. .. changelog:: ``` ### 1.7.0 ``` :released: August 30, 2021 .. change:: :tags: bug, operations :tickets: 879 Fixed regression due to :ticket:`803` where the ``.info`` and ``.comment`` attributes of ``Table`` would be lost inside of the :class:`.DropTableOp` class, which when "reversed" into a :class:`.CreateTableOp` would then have lost these elements. Pull request courtesy Nicolas CANIART. .. change:: :tags: feature, environment :tickets: 842 Enhance ``version_locations`` parsing to handle paths containing spaces. The new configuration option ``version_path_separator`` specifies the character to use when splitting the ``version_locations`` string. The default for new configurations is ``version_path_separator = os``, which will use ``os.pathsep`` (e.g., ``;`` on Windows). .. change:: :tags: installation, changed Alembic 1.7 now supports Python 3.6 and above; support for prior versions including Python 2.7 has been dropped. .. change:: :tags: bug, sqlite, batch :tickets: 883 Batch "auto" mode will now select for "recreate" if the ``add_column()`` operation is used on SQLite, and the column itself meets the criteria for SQLite where ADD COLUMN is not allowed, in this case a functional or parenthesized SQL expression or a ``Computed`` (i.e. generated) column. .. change:: :tags: changed, installation :tickets: 674 Make the ``python-dateutil`` library an optional dependency. This library is only required if the ``timezone`` option is used in the Alembic configuration. An extra require named ``tz`` is available with ``pip install alembic[tz]`` to install it. .. change:: :tags: bug, commands :tickets: 856 Re-implemented the ``python-editor`` dependency as a small internal function to avoid the need for external dependencies. .. change:: :tags: usecase, batch :tickets: 884 Named CHECK constraints are now supported by batch mode, and will automatically be part of the recreated table assuming they are named. They also can be explicitly dropped using ``op.drop_constraint()``. For "unnamed" CHECK constraints, these are still skipped as they cannot be distinguished from the CHECK constraints that are generated by the ``Boolean`` and ``Enum`` datatypes. Note that this change may require adjustments to migrations that drop or rename columns which feature an associated named check constraint, such that an additional ``op.drop_constraint()`` directive should be added for that named constraint as there will no longer be an associated column for it; for the ``Boolean`` and ``Enum`` datatypes, an ``existing_type`` keyword may be passed to ``BatchOperations.drop_constraint`` as well. .. seealso:: :ref:`batch_schematype_constraints` :ref:`batch_check_constraints` .. change:: :tags: changed, installation :tickets: 885 The dependency on ``pkg_resources`` which is part of ``setuptools`` has been removed, so there is no longer any runtime dependency on ``setuptools``. The functionality has been replaced with ``importlib.metadata`` and ``importlib.resources`` which are both part of Python std.lib, or via pypy dependency ``importlib-metadata`` for Python version < 3.8 and ``importlib-resources`` for Python version < 3.9 (while importlib.resources was added to Python in 3.7, it did not include the "files" API until 3.9). .. change:: :tags: feature, tests :tickets: 855 Created a "test suite" similar to the one for SQLAlchemy, allowing developers of third-party dialects to test their code against a set of Alembic tests that have been specially selected to exercise back-end database operations. At the time of release, third-party dialects that have adopted the Alembic test suite to verify compatibility include `CockroachDB <https://pypi.org/project/sqlalchemy-cockroachdb/>`_ and `SAP ASE (Sybase) <https://pypi.org/project/sqlalchemy-sybase/>`_. .. change:: :tags: bug, postgresql :tickets: 874 Fixed issue where usage of the PostgreSQL ``postgresql_include`` option within a :meth:`.Operations.create_index` would raise a KeyError, as the additional column(s) need to be added to the table object used by the construct internally. The issue is equivalent to the SQL Server issue fixed in :ticket:`513`. Pull request courtesy Steven Bronson. .. change:: :tags: feature, general pep-484 type annotations have been added throughout the library. Additionally, stub .pyi files have been added for the "dynamically" generated Alembic modules ``alembic.op`` and ``alembic.config``, which include complete function signatures and docstrings, so that the functions in these namespaces will have both IDE support (vscode, pycharm, etc) as well as support for typing tools like Mypy. The files themselves are statically generated from their source functions within the source tree. .. changelog:: ``` ### 1.6.5 ``` :released: May 27, 2021 .. change:: :tags: bug, autogenerate :tickets: 849 Fixed issue where dialect-specific keyword arguments within the :class:`.DropIndex` operation directive would not render in the autogenerated Python code. As support was improved for adding dialect specific arguments to directives as part of :ticket:`803`, in particular arguments such as "postgresql_concurrently" which apply to the actual create/drop of the index, support was needed for these to render even in a drop index operation. Pull request courtesy Jet Zhou. .. changelog:: ``` ### 1.6.4 ``` :released: May 24, 2021 .. change:: :tags: bug, regression, op directives :tickets: 848 Fixed regression caused by just fixed :ticket:`844` that scaled back the filter for ``unique=True/index=True`` too far such that these directives no longer worked for the ``op.create_table()`` op, this has been fixed. .. changelog:: ``` ### 1.6.3 ``` :released: May 21, 2021 .. change:: :tags: bug, regression, autogenerate :tickets: 844 Fixed 1.6-series regression where ``UniqueConstraint`` and to a lesser extent ``Index`` objects would be doubled up in the generated model when the ``unique=True`` / ``index=True`` flags were used. .. change:: :tags: bug, autogenerate :tickets: 839 Fixed a bug where paths defined in post-write hook options would be wrongly escaped in non posix environment (Windows). .. change:: :tags: bug, regression, versioning :tickets: 843 Fixed regression where a revision file that contained its own down revision as a dependency would cause an endless loop in the traversal logic. .. changelog:: ``` ### 1.6.2 ``` :released: May 6, 2021 .. change:: :tags: bug, versioning, regression :tickets: 839 Fixed additional regression nearly the same as that of :ticket:`838` just released in 1.6.1 but within a slightly different codepath, where "alembic downgrade head" (or equivalent) would fail instead of iterating no revisions. .. changelog:: ``` ### 1.6.1 ``` :released: May 6, 2021 .. change:: :tags: bug, versioning, regression :tickets: 838 Fixed regression in new revisioning traversal where "alembic downgrade base" would fail if the database itself were clean and unversioned; additionally repairs the case where downgrade would fail if attempting to downgrade to the current head that is already present. .. changelog:: ``` ### 1.6.0 ``` :released: May 3, 2021 .. change:: :tags: bug, autogenerate :tickets: 803 Refactored the implementation of :class:`.MigrateOperation` constructs such as :class:`.CreateIndexOp`, :class:`.CreateTableOp`, etc. so that they no longer rely upon maintaining a persistent version of each schema object internally; instead, the state variables of each operation object will be used to produce the corresponding construct when the operation is invoked. The rationale is so that environments which make use of operation-manipulation schemes such as those those discussed in :ref:`autogen_rewriter` are better supported, allowing end-user code to manipulate the public attributes of these objects which will then be expressed in the final output, an example is ``some_create_index_op.kw["postgresql_concurrently"] = True``. Previously, these objects when generated from autogenerate would typically hold onto the original, reflected element internally without honoring the other state variables of each construct, preventing the public API from working. .. change:: :tags: bug, environment :tickets: 829 Fixed regression caused by the SQLAlchemy 1.4/2.0 compatibility switch where calling ``.rollback()`` or ``.commit()`` explicitly within the ``context.begin_transaction()`` context manager would cause it to fail when the block ended, as it did not expect that the transaction was manually closed. .. change:: :tags: bug, autogenerate :tickets: 827 Improved the rendering of ``op.add_column()`` operations when adding multiple columns to an existing table, so that the order of these statements matches the order in which the columns were declared in the application's table metadata. Previously the added columns were being sorted alphabetically. .. change:: :tags: feature, autogenerate :tickets: 819 Fix the documentation regarding the default command-line argument position of the revision script filename within the post-write hook arguments. Implement a ``REVISION_SCRIPT_FILENAME`` token, enabling the position to be changed. Switch from ``str.split()`` to ``shlex.split()`` for more robust command-line argument parsing. .. change:: :tags: feature :tickets: 822 Implement a ``.cwd`` (current working directory) suboption for post-write hooks (of type ``console_scripts``). This is useful for tools like pre-commit, which rely on the working directory to locate the necessary config files. Add pre-commit as an example to the documentation. Minor change: rename some variables from ticket 819 to improve readability. .. change:: :tags: bug, versioning :tickets: 765, 464 The algorithm used for calculating downgrades/upgrades/iterating revisions has been rewritten, to resolve ongoing issues of branches not being handled consistently particularly within downgrade operations, as well as for overall clarity and maintainability. This change includes that a deprecation warning is emitted if an ambiguous command such as "downgrade -1" when multiple heads are present is given. In particular, the change implements a long-requested use case of allowing downgrades of a single branch to a branchpoint. Huge thanks to Simon Bowly for their impressive efforts in successfully tackling this very difficult problem. .. change:: :tags: bug, batch :tickets: 799 Added missing ``batch_op.create_table_comment()``, ``batch_op.drop_table_comment()`` directives to batch ops. .. changelog:: ```Links
- PyPI: https://pypi.org/project/alembic - Changelog: https://pyup.io/changelogs/alembic/ - Homepage: https://alembic.sqlalchemy.org - Docs: https://pythonhosted.org/alembic/Update marshmallow from 3.11.1 to 3.13.0.
Changelog
### 3.13.0 ``` ******************* Features: - Replace ``missing``/``default`` field parameters with ``load_default``/``dump_default`` (:pr:`1742`). Thanks :user:`sirosen` for the PR. Deprecations: - The use of ``missing``/``default`` field parameters is deprecated and will be removed in marshmallow 4. ``load_default``/``dump_default`` should be used instead. ``` ### 3.12.2 ``` ******************* Bug fixes: - Don't expose ``Field``\s as ``Schema`` attributes. This reverts a change introduced in 3.12.0 that causes issues when field names conflict with ``Schema`` attributes or methods. ``Fields``\s are still accessible on a ``Schema`` instance throught the ``fields`` attribute. (:pr:`1843`) ``` ### 3.12.1 ``` ******************* Bug fixes: - Fix bug that raised an ``AttributeError`` when instantiating a ``Schema`` with a field named ``parent`` (:issue:`1808`). Thanks :user:`flying-sheep` for reporting and helping with the fix. ``` ### 3.12.0 ``` ******************* Features: - Add ``validate.And`` (:issue:`1768`). Thanks :user:`rugleb` for the suggestion. - Add type annotations to ``marshmallow.decorators`` (:issue:`1788`, :pr:`1789`). Thanks :user:`michaeldimchuk` for the PR. - Let ``Field``\s be accessed by name as ``Schema`` attributes (:pr:`1631`). Other changes: - Improve types in ``marshmallow.validate`` (:pr:`1786`). - Make ``marshmallow.validate.Validator`` an abstract base class (:pr:`1786`). - Remove unnecessary list cast (:pr:`1785`). ```Links
- PyPI: https://pypi.org/project/marshmallow - Changelog: https://pyup.io/changelogs/marshmallow/ - Repo: https://github.com/marshmallow-code/marshmallowUpdate sentry-sdk from 1.0.0 to 1.3.1.
The bot wasn't able to find a changelog for this release. Got an idea?
Links
- PyPI: https://pypi.org/project/sentry-sdk - Repo: https://github.com/getsentry/sentry-pythonUpdate psycopg2-binary from 2.8.6 to 2.9.1.
The bot wasn't able to find a changelog for this release. Got an idea?
Links
- PyPI: https://pypi.org/project/psycopg2-binary - Homepage: https://psycopg.org/Update uvloop from 0.15.2 to 0.16.0.
Changelog
### 0.16.0 ``` This release adds Python 3.10 support, updates bundled libuv to 1.42.0 and fixes a handful of issues. Changes ======= * Python 3.10 support (432) (by elprans in 2519e2df for 432) * Bump vendored libuv to 1.42.0 (433) (by elprans in a62f7818 for 433) * Use cibuildwheel to build wheels (435) (by elprans in 20febe0b for 435) * Add support for `<timer handle>.when()` (by Jens Jorgensen in 62b2af9c) Fixes ===== * Fix ref issue when protocol is in Cython (by fantix in 70cafc82 for 2222) * Set `python_requires` in setup.py (by graingert in c808a663) * SSL: schedule first data after waiter wakeup (by fantix in 2081db89) * Fix a possible race condition in sslproto test (by fantix in b0526cd5 for 412) * Fix `call_soon_threadsafe` thread safety (by fantix in 4b803b15) ``` ### 0.15.3 ``` Bug Fixes * SSL: schedule first data after waiter wakeup (by fantix in 0df12282) * Fix a possible race condition in sslproto test (by fantix in 2e71c4c2 for 412) * Fix `call_soon_threadsafe` thread safety (by fantix and hehaha in 6387a4e4 for 408) ```Links
- PyPI: https://pypi.org/project/uvloop - Changelog: https://pyup.io/changelogs/uvloop/ - Repo: http://github.com/MagicStack/uvloopUpdate sqlalchemy from 1.3.23 to 1.4.23.
Changelog
### 1.4.23 ``` :released: August 18, 2021 .. change:: :tags: bug, sql :tickets: 6752 Fix issue in :class:`_sql.CTE` where new :meth:`_sql.HasCTE.add_cte` method added in version 1.4.21 / :ticket:`6752` failed to function correctly for "compound select" structures such as :func:`_sql.union`, :func:`_sql.union_all`, :func:`_sql.except`, etc. Pull request courtesy Eric Masseran. .. change:: :tags: orm, usecase :tickets: 6808 Added new attribute :attr:`_sql.Select.columns_clause_froms` that will retrieve the FROM list implied by the columns clause of the :class:`_sql.Select` statement. This differs from the old :attr:`_sql.Select.froms` collection in that it does not perform any ORM compilation steps, which necessarily deannotate the FROM elements and do things like compute joinedloads etc., which makes it not an appropriate candidate for the :meth:`_sql.Select.select_from` method. Additionally adds a new parameter :paramref:`_sql.Select.with_only_columns.maintain_column_froms` that transfers this collection to :meth:`_sql.Select.select_from` before replacing the columns collection. In addition, the :attr:`_sql.Select.froms` is renamed to :meth:`_sql.Select.get_final_froms`, to stress that this collection is not a simple accessor and is instead calculated given the full state of the object, which can be an expensive call when used in an ORM context. Additionally fixes a regression involving the :func:`_orm.with_only_columns` function to support applying criteria to column elements that were replaced with either :meth:`_sql.Select.with_only_columns` or :meth:`_orm.Query.with_entities` , which had broken as part of :ticket:`6503` released in 1.4.19. .. change:: :tags: bug, orm, sql :tickets: 6824 Fixed issue where a bound parameter object that was "cloned" would cause a name conflict in the compiler, if more than one clone of this parameter were used at the same time in a single statement. This could occur in particular with things like ORM single table inheritance queries that indicated the same "discriminator" value multiple times in one query. .. change:: :tags: bug, mssql, sql :tickets: 6863 Fixed issue where the ``literal_binds`` compiler flag, as used externally to render bound parameters inline, would fail to work when used with a certain class of parameters known as "literal_execute", which covers things like LIMIT and OFFSET values for dialects where the drivers don't allow a bound parameter, such as SQL Server's "TOP" clause. The issue locally seemed to affect only the MSSQL dialect. .. change:: :tags: bug, orm :tickets: 6869 Fixed issue in loader strategies where the use of the :meth:`_orm.Load.options` method, particularly when nesting multiple calls, would generate an overly long and more importantly non-deterministic cache key, leading to very large cache keys which were also not allowing efficient cache usage, both in terms of total memory used as well as number of entries used in the cache itself. .. change:: :tags: bug, sql :tickets: 6858 Fixed an issue in the ``CacheKey.to_offline_string()`` method used by the dogpile.caching example where attempting to create a proper cache key from the special "lambda" query generated by the lazy loader would fail to include the parameter values, leading to an incorrect cache key. .. change:: :tags: bug, orm :tickets: 6887 Revised the means by which the :attr:`_orm.ORMExecuteState.user_defined_options` accessor receives :class:`_orm.UserDefinedOption` and related option objects from the context, with particular emphasis on the "selectinload" on the loader strategy where this previously was not working; other strategies did not have this problem. The objects that are associated with the current query being executed, and not that of a query being cached, are now propagated unconditionally. This essentially separates them out from the "loader strategy" options which are explicitly associated with the compiled state of a query and need to be used in relation to the cached query. The effect of this fix is that a user-defined option, such as those used by the dogpile.caching example as well as for other recipes such as defining a "shard id" for the horizontal sharing extension, will be correctly propagated to eager and lazy loaders regardless of whether a cached query was ultimately invoked. .. change:: :tags: bug, sql :tickets: 6886 Adjusted the "from linter" warning feature to accommodate for a chain of joins more than one level deep where the ON clauses don't explicitly match up the targets, such as an expression such as "ON TRUE". This mode of use is intended to cancel the cartesian product warning simply by the fact that there's a JOIN from "a to b", which was not working for the case where the chain of joins had more than one element. .. change:: :tags: bug, postgresql :tickets: 6886 Added the "is_comparison" flag to the PostgreSQL "overlaps", "contained_by", "contains" operators, so that they work in relevant ORM contexts as well as in conjunction with the "from linter" feature. .. change:: :tags: bug, orm :tickets: 6812 Fixed issue where the unit of work would internally use a 2.0-deprecated SQL expression form, emitting a deprecation warning when SQLALCHEMY_WARN_20 were enabled. .. change:: :tags: bug, orm :tickets: 6881 Fixed issue in :func:`_orm.selectinload` where use of the new :meth:`_orm.PropComparator.and_` feature within options that were nested more than one level deep would fail to update bound parameter values that were in the nested criteria, as a side effect of SQL statement caching. .. change:: :tags: bug, general :tickets: 6136 The setup requirements have been modified such ``greenlet`` is a default requirement only for those platforms that are well known for ``greenlet`` to be installable and for which there is already a pre-built binary on pypi; the current list is ``x86_64 aarch64 ppc64le amd64 win32``. For other platforms, greenlet will not install by default, which should enable installation and test suite running of SQLAlchemy 1.4 on platforms that don't support ``greenlet``, excluding any asyncio features. In order to install with the ``greenlet`` dependency included on a machine architecture outside of the above list, the ``[asyncio]`` extra may be included by running ``pip install sqlalchemy[asyncio]`` which will then attempt to install ``greenlet``. Additionally, the test suite has been repaired so that tests can complete fully when greenlet is not installed, with appropriate skips for asyncio-related tests. .. change:: :tags: enum, schema :tickets: 6146 Unify behaviour :class:`_schema.Enum` in native and non-native implementations regarding the accepted values for an enum with aliased elements. When :paramref:`_schema.Enum.omit_aliases` is ``False`` all values, alias included, are accepted as valid values. When :paramref:`_schema.Enum.omit_aliases` is ``True`` only non aliased values are accepted as valid values. .. change:: :tags: bug, ext :tickets: 6816 Fixed issue where the horizontal sharding extension would not correctly accommodate for a plain textual SQL statement passed to :meth:`_orm.Session.execute`. .. change:: :tags: bug, orm :tickets: 6889, 6079 Adjusted ORM loader internals to no longer use the "lambda caching" system that was added in 1.4, as well as repaired one location that was still using the previous "baked query" system for a query. The lambda caching system remains an effective way to reduce the overhead of building up queries that have relatively fixed usage patterns. In the case of loader strategies, the queries used are responsible for moving through lots of arbitrary options and criteria, which is both generated and sometimes consumed by end-user code, that make the lambda cache concept not any more efficient than not using it, at the cost of more complexity. In particular the problems noted by :ticket:`6881` and :ticket:`6887` are made are made considerably less complicated by removing this feature internally. .. change:: :tags: bug, orm :tickets: 6889 Fixed an issue where the :class:`_orm.Bundle` construct would not create proper cache keys, leading to inefficient use of the query cache. This had some impact on the "selectinload" strategy and was identified as part of :ticket:`6889`. .. change:: :tags: usecase, mypy :tickets: 6804, 6759 Added support for SQLAlchemy classes to be defined in user code using "generic class" syntax as defined by ``sqlalchemy2-stubs``, e.g. ``Column[String]``, without the need for qualifying these constructs within a ``TYPE_CHECKING`` block by implementing the Python special method ``__class_getitem__()``, which allows this syntax to pass without error at runtime. .. change:: :tags: bug, sql Fixed issue in lambda caching system where an element of a query that produces no cache key, like a custom option or clause element, would still populate the expression in the "lambda cache" inappropriately. .. changelog:: ``` ### 1.4.22 ``` :released: July 21, 2021 .. change:: :tags: bug, sql :tickets: 6786 Fixed issue where use of the :paramref:`_sql.case.whens` parameter passing a dictionary positionally and not as a keyword argument would emit a 2.0 deprecation warning, referring to the deprecation of passing a list positionally. The dictionary format of "whens", passed positionally, is still supported and was accidentally marked as deprecated. .. change:: :tags: bug, orm :tickets: 6775 Fixed issue in new :meth:`_schema.Table.table_valued` method where the resulting :class:`_sql.TableValuedColumn` construct would not respond correctly to alias adaptation as is used throughout the ORM, such as for eager loading, polymorphic loading, etc. .. change:: :tags: bug, orm :tickets: 6769 Fixed issue where usage of the :meth:`_result.Result.unique` method with an ORM result that included column expressions with unhashable types, such as ``JSON`` or ``ARRAY`` using non-tuples would silently fall back to using the ``id()`` function, rather than raising an error. This now raises an error when the :meth:`_result.Result.unique` method is used in a 2.0 style ORM query. Additionally, hashability is assumed to be True for result values of unknown type, such as often happens when using SQL functions of unknown return type; if values are truly not hashable then the ``hash()`` itself will raise. For legacy ORM queries, since the legacy :class:`_orm.Query` object uniquifies in all cases, the old rules remain in place, which is to use ``id()`` for result values of unknown type as this legacy uniquing is mostly for the purpose of uniquing ORM entities and not column values. .. change:: :tags: orm, bug :tickets: 6771 Fixed an issue where clearing of mappers during things like test suite teardowns could cause a "dictionary changed size" warning during garbage collection, due to iteration of a weak-referencing dictionary. A ``list()`` has been applied to prevent concurrent GC from affecting this operation. .. change:: :tags: bug, sql :tickets: 6770 Fixed issue where type-specific bound parameter handlers would not be called upon in the case of using the :meth:`_sql.Insert.values` method with the Python ``None`` value; in particular, this would be noticed when using the :class:`_types.JSON` datatype as well as related PostgreSQL specific types such as :class:`_postgresql.JSONB` which would fail to encode the Python ``None`` value into JSON null, however the issue was generalized to any bound parameter handler in conjunction with this specific method of :class:`_sql.Insert`. .. change:: :tags: bug, engine :tickets: 6740 Added some guards against ``KeyError`` in the event system to accommodate the case that the interpreter is shutting down at the same time :meth:`_engine.Engine.dispose` is being called, which would cause stack trace warnings. .. change:: :tags: bug, orm, regression :tickets: 6793 Fixed critical caching issue where the ORM's persistence feature using INSERT..RETURNING would cache an incorrect query when mixing the "bulk save" and standard "flush" forms of INSERT. .. changelog:: ``` ### 1.4.21 ``` :released: July 14, 2021 .. change:: :tags: usecase, orm :tickets: 6708 Modified the approach used for history tracking of scalar object relationships that are not many-to-one, i.e. one-to-one relationships that would otherwise be one-to-many. When replacing a one-to-one value, the "old" value that would be replaced is no longer loaded immediately, and is instead handled during the flush process. This eliminates an historically troublesome lazy load that otherwise often occurs when assigning to a one-to-one attribute, and is particularly troublesome when using "lazy='raise'" as well as asyncio use cases. This change does cause a behavioral change within the :meth:`_orm.AttributeEvents.set` event, which is nonetheless currently documented, which is that the event applied to such a one-to-one attribute will no longer receive the "old" parameter if it is unloaded and the :paramref:`_orm.relationship.active_history` flag is not set. As is documented in :meth:`_orm.AttributeEvents.set`, if the event handler needs to receive the "old" value when the event fires off, the active_history flag must be established either with the event listener or with the relationship. This is already the behavior with other kinds of attributes such as many-to-one and column value references. The change additionally will defer updating a backref on the "old" value in the less common case that the "old" value is locally present in the session, but isn't loaded on the relationship in question, until the next flush occurs. If this causes an issue, again the normal :paramref:`_orm.relationship.active_history` flag can be set to ``True`` on the relationship. .. change:: :tags: usecase, sql :tickets: 6752 Added new method :meth:`_sql.HasCTE.add_cte` to each of the :func:`_sql.select`, :func:`_sql.insert`, :func:`_sql.update` and :func:`_sql.delete` constructs. This method will add the given :class:`_sql.CTE` as an "independent" CTE of the statement, meaning it renders in the WITH clause above the statement unconditionally even if it is not otherwise referenced in the primary statement. This is a popular use case on the PostgreSQL database where a CTE is used for a DML statement that runs against database rows independently of the primary statement. .. change:: :tags: bug, postgresql :tickets: 6755 Fixed issue in :meth:`_postgresql.Insert.on_conflict_do_nothing` and :meth:`_postgresql.Insert.on_conflict_do_update` where the name of a unique constraint passed as the ``constraint`` parameter would not be properly truncated for length if it were based on a naming convention that generated a too-long name for the PostgreSQL max identifier length of 63 characters, in the same way which occurs within a CREATE TABLE statement. .. change:: :tags: bug, sql :tickets: 6710 Fixed issue in CTE constructs where a recursive CTE that referred to a SELECT that has duplicate column names, which are typically deduplicated using labeling logic in 1.4, would fail to refer to the deduplicated label name correctly within the WITH clause. .. change:: :tags: bug, regression, mssql :tickets: 6697 Fixed regression where the special dotted-schema name handling for the SQL Server dialect would not function correctly if the dotted schema name were used within the ``schema_translate_map`` feature. .. change:: :tags: orm, regression :tickets: 6718 Fixed ORM regression where ad-hoc label names generated for hybrid properties and potentially other similar types of ORM-enabled expressions would usually be propagated outwards through subqueries, allowing the name to be retained in the final keys of the result set even when selecting from subqueries. Additional state is now tracked in this case that isn't lost when a hybrid is selected out of a Core select / subquery. .. change:: :tags: bug, postgresql :tickets: 6739 Fixed issue where the PostgreSQL ``ENUM`` datatype as embedded in the ``ARRAY`` datatype would fail to emit correctly in create/drop when the ``schema_translate_map`` feature were also in use. Additionally repairs a related issue where the same ``schema_translate_map`` feature would not work for the ``ENUM`` datatype in combination with a ``CAST``, that's also intrinsic to how the ``ARRAY(ENUM)`` combination works on the PostgreSQL dialect. .. change:: :tags: bug, sql, regression :tickets: 6735 Fixed regression where the :func:`_sql.tablesample` construct would fail to be executable when constructed given a floating-point sampling value not embedded within a SQL function. .. change:: :tags: bug, postgresql :tickets: 6696 Fixed issue in :meth:`_postgresql.Insert.on_conflict_do_nothing` and :meth:`_postgresql.Insert.on_conflict_do_update` where the name of a unique constraint passed as the ``constraint`` parameter would not be properly quoted if it contained characters which required quoting. .. change:: :tags: bug, regression, orm :tickets: 6698 Fixed regression caused in 1.4.19 due to :ticket:`6503` and related involving :meth:`_orm.Query.with_entities` where the new structure used would be inappropriately transferred to an enclosing :class:`_orm.Query` when making use of set operations such as :meth:`_orm.Query.union`, causing the JOIN instructions within to be applied to the outside query as well. .. change:: :tags: bug, orm, regression :tickets: 6762 Fixed regression which appeared in version 1.4.3 due to :ticket:`6060` where rules that limit ORM adaptation of derived selectables interfered with other ORM-adaptation based cases, in this case when applying adaptations for a :func:`_orm.with_polymorphic` against a mapping which uses a :func:`_orm.column_property` which in turn makes use of a scalar select that includes a :func:`_orm.aliased` object of the mapped table. .. changelog:: ``` ### 1.4.20 ``` :released: June 28, 2021 .. change:: :tags: bug, regression, orm :tickets: 6680 Fixed regression in ORM regarding an internal reconstitution step for the :func:`_orm.with_polymorphic` construct, when the user-facing object is garbage collected as the query is processed. The reconstitution was not ensuring the sub-entities for the "polymorphic" case were handled, leading to an ``AttributeError``. .. change:: :tags: usecase, sql :tickets: 6646 Add a impl parameter to :class:`_types.PickleType` constructor, allowing any arbitary type to be used in place of the default implementation of :class:`_types.LargeBinary`. Pull request courtesy jason3gb. .. change:: :tags: bug, engine :tickets: 5348 Fixed an issue in the C extension for the :class:`_result.Row` class which could lead to a memory leak in the unlikely case of a :class:`_result.Row` object which referred to an ORM object that then was mutated to refer back to the ``Row`` itself, creating a cycle. The Python C APIs for tracking GC cycles has been added to the native :class:`_result.Row` implementation to accommodate for this case. .. change:: :tags: bug, engine :tickets: 6665 Fixed old issue where a :func:`_sql.select()` made against the token "*", which then yielded exactly one column, would fail to correctly organize the ``cursor.description`` column name into the keys of the result object. .. change:: :tags: usecase, mysql :tickets: 6659 Made a small adjustment in the table reflection feature of the MySQL dialect to accommodate for alternate MySQL-oriented databases such as TiDB which include their own "comment" directives at the end of a constraint directive within "CREATE TABLE" where the format doesn't have the additional space character after the comment, in this case the TiDB "clustered index" feature. Pull request courtesy Daniël van Eeden. .. change:: :tags: bug, schema :tickets: 6685 Fixed issue where passing ``None`` for the value of :paramref:`_schema.Table.prefixes` would not store an empty list, but rather the constant ``None``, which may be unexpected by third party dialects. The issue is revealed by a usage in recent versions of Alembic that are passing ``None`` for this value. Pull request courtesy Kai Mueller. .. change:: :tags: bug, regression, ext :tickets: 6679 Fixed regression in :mod:`sqlalchemy.ext.automap` extension such that the use case of creating an explicit mapped class to a table that is also the :paramref:`_orm.relationship.secondary` element of a :func:`_orm.relationship` that automap will be generating would emit the "overlaps" warnings introduced in 1.4 and discussed at :ref:`error_qzyx`. While generating this case from automap is still subject to the same caveats that the "overlaps" warning refers towards, as automap is intended for more ad-hoc use cases, the condition which produces the warning is disabled when a many-to-many relationship with this particular pattern is generated. .. change:: :tags: bug, regression, orm :tickets: 6678 Adjusted :meth:`_orm.Query.union` and similar set operations to be correctly compatible with the new capabilities just added in :ticket:`6661`, with SQLAlchemy 1.4.19, such that the SELECT statements rendered as elements of the UNION or other set operation will include directly mapped columns that are mapped as deferred; this both fixes a regression involving unions with multiple levels of nesting that would produce a column mismatch, and also allows the :func:`_orm.undefer` option to be used at the top level of such a :class:`_orm.Query` without having to apply the option to each of the elements within the UNION. .. change:: :tags: bug, sql, orm :tickets: 6668 Fixed the class hierarchy for the :class:`_schema.Sequence` and the more general :class:`_schema.DefaultGenerator` base, as these are "executable" as statements they need to include :class:`_sql.Executable` in their hierarchy, not just :class:`_roles.StatementRole` as was applied arbitrarily to :class:`_schema.Sequence` previously. The fix allows :class:`_schema.Sequence` to work in all ``.execute()`` methods including with :meth:`_orm.Session.execute` which was not working in the case that a :meth:`_orm.SessionEvents.do_orm_execute` handler was also established. .. change:: :tags: bug, orm :tickets: 6538 Adjusted the check in the mapper for a callable object that is used as a ``validates`` validator function or a ``reconstructor`` reconstruction function, to check for "callable" more liberally such as to accommodate objects based on fundamental attributes like ``__func__`` and ``__call___``, rather than testing for ``MethodType`` / ``FunctionType``, allowing things like cython functions to work properly. Pull request courtesy Miłosz Stypiński. .. changelog:: ``` ### 1.4.19 ``` :released: June 22, 2021 .. change:: :tags: bug, mssql :tickets: 6658 Fixed bug where the "schema_translate_map" feature would fail to function correctly in conjunction with an INSERT into a table that has an IDENTITY column, where the value of the IDENTITY column were specified in the values of the INSERT thus triggering SQLAlchemy's feature of setting IDENTITY INSERT to "on"; it's in this directive where the schema translate map would fail to be honored. .. change:: :tags: bug, sql :tickets: 6663 Fixed issue in CTE constructs mostly relevant to ORM use cases where a recursive CTE against "anonymous" labels such as those seen in ORM ``column_property()`` mappings would render in the ``WITH RECURSIVE xyz(...)`` section as their raw internal label and not a cleanly anonymized name. .. change:: :tags: mssql, change :tickets: 6503, 6253 Made improvements to the server version regexp used by the pymssql dialect to prevent a regexp overflow in case of an invalid version string. .. change:: :tags: bug, orm, regression :tickets: 6503, 6253 Fixed further regressions in the same area as that of :ticket:`6052` where loader options as well as invocations of methods like :meth:`_orm.Query.join` would fail if the left side of the statement for which the option/join depends upon were replaced by using the :meth:`_orm.Query.with_entities` method, or when using 2.0 style queries when using the :meth:`_sql.Select.with_only_columns` method. A new set of state has been added to the objects which tracks the "left" entities that the options / join were made against which is memoized when the lead entities are changed. .. change:: :tags: bug, asyncio, postgresql :tickets: 6652 Fixed bug in asyncio implementation where the greenlet adaptation system failed to propagate ``BaseException`` subclasses, most notably including ``asyncio.CancelledError``, to the exception handling logic used by the engine to invalidate and clean up the connection, thus preventing connections from being correctly disposed when a task was cancelled. .. change:: :tags: usecase, asyncio :tickets: 6583 Implemented :class:`_asyncio.async_scoped_session` to address some asyncio-related incompatibilities between :class:`_orm.scoped_session` and :class:`_asyncio.AsyncSession`, in which some methods (notably the :meth:`_asyncio.async_scoped_session.remove` method) should be used with the ``await`` keyword. .. seealso:: :ref:`asyncio_scoped_session` .. change:: :tags: usecase, mysql :tickets: 6132 Added new construct :class:`_mysql.match`, which provides for the full range of MySQL's MATCH operator including multiple column support and modifiers. Pull request courtesy Anton Kovalevich. .. seealso:: :class:`_mysql.match` .. change:: :tags: bug, postgresql, oracle :tickets: 6649 Fixed issue where the ``INTERVAL`` datatype on PostgreSQL and Oracle would produce an ``AttributeError`` when used in the context of a comparison operation against a ``timedelta()`` object. Pull request courtesy MajorDallas. .. change:: :tags: bug, mypy :tickets: 6476 Fixed issue in mypy plugin where class info for a custom declarative base would not be handled correctly on a cached mypy pass, leading to an AssertionError being raised. .. change:: :tags: bug, orm :tickets: 6661 Refined the behavior of ORM subquery rendering with regards to deferred columns and column properties to be more compatible with that of 1.3 while also providing for 1.4's newer features. As a subquery in 1.4 does not make use of loader options, including :func:`_orm.undefer`, a subquery that is against an ORM entity with deferred attributes will now render those deferred attributes that refer directly to mapped table columns, as these are needed in the outer SELECT if that outer SELECT makes use of these columns; however a deferred attribute that refers to a composed SQL expression as we normally do with :func:`_orm.column_property` will not be part of the subquery, as these can be selected explicitly if needed in the subquery. If the entity is being SELECTed from this subquery, the column expression can still render on "the outside" in terms of the derived subquery columns. This produces essentially the same behavior as when working with 1.3. However in this case the fix has to also make sure that the ``.selected_columns`` collection of an ORM-enabled :func:`_sql.select` also follows these rules, which in particular allows recursive CTEs to render correctly in this scenario, which were previously failing to render correctly due to this issue. .. change:: :tags: bug, postgresql :tickets: 6621 Fixed issue where the pool "pre ping" feature would implicitly start a transaction, which would then interfere with custom transactional flags such as PostgreSQL's "read only" mode when used with the psycopg2 driver. .. changelog:: ``` ### 1.4.18 ``` :released: June 10, 2021 .. change:: :tags: bug, orm :tickets: 6072, 6487 Clarified the current purpose of the :paramref:`_orm.relationship.bake_queries` flag, which in 1.4 is to enable or disable "lambda caching" of statements within the "lazyload" and "selectinload" loader strategies; this is separate from the more foundational SQL query cache that is used for most statements. Additionally, the lazy loader no longer uses its own cache for many-to-one SQL queries, which was an implementation quirk that doesn't exist for any other loader scenario. Finally, the "lru cache" warning that the lazyloader and selectinloader strategies could emit when handling a wide array of class/relationship combinations has been removed; based on analysis of some end-user cases, this warning doesn't suggest any significant issue. While setting ``bake_queries=False`` for such a relationship will remove this cache from being used, there's no particular performance gain in this case as using no caching vs. using a cache that needs to refresh often likely still wins out on the caching being used side. .. change:: :tags: bug, asyncio :tickets: 6575 Fixed an issue that presented itself when using the :class:`_pool.NullPool` or the :class:`_pool.StaticPool` with an async engine. This mostly affected the aiosqlite dialect. .. change:: :tags: bug, sqlite, regression :tickets: 6586 The fix for pysqlcipher released in version 1.4.3 :ticket:`5848` was unfortunately non-working, in that the new ``on_connect_url`` hook was erroneously not receiving a ``URL`` object under normal usage of :func:`_sa.create_engine` and instead received a string that was unhandled; the test suite failed to fully set up the actual conditions under which this hook is called. This has been fixed. .. change:: :tags: bug, postgresql, regression :tickets: 6581 Fixed regression where using the PostgreSQL "INSERT..ON CONFLICT" structure would fail to work with the psycopg2 driver if it were used in an "executemany" context along with bound parameters in the "SET" clause, due to the implicit use of the psycopg2 fast execution helpers which are not appropriate for this style of INSERT statement; as these helpers are the default in 1.4 this is effectively a regression. Additional checks to exclude this kind of statement from that particular extension have been added. .. change:: :tags: bug, orm, regression :tickets: 6285 Adjusted the means by which classes such as :class:`_orm.scoped_session` and :class:`_asyncio.AsyncSession` are generated from the base :class:`_orm.Session` class, such that custom :class:`_orm.Session` subclasses such as that used by Flask-SQLAlchemy don't need to implement positional arguments when they call into the superclass method, and can continue using the same argument styles as in previous releases. .. change:: :tags: bug, orm, regression :tickets: 6595 Fixed issue where query production for joinedload against a complex left hand side involving joined-table inheritance could fail to produce a correct query, due to a clause adaption issue. .. change:: :tags: bug, orm, regression, performance :tickets: 6596 Fixed regression involving how the ORM would resolve a given mapped column to a result row, where under cases such as joined eager loading, a slightly more expensive "fallback" could take place to set up this resolution due to some logic that was removed since 1.3. The issue could also cause deprecation warnings involving column resolution to be emitted when using a 1.4 style query with joined eager loading. .. change:: :tags: bug, orm :tickets: 6591 Fixed issue in experimental "select ORM objects from INSERT/UPDATE" use case where an error was raised if the statement were against a single-table-inheritance subclass. .. change:: :tags: bug, asyncio :tickets: 6592 Added ``asyncio.exceptions.TimeoutError``, ``asyncio.exceptions.CancelledError`` as so-called "exit exceptions", a class of exceptions that include things like ``GreenletExit`` and ``KeyboardInterrupt``, which are considered to be events that warrant considering a DBAPI connection to be in an unusable state where it should be recycled. .. change:: :tags: bug, orm :tickets: 6400 The warning that's emitted for :func:`_orm.relationship` when multiple relationships would overlap with each other as far as foreign key attributes written towards, now includes the specific "overlaps" argument to use for each warning in order to silence the warning without changing the mapping. .. change:: :tags: usecase, asyncio :tickets: 6319 Implemented a new registry architecture that allows the ``Async`` version of an object, like ``AsyncSession``, ``AsyncConnection``, etc., to be locatable given the proxied "sync" object, i.e. ``Session``, ``Connection``. Previously, to the degree such lookup functions were used, an ``Async`` object would be re-created each time, which was less than ideal as the identity and state of the "async" object would not be preserved across calls. From there, new helper functions :func:`_asyncio.async_object_session`, :func:`_asyncio.async_session` as well as a new :class:`_orm.InstanceState` attribute :attr:`_orm.InstanceState.async_session` have been added, which are used to retrieve the original :class:`_asyncio.AsyncSession` associated with an ORM mapped object, a :class:`_orm.Session` associated with an :class:`_asyncio.AsyncSession`, and an :class:`_asyncio.AsyncSession` associated with an :class:`_orm.InstanceState`, respectively. This patch also implements new methods :meth:`_asyncio.AsyncSession.in_nested_transaction`, :meth:`_asyncio.AsyncSession.get_transaction`, :meth:`_asyncio.AsyncSession.get_nested_transaction`. .. changelog:: ``` ### 1.4.17 ``` :released: May 29, 2021 .. change:: :tags: bug, orm, regression :tickets: 6558 Fixed regression caused by just-released performance fix mentioned in 6550 where a query.join() to a relationship could produce an AttributeError if the query were made against non-ORM structures only, a fairly unusual calling pattern. .. changelog:: ``` ### 1.4.16 ``` :released: May 28, 2021 .. change:: :tags: bug, engine :tickets: 6482 Fixed issue where an ` sign in the database portion of a URL would not be interpreted correctly if the URL also had a username:password section. .. change:: :tags: bug, ext :tickets: 6529 Fixed a deprecation warning that was emitted when using :func:`_automap.automap_base` without passing an existing ``Base``. .. change:: :tags: bug, pep484 :tickets: 6461 Remove pep484 types from the code. Current effort is around the stub package, and having typing in two places makes thing worse, since the types in the SQLAlchemy source were usually outdated compared to the version in the stubs. .. change:: :tags: usecase, mssql :tickets: 6464 Implemented support for a :class:`_sql.CTE` construct to be used directly as the target of a :func:`_sql.delete` construct, i.e. "WITH ... AS cte DELETE FROM cte". This appears to be a useful feature of SQL Server. .. change:: :tags: bug, general :tickets: 6540, 6543 Resolved various deprecation warnings which were appearing as of Python version 3.10.0b1. .. change:: :tags: bug, orm :tickets: 6471 Fixed issue when using :paramref:`_orm.relationship.cascade_backrefs` parameter set to ``False``, which per :ref:`change_5150` is set to become the standard behavior in SQLAlchemy 2.0, where adding the item to a collection that uniquifies, such as ``set`` or ``dict`` would fail to fire a cascade event if the object were already associated in that collection via the backref. This fix represents a fundamental change in the collection mechanics by introducing a new event state which can fire off for a collection mutation even if there is no net change on the collection; the action is now suited using a new event hook :meth:`_orm.AttributeEvents.append_wo_mutation`. .. change:: :tags: bug, orm, regression :tickets: 6550 Fixed regression involving clause adaption of labeled ORM compound elements, such as single-table inheritance discriminator expressions with conditionals or CASE expressions, which could cause aliased expressions such as those used in ORM join / joinedload operations to not be adapted correctly, such as referring to the wrong table in the ON clause in a join. This change also improves a performance bump that was located within the process of invoking :meth:`_sql.Select.join` given an ORM attribute as a target. .. change:: :tags: bug, orm, regression :tickets: 6495 Fixed regression where the full combination of joined inheritance, global with_polymorphic, self-referential relationship and joined loading would fail to be able to produce a query with the scope of lazy loads and object refresh operations that also attempted to render the joined loader. .. change:: :tags: bug, engine :tickets: 6329 Fixed a long-standing issue with :class:`.URL` where query parameters following the question mark would not be parsed correctly if the URL did not contain a database portion with a backslash. .. change:: :tags: bug, sql, regression :tickets: 6549 Fixed regression in dynamic loader strategy and :func:`_orm.relationship` overall where the :paramref:`_orm.relationship.order_by` parameter were stored as a mutable list, which could then be mutated when combined with additional "order_by" methods used against the dynamic query object, causing the ORDER BY criteria to continue to grow repetitively. .. change:: :tags: bug, orm :tickets: 6484 Enhanced the bind resolution rules for :meth:`_orm.Session.execute` so that when a non-ORM statement such as an :func:`_sql.insert` construct nonetheless is built against ORM objects, to the greatest degree possible the ORM entity will be used to resolve the bind, such as for a :class:`_orm.Session` that has a bind map set up on a common superclass without specific mappers or tables named in the map. .. change:: :tags: bug, regression, ext :tickets: 6390 Fixed regression in the ``sqlalchemy.ext.instrumentation`` extension that prevented instrumentation disposal from working completely. This fix includes both a 1.4 regression fix as well as a fix for a related issue that existed in 1.3 also. As part of this change, the :class:`sqlalchemy.ext.instrumentation.InstrumentationManager` class now has a new method ``unregister()``, which replaces the previous method ``dispose()``, which was not called as of version 1.4. .. changelog:: ``` ### 1.4.15 ``` :released: May 11, 2021 .. change:: :tags: bug, documentation, mysql :tickets: 5397 Added support for the ``ssl_check_hostname=`` parameter in mysql connection URIs and updated the mysql dialect documentation regarding secure connections. Original pull request courtesy of Jerry Zhao. .. change:: :tags: bug, orm, regression :tickets: 6449 Fixed additional regression caused by "eager loaders run on unexpire" feature :ticket:`1763` where the feature would run for a ``contains_eager()`` eagerload option in the case that the ``contains_eager()`` were chained to an additional eager loader option, which would then produce an incorrect query as the original query-bound join criteria were no longer present. .. change:: :tags: feature, general :tickets: 6241 A new approach has been applied to the warnings system in SQLAlchemy to accurately predict the appropriate stack level for each warning dynamically. This allows evaluating the source of SQLAlchemy-generated warnings and deprecation warnings to be more straightforward as the warning will indicate the source line within end-user code, rather than from an arbitrary level within SQLAlchemy's own source code. .. change:: :tags: bug, orm :tickets: 6459 Fixed issue in subquery loader strategy which prevented caching from working correctly. This would have been seen in the logs as a "generated" m