Releases: sqlalchemy/sqlalchemy
2.0.30
2.0.30
Released: May 5, 2024
orm
-
[orm] [bug] Added new attribute
_orm.ORMExecuteState.is_from_statement
to
detect statements created using_sql.Select.from_statement()
, and
enhancedFromStatement
to set_orm.ORMExecuteState.is_select
,
_orm.ORMExecuteState.is_insert
,
_orm.ORMExecuteState.is_update
, and
_orm.ORMExecuteState.is_delete
according to the element that is
sent to the_sql.Select.from_statement()
method itself.References: #11220
-
[orm] [bug] Fixed issue in
_orm.selectin_polymorphic()
loader option where
attributes defined with_orm.composite()
on a superclass would cause
an internal exception on load.References: #11291
-
[orm] [bug] [regression] Fixed regression from 1.4 where using
_orm.defaultload()
in
conjunction with a non-propagating loader like_orm.contains_eager()
would nonetheless propagate the_orm.contains_eager()
to a lazy load
operation, causing incorrect queries as this option is only intended to
come from an original load.References: #11292
-
[orm] [bug] Fixed issue in ORM Annotated Declarative where typing issue where literals
defined using PEP 695 type aliases would not work with inference of
Enum
datatypes. Pull request courtesy of Alc-Alc.References: #11305
-
[orm] [bug] Fixed issue in
_orm.selectin_polymorphic()
loader option where the
SELECT emitted would only accommodate for the child-most class among the
result rows that were returned, leading intermediary-class attributes to be
unloaded if there were no concrete instances of that intermediary-class
present in the result. This issue only presented itself for multi-level
inheritance hierarchies.References: #11327
-
[orm] [bug] Fixed issue in
_orm.Session.bulk_save_objects()
where the form of the
identity key produced when usingreturn_defaults=True
would be
incorrect. This could lead to an errors during pickling as well as identity
map mismatches.References: #11332
-
[orm] [bug] Fixed issue where attribute key names in
_orm.Bundle
would not be
correct when using ORM enabled_sql.select
vs.
_orm.Query
, when the statement contained duplicate column names.References: #11347
engine
-
[engine] [bug] Fixed issue in the
_engine.Connection.execution_options.logging_token
option,
where changing the value oflogging_token
on a connection that has
already logged messages would not be updated to reflect the new logging
token. This in particular prevented the use of
_orm.Session.connection()
to change the option on the connection,
since the BEGIN logging message would already have been emitted.References: #11210
-
[engine] [bug] Fixed issue in cursor handling which affected handling of duplicate
_sql.Column
or similar objcts in the columns clause of
_sql.select()
, both in combination with arbitary_sql.text()
clauses in the SELECT list, as well as when attempting to retrieve
_engine.Result.mappings()
for the object, which would lead to an
internal error.References: #11306
typing
-
[typing] [bug] [regression] Fixed typing regression caused by #11055 in version 2.0.29 that
addedParamSpec
to the asynciorun_sync()
methods, where using
_asyncio.AsyncConnection.run_sync()
with
_schema.MetaData.reflect()
would fail on mypy due to a mypy issue.
Pull request courtesy of Francisco R. Del Roio.References: #11200
-
[typing] [bug] Fixed issue in typing for
_orm.Bundle
where creating a nested
_orm.Bundle
structure were not allowed.
misc
-
[bug] [test] Ensure the
PYTHONPATH
variable is properly initialized when
usingsubprocess.run
in the tests.References: #11268
-
[bug] [installation] Fixed an internal class that was testing for unexpected attributes to work
correctly under upcoming Python 3.13. Pull request courtesy Edgar
Ramรญrez-Mondragรณn.References: #11334
2.0.29
2.0.29
Released: March 23, 2024
orm
-
[orm] [usecase] Added support for the PEP 695
TypeAliasType
construct as well as the
python 3.12 nativetype
keyword to work with ORM Annotated Declarative
form when using these constructs to link to a PEP 593Annotated
container, allowing the resolution of theAnnotated
to proceed when
these constructs are used in a_orm.Mapped
typing container.References: #11130
-
[orm] [bug] Fixed Declarative issue where typing a relationship using
_orm.Relationship
rather than_orm.Mapped
would
inadvertently pull in the "dynamic" relationship loader strategy for that
attribute.References: #10611
-
[orm] [bug] Fixed issue in ORM annotated declarative where using
_orm.mapped_column()
with an_orm.mapped_column.index
or_orm.mapped_column.unique
setting of False would be
overridden by an incomingAnnotated
element that featured that
parameter set toTrue
, even though the immediate
_orm.mapped_column()
element is more specific and should take
precedence. The logic to reconcile the booleans has been enhanced to
accommodate a local value ofFalse
as still taking precedence over an
incomingTrue
value from the annotated element.References: #11091
-
[orm] [bug] [regression] Fixed regression from version 2.0.28 caused by the fix for #11085
where the newer method of adjusting post-cache bound parameter values would
interefere with the implementation for the_orm.subqueryload()
loader
option, which has some more legacy patterns in use internally, when
the additional loader criteria feature were used with this loader option.References: #11173
engine
-
[engine] [bug] Fixed issue in
engine_insertmanyvalues
feature where using a primary
key column with an "inline execute" default generator such as an explicit
Sequence
with an explcit schema name, while at the same time
using the
_engine.Connection.execution_options.schema_translate_map
feature would fail to render the sequence or the parameters properly,
leading to errors.References: #11157
-
[engine] [bug] Made a change to the adjustment made in version 2.0.10 for #9618,
which added the behavior of reconciling RETURNING rows from a bulk INSERT
to the parameters that were passed to it. This behavior included a
comparison of already-DB-converted bound parameter values against returned
row values that was not always "symmetrical" for SQL column types such as
UUIDs, depending on specifics of how different DBAPIs receive such values
versus how they return them, necessitating the need for additional
"sentinel value resolver" methods on these column types. Unfortunately
this broke third party column types such as UUID/GUID types in libraries
like SQLModel which did not implement this special method, raising an error
"Can't match sentinel values in result set to parameter sets". Rather than
attempt to further explain and document this implementation detail of the
"insertmanyvalues" feature including a public version of the new
method, the approach is intead revised to no longer need this extra
conversion step, and the logic that does the comparison now works on the
pre-converted bound parameter value compared to the post-result-processed
value, which should always be of a matching datatype. In the unusual case
that a custom SQL column type that also happens to be used in a "sentinel"
column for bulk INSERT is not receiving and returning the same value type,
the "Can't match" error will be raised, however the mitigation is
straightforward in that the same Python datatype should be passed as that
returned.References: #11160
sql
-
[sql] [bug] [regression] Fixed regression from the 1.4 series where the refactor of the
_types.TypeEngine.with_variant()
method introduced at
change_6980
failed to accommodate for the.copy()
method, which
will lose the variant mappings that are set up. This becomes an issue for
the very specific case of a "schema" type, which includes types such as
Enum
andARRAY
, when they are then used in the context
of an ORM Declarative mapping with mixins where copying of types comes into
play. The variant mapping is now copied as well.References: #11176
typing
-
[typing] [bug] Fixed typing issue allowing asyncio
run_sync()
methods to correctly
type the parameters according to the callable that was passed, making use
of PEP 612ParamSpec
variables. Pull request courtesy Francisco R.
Del Roio.References: #11055
postgresql
-
[postgresql] [usecase] The PostgreSQL dialect now returns
_postgresql.DOMAIN
instances
when reflecting a column that has a domain as type. Previously, the domain
data type was returned instead. As part of this change, the domain
reflection was improved to also return the collation of the text types.
Pull request courtesy of Thomas Stephenson.References: #10693
tests
-
[tests] [bug] Backported to SQLAlchemy 2.0 an improvement to the test suite with regards
to how asyncio related tests are run, now using the newer Python 3.11
asyncio.Runner
or a backported equivalent, rather than relying on the
previous implementation based onasyncio.get_running_loop()
. This
should hopefully prevent issues with large suite runs on CPU loaded
hardware where the event loop seems to become corrupted, leading to
cascading failures.References: #11187
2.0.28
2.0.28
Released: March 4, 2024
orm
-
[orm] [performance] [bug] [regression] Adjusted the fix made in #10570, released in 2.0.23, where new
logic was added to reconcile possibly changing bound parameter values
across cache key generations used within the_orm.with_expression()
construct. The new logic changes the approach by which the new bound
parameter values are associated with the statement, avoiding the need to
deep-copy the statement which can result in a significant performance
penalty for very deep / complex SQL constructs. The new approach no longer
requires this deep-copy step.References: #11085
-
[orm] [bug] [regression] Fixed regression caused by #9779 where using the "secondary" table
in a relationshipand_()
expression would fail to be aliased to match
how the "secondary" table normally renders within a
_sql.Select.join()
expression, leading to an invalid query.References: #11010
engine
-
[engine] [usecase] Added new core execution option
_engine.Connection.execution_options.preserve_rowcount
. When
set, thecursor.rowcount
attribute from the DBAPI cursor will be
unconditionally memoized at statement execution time, so that whatever
value the DBAPI offers for any kind of statement will be available using
the_engine.CursorResult.rowcount
attribute from the
_engine.CursorResult
. This allows the rowcount to be accessed for
statments such as INSERT and SELECT, to the degree supported by the DBAPI
in use. Theengine_insertmanyvalues
also supports this option and
will ensure_engine.CursorResult.rowcount
is correctly set for a
bulk INSERT of rows when set.References: #10974
asyncio
-
[asyncio] [bug] An error is raised if a
QueuePool
or other non-asyncio pool class
is passed to_asyncio.create_async_engine()
. This engine only
accepts asyncio-compatible pool classes including
AsyncAdaptedQueuePool
. Other pool classes such as
NullPool
are compatible with both synchronous and asynchronous
engines as they do not perform any locking.References: #8771
tests
- [tests] [change] pytest support in the tox.ini file has been updated to support pytest 8.1.
1.4.52
1.4.52
Released: March 4, 2024
orm
-
[orm] [bug] Fixed bug where ORM
_orm.with_loader_criteria()
would not apply
itself to a_sql.Select.join()
where the ON clause were given as a
plain SQL comparison, rather than as a relationship target or similar.This is a backport of the same issue fixed in version 2.0 for 2.0.22.
References: #10365
2.0.27
2.0.27
Released: February 13, 2024
postgresql
-
[postgresql] [bug] [regression] Fixed regression caused by just-released fix for #10863 where an
invalid exception class were added to the "except" block, which does not
get exercised unless such a catch actually happens. A mock-style test has
been added to ensure this catch is exercised in unit tests.References: #11005
2.0.26
2.0.26
Released: February 11, 2024
orm
-
[orm] [bug] Replaced the "loader depth is excessively deep" warning with a shorter
message added to the caching badge within SQL logging, for those statements
where the ORM disabled the cache due to a too-deep chain of loader options.
The condition which this warning highlights is difficult to resolve and is
generally just a limitation in the ORM's application of SQL caching. A
future feature may include the ability to tune the threshold where caching
is disabled, but for now the warning will no longer be a nuisance.References: #10896
-
[orm] [bug] Fixed issue where it was not possible to use a type (such as an enum)
within a_orm.Mapped
container type if that type were declared
locally within the class body. The scope of locals used for the eval now
includes that of the class body itself. In addition, the expression within
_orm.Mapped
may also refer to the class name itself, if used as a
string or with future annotations mode.References: #10899
-
[orm] [bug] Fixed issue where using
_orm.Session.delete()
along with the
_orm.Mapper.version_id_col
feature would fail to use the
correct version identifier in the case that an additional UPDATE were
emitted against the target object as a result of the use of
_orm.relationship.post_update
on the object. The issue is
similar to #10800 just fixed in version 2.0.25 for the case of
updates alone.References: #10967
-
[orm] [bug] Fixed issue where an assertion within the implementation for
_orm.with_expression()
would raise if a SQL expression that was not
cacheable were used; this was a 2.0 regression since 1.4.References: #10990
examples
-
[examples] [bug] Fixed regression in history_meta example where the use of
_schema.MetaData.to_metadata()
to make a copy of the history table
would also copy indexes (which is a good thing), but causing naming
conflicts indexes regardless of naming scheme used for those indexes. A
"_history" suffix is now added to these indexes in the same way as is
achieved for the table name.References: #10920
-
[examples] [bug] Fixed the performance example scripts in examples/performance to mostly
work with the Oracle database, by adding theIdentity
construct
to all the tables and allowing primary generation to occur on this backend.
A few of the "raw DBAPI" cases still are not compatible with Oracle.
sql
-
[sql] [bug] Fixed issues in
_sql.case()
where the logic for determining the
type of the expression could result inNullType
if the last
element in the "whens" had no type, or in other cases where the type
could resolve toNone
. The logic has been updated to scan all
given expressions so that the first non-null type is used, as well as
to always ensure a type is present. Pull request courtesy David Evans.References: #10843
typing
- [typing] [bug] Fixed the type signature for the
PoolEvents.checkin()
event to
indicate that the givenDBAPIConnection
argument may beNone
in the case where the connection has been invalidated.
postgresql
-
[postgresql] [usecase] [reflection] Added support for reflection of PostgreSQL CHECK constraints marked with
"NO INHERIT", setting the keyno_inherit=True
in the reflected data.
Pull request courtesy Ellis Valentiner.References: #10777
-
[postgresql] [usecase] Support the
USING <method>
option for PostgreSQLCREATE TABLE
to
specify the access method to use to store the contents for the new table.
Pull request courtesy Edgar Ramรญrez-Mondragรณn.References: #10904
-
[postgresql] [usecase] Correctly type PostgreSQL RANGE and MULTIRANGE types as
Range[T]
andSequence[Range[T]]
.
Introduced utility sequence_postgresql.MultiRange
to allow better
interoperability of MULTIRANGE types.References: #9736
-
[postgresql] [usecase] Differentiate between INT4 and INT8 ranges and multi-ranges types when
inferring the database type from a_postgresql.Range
or
_postgresql.MultiRange
instance, preferring INT4 if the values
fit into it. -
[postgresql] [bug] [regression] Fixed regression in the asyncpg dialect caused by #10717 in
release 2.0.24 where the change that now attempts to gracefully close the
asyncpg connection before terminating would not fall back to
terminate()
for other potential connection-related exceptions other
than a timeout error, not taking into account cases where the graceful
.close()
attempt fails for other reasons such as connection errors.References: #10863
-
[postgresql] [bug] Fixed an issue regarding the use of the
Uuid
datatype with the
Uuid.as_uuid
parameter set to False, when using PostgreSQL
dialects. ORM-optimized INSERT statements (e.g. the "insertmanyvalues"
feature) would not correctly align primary key UUID values for bulk INSERT
statements, resulting in errors. Similar issues were fixed for the
pymssql driver as well.
mysql
-
[mysql] [bug] Fixed issue where NULL/NOT NULL would not be properly reflected from a
MySQL column that also specified the VIRTUAL or STORED directives. Pull
request courtesy Georg Wicke-Arndt.References: #10850
-
[mysql] [bug] Fixed issue in asyncio dialects asyncmy and aiomysql, where their
.close()
method is apparently not a graceful close. replace with
non-standard.ensure_closed()
method that's awaitable and move
.close()
to the so-called "terminate" case.References: #10893
mssql
- [mssql] [bug] Fixed an issue regarding the use of the
Uuid
datatype with the
Uuid.as_uuid
parameter set to False, when using the pymssql
dialect. ORM-optimized INSERT statements (e.g. the "insertmanyvalues"
feature) would not correctly align primary key UUID values for bulk INSERT
statements, resulting in errors. Similar issues were fixed for the
PostgreSQL drivers as well.
oracle
-
[oracle] [performance] [bug] Changed the default arraysize of the Oracle dialects so that the value set
by the driver is used, that is 100 at the time of writing for both
cx_oracle and oracledb. Previously the value was set to 50 by default. The
setting of 50 could cause significant performance regressions compared to
when using cx_oracle/oracledb alone to fetch many hundreds of rows over
slower networks.References: #10877
2.0.25
2.0.25
Released: January 2, 2024
orm
-
[orm] [usecase] Added preliminary support for Python 3.12 pep-695 type alias structures,
when resolving custom type maps for ORM Annotated Declarative mappings.References: #10807
-
[orm] [bug] Fixed issue where when making use of the
_orm.relationship.post_update
feature at the same time as using
a mapper version_id_col could lead to a situation where the second UPDATE
statement emitted by the post-update feature would fail to make use of the
correct version identifier, assuming an UPDATE was already emitted in that
flush which had already bumped the version counter.References: #10800
-
[orm] [bug] Fixed issue where ORM Annotated Declarative would mis-interpret the left
hand side of a relationship without any collection specified as
uselist=True if the left type were given as a class and not a string,
without using future-style annotations.References: #10815
sql
-
[sql] [bug] Improved compilation of
_sql.any_()
/_sql.all_()
in the
context of a negation of boolean comparison, will now renderNOT (expr)
rather than reversing the equality operator to not equals, allowing
finer-grained control of negations for these non-typical operators.References: #10817
typing
-
[typing] [bug] Fixed regressions caused by typing added to the
sqlalchemy.sql.functions
module in version 2.0.24, as part of #6810:- Further enhancements to pep-484 typing to allow SQL functions from `_sql.func` derived elements to work more effectively with ORM-mapped attributes ([#10801](https://www.sqlalchemy.org/trac/ticket/10801)) - Fixed the argument types passed to functions so that literal expressions like strings and ints are again interpreted correctly ([#10818](https://www.sqlalchemy.org/trac/ticket/10818))
asyncio
-
[asyncio] [bug] Fixed critical issue in asyncio version of the connection pool where
calling_asyncio.AsyncEngine.dispose()
would produce a new connection
pool that did not fully re-establish the use of asyncio-compatible mutexes,
leading to the use of a plainthreading.Lock()
which would then cause
deadlocks in an asyncio context when using concurrency features like
asyncio.gather()
.This change is also backported to: 1.4.51
References: #10813
oracle
-
[oracle] [asyncio] Added support for
oracledb
in asyncio mode, using the newly released
version of theoracledb
DBAPI that includes asyncio support. For the
2.0 series, this is a preview release, where the current implementation
does not yet have include support for
_asyncio.AsyncConnection.stream()
. Improved support is planned for
the 2.1 release of SQLAlchemy.References: #10679
1.4.51
1.4.51
Released: January 2, 2024
orm
-
[orm] [bug] Improved a fix first implemented for #3208 released in version
0.9.8, where the registry of classes used internally by declarative could
be subject to a race condition in the case where individual mapped classes
are being garbage collected at the same time while new mapped classes are
being constructed, as can happen in some test suite configurations or
dynamic class creation environments. In addition to the weakref check
already added, the list of items being iterated is also copied first to
avoid "list changed while iterating" errors. Pull request courtesy Yilei
Yang.References: #10782
asyncio
-
[asyncio] [bug] Fixed critical issue in asyncio version of the connection pool where
calling_asyncio.AsyncEngine.dispose()
would produce a new connection
pool that did not fully re-establish the use of asyncio-compatible mutexes,
leading to the use of a plainthreading.Lock()
which would then cause
deadlocks in an asyncio context when using concurrency features like
asyncio.gather()
.References: #10813
mysql
2.0.24
2.0.24
Released: December 28, 2023
orm
-
[orm] [bug] Improved a fix first implemented for #3208 released in version
0.9.8, where the registry of classes used internally by declarative could
be subject to a race condition in the case where individual mapped classes
are being garbage collected at the same time while new mapped classes are
being constructed, as can happen in some test suite configurations or
dynamic class creation environments. In addition to the weakref check
already added, the list of items being iterated is also copied first to
avoid "list changed while iterating" errors. Pull request courtesy Yilei
Yang.This change is also backported to: 1.4.51
References: #10782
-
[orm] [bug] Fixed issue where use of
_orm.foreign()
annotation on a
non-initialized_orm.mapped_column()
construct would produce an
expression without a type, which was then not updated at initialization
time of the actual column, leading to issues such as relationships not
determininguse_get
appropriately.References: #10597
-
[orm] [bug] Improved the error message produced when the unit of work process sets the
value of a primary key column to NULL due to a related object with a
dependency rule on that column being deleted, to include not just the
destination object and column name but also the source column from which
the NULL value is originating. Pull request courtesy Jan Vollmer.References: #10668
-
[orm] [bug] Modified the
__init_subclass__()
method used by
_orm.MappedAsDataclass
,_orm.DeclarativeBase
and
_orm.DeclarativeBaseNoMeta
to accept arbitrary**kw
and to
propagate them to thesuper()
call, allowing greater flexibility in
arranging custom superclasses and mixins which make use of
__init_subclass__()
keyword arguments. Pull request courtesy Michael
Oliver.References: #10732
-
[orm] [bug] Ensured the use case of
Bundle
objects used in the
returning()
portion of ORM-enabled INSERT, UPDATE and DELETE statements
is tested and works fully. This was never explicitly implemented or
tested previously and did not work correctly in the 1.4 series; in the 2.0
series, ORM UPDATE/DELETE with WHERE criteria was missing an implementation
method preventingBundle
objects from working.References: #10776
-
[orm] [bug] Fixed 2.0 regression in
MutableList
where a routine that detects
sequences would not correctly filter out string or bytes instances, making
it impossible to assign a string value to a specific index (while
non-sequence values would work fine).References: #10784
engine
-
[engine] [bug] Fixed URL-encoding of the username and password components of
engine.URL
objects when converting them to string using the
_engine.URL.render_as_string()
method, by using Python standard
libraryurllib.parse.quote
while allowing for plus signs and spaces to
remain unchanged as supported by SQLAlchemy's non-standard URL parsing,
rather than the legacy home-grown routine from many years ago. Pull request
courtesy of Xavier NUNN.References: #10662
sql
-
[sql] [bug] Fixed issue in stringify for SQL elements, where a specific dialect is not
passed, where a dialect-specific element such as the PostgreSQL "on
conflict do update" construct is encountered and then fails to provide for
a stringify dialect with the appropriate state to render the construct,
leading to internal errors.References: #10753
-
[sql] [bug] Fixed issue where stringifying or compiling a
CTE
that was
against a DML construct such as an_sql.insert()
construct would fail
to stringify, due to a mis-detection that the statement overall is an
INSERT, leading to internal errors.
schema
-
[schema] [bug] Fixed issue where error reporting for unexpected schema item when creating
objects like_schema.Table
would incorrectly handle an argument
that was itself passed as a tuple, leading to a formatting error. The
error message has been modernized to use f-strings.References: #10654
typing
-
[typing] [bug] Completed pep-484 typing for the
sqlalchemy.sql.functions
module.
_sql.select()
constructs made againstfunc
elements should now
have filled-in return types.References: #6810
asyncio
- [asyncio] [change] The
async_fallback
dialect argument is now deprecated, and will be
removed in SQLAlchemy 2.1. This flag has not been used for SQLAlchemy's
test suite for some time. asyncio dialects can still run in a synchronous
style by running code within a greenlet using_util.greenlet_spawn()
.
postgresql
-
[postgresql] [bug] Adjusted the asyncpg dialect such that when the
terminate()
method is
used to discard an invalidated connection, the dialect will first attempt
to gracefully close the connection using.close()
with a timeout, if
the operation is proceeding within an async event loop context only. This
allows the asyncpg driver to attend to finalizing aTimeoutError
including being able to close a long-running query server side, which
otherwise can keep running after the program has exited.References: #10717
mysql
-
[mysql] [bug] Fixed regression introduced by the fix in ticket #10492 when using
pool pre-ping with PyMySQL version older than 1.0.This change is also backported to: 1.4.51
References: #10650
-
[mysql] [bug] Fixed regression introduced by the fix in ticket #10492 when using
pool pre-ping with PyMySQL version older than 1.0.This change is also backported to: 1.4.51
References: #10650
tests
-
[tests] [bug] Improvements to the test suite to further harden its ability to run
when Pythongreenlet
is not installed. There is now a tox
target that includes the token "nogreenlet" that will run the suite
with greenlet not installed (note that it still temporarily installs
greenlet as part of the tox config, however).References: #10747
2.0.23
2.0.23
Released: November 2, 2023
orm
-
[orm] [usecase] Implemented the
_orm.Session.bulk_insert_mappings.render_nulls
parameter for new style bulk ORM inserts, allowingrender_nulls=True
as
an execution option. This allows for bulk ORM inserts with a mixture of
None
values in the parameter dictionaries to use a single batch of rows
for a given set of dicationary keys, rather than breaking up into batches
that omit the NULL columns from each INSERT.References: #10575
-
[orm] [bug] Fixed issue where the
__allow_unmapped__
directive failed to allow for
legacyColumn
/deferred()
mappings that nonetheless had
annotations such asAny
or a specific type withoutMapped[]
as
their type, without errors related to locating the attribute name.References: #10516
-
[orm] [bug] Fixed caching bug where using the
_orm.with_expression()
construct in
conjunction with loader options_orm.selectinload()
,
_orm.lazyload()
would fail to substitute bound parameter values
correctly on subsequent caching runs.References: #10570
-
[orm] [bug] Fixed bug in ORM annotated declarative where using a
ClassVar
that
nonetheless referred in some way to an ORM mapped class name would fail to
be interpreted as aClassVar
that's not mapped.References: #10472
sql
-
[sql] [usecase] Implemented "literal value processing" for the
Interval
datatype
for both the PostgreSQL and Oracle dialects, allowing literal rendering of
interval values. Pull request courtesy Indivar Mishra.References: #9737
-
[sql] [bug] Fixed issue where using the same bound parameter more than once with
literal_execute=True
in some combinations with other literal rendering
parameters would cause the wrong values to render due to an iteration
issue.This change is also backported to: 1.4.50
References: #10142
-
[sql] [bug] Added compiler-level None/NULL handling for the "literal processors" of all
datatypes that include literal processing, that is, where a value is
rendered inline within a SQL statement rather than as a bound parameter,
for all those types that do not feature explicit "null value" handling.
Previously this behavior was undefined and inconsistent.References: #10535
-
[sql] Removed unused placeholder method
TypeEngine.compare_against_backend()
This method was used by very old versions of Alembic.
See sqlalchemy/alembic#1293 for details.
asyncio
-
[asyncio] [bug] Fixed bug with method
_asyncio.AsyncSession.close_all()
that was not working correctly.
Also added function_asyncio.close_all_sessions()
that's
the equivalent of_orm.close_all_sessions()
.
Pull request courtesy of Bryanไธๅฏๆ่ฎฎ.References: #10421
postgresql
-
[postgresql] [bug] Fixed 2.0 regression caused by #7744 where chains of expressions
involving PostgreSQL JSON operators combined with other operators such as
string concatenation would lose correct parenthesization, due to an
implementation detail specific to the PostgreSQL dialect.References: #10479
-
[postgresql] [bug] Fixed SQL handling for "insertmanyvalues" when using the
postgresql.BIT
datatype with the asyncpg backend. The
postgresql.BIT
on asyncpg apparently requires the use of an
asyncpg-specificBitString
type which is currently exposed when using
this DBAPI, making it incompatible with other PostgreSQL DBAPIs that all
work with plain bitstrings here. A future fix in version 2.1 will
normalize this datatype across all PG backends. Pull request courtesy
Sรถren Oldag.References: #10532
mysql
-
[mysql] [bug] Repaired a new incompatibility in the MySQL "pre-ping" routine where the
False
argument passed toconnection.ping()
, which is intended to
disable an unwanted "automatic reconnect" feature, is being deprecated in
MySQL drivers and backends, and is producing warnings for some versions of
MySQL's native client drivers. It's removed for mysqlclient, whereas for
PyMySQL and drivers based on PyMySQL, the parameter will be deprecated and
removed at some point, so API introspection is used to future proof against
these various stages of removal.This change is also backported to: 1.4.50
References: #10492
mariadb
-
[mariadb] [bug] Adjusted the MySQL / MariaDB dialects to default a generated column to NULL
when using MariaDB, if_schema.Column.nullable
was not
specified with an explicitTrue
orFalse
value, as MariaDB does not
support the "NOT NULL" phrase with a generated column. Pull request
courtesy Indivar.References: #10056
-
[mariadb] [bug] [regression] Established a workaround for what seems to be an intrinsic issue across
MySQL/MariaDB drivers where a RETURNING result for DELETE DML which returns
no rows using SQLAlchemy's "empty IN" criteria fails to provide a
cursor.description, which then yields result that returns no rows,
leading to regressions for the ORM that in the 2.0 series uses RETURNING
for bulk DELETE statements for the "synchronize session" feature. To
resolve, when the specific case of "no description when RETURNING was
given" is detected, an "empty result" with a correct cursor description is
generated and used in place of the non-working cursor.References: #10505
mssql
-
[mssql] [usecase] Added support for the
aioodbc
driver implemented for SQL Server,
which builds on top of the pyodbc and general aio* dialect architecture.References: #6521
-
[mssql] [bug] [reflection] Fixed issue where identity column reflection would fail
for a bigint column with a large identity start value
(more than 18 digits).This change is also backported to: 1.4.50
References: #10504
oracle
-
[oracle] [bug] Fixed issue in
Interval
datatype where the Oracle implementation
was not being used for DDL generation, leading to theday_precision
and
second_precision
parameters to be ignored, despite being supported by
this dialect. Pull request courtesy Indivar.References: #10509
-
[oracle] [bug] Fixed issue where the cx_Oracle dialect claimed to support a lower
cx_Oracle version (7.x) than was actually supported in practice within the
2.0 series of SQLAlchemy. The dialect imports symbols that are only in
cx_Oracle 8 or higher, so runtime dialect checks as well as setup.cfg
requirements have been updated to reflect this compatibility.References: #10470