gives application developers the full power and flexibility of SQL.
2026-05-25 09:06:23 by Adam Ciarcinski | Files touched by this commit (2) |  |
Log message:
py-sqlalchemy: updated to 2.0.50
2.0.50
orm
[orm] [bug]
Fixed issue where using joinedload() with PropComparator.of_type() targeting a \
joined-table subclass combined with PropComparator.and_() referencing a column \
on that subclass would generate invalid SQL, where the subclass column was not \
adapted to the subquery alias. Pull request courtesy Joaquin Hui Gomez.
[orm] [bug]
Fixed issue where the presence of a SessionEvents.do_orm_execute() event hook \
would cause internal execution options such as yield_per and loader-specific \
state from the first orm_pre_session_exec pass to leak into the second pass, \
leading to errors when using relationship loaders such as selectinload() and \
immediateload(). The execution options passed to the second compilation pass are \
now based on the original options plus only the explicit updates made via \
ORMExecuteState.update_execution_options() within the event hook.
[orm] [bug]
Fixed issue where using with_polymorphic() on a leaf class (a subclass with no \
further descendants) or a non-inherited class would fail with an AttributeError \
when used in an ORM statement, due to configure_mappers() not being triggered \
implicitly. The fix ensures that AliasedInsp participates in the _post_inspect \
hook, triggering mapper configuration during ORM statement compilation.
sql
[sql] [bug]
Fixed issue where floor division (//) between a Float or Numeric numerator and \
an Integer denominator would omit the FLOOR() SQL wrapper on dialects where \
Dialect.div_is_floordiv is True (the default, including PostgreSQL and SQLite). \
FLOOR() is now applied if either the denominator or the numerator is a \
non-integer, so that expressions such as float_col // int_col render as \
FLOOR(float_col / int_col) instead of the incorrect float_col / int_col. Pull \
request courtesy r266-tech.
postgresql
[postgresql] [bug]
Improve handling of two phase transaction identifiers for PostgreSQL when the \
identifier is provided by the user. As part of this change the psycopg dialect \
was updated to use the DBAPI two phase transaction API instead of executing the \
SQL directly.
[postgresql] [bug]
Fixed issue where the asyncpg driver could throw an insufficiently-handled \
exception InternalClientError under some circumstances, leading to connections \
not being properly marked as invalidated.
[postgresql] [bug]
Fixed issue where the ExcludeConstraint construct did not correctly forward the \
ExcludeConstraint.info parameter to the superclass, causing user-defined \
metadata to be lost. Pull request courtesy Wiktor Byrka.
mysql
[mysql] [bug] [reflection]
Narrowed the scope of the internal workaround for MySQL bugs 88718 and 96365 so \
that it is only applied where needed: MySQL 8.0.1 through 8.0.13 (where bug \
88718 is present), and on systems with lower_case_table_names=2 (where bug 96365 \
applies, typically macOS). Previously the workaround was applied unconditionally \
for all MySQL 8.0+ versions, which caused a KeyError during foreign key \
reflection when the database user lacked SELECT privileges on referred tables.
[mysql] [bug]
Fixed issue in aiomysql and asyncmy dialects that appears as of using pymysql \
1.2.0; the dialects were not properly taking into account logic that detects the \
argument signature of pymysql’s ping() method which was added as part of \
10492.
sqlite
[sqlite] [bug]
Escape key and pragma values when utilizing the pysqlcipher dialect.
|
2026-04-16 09:29:17 by Adam Ciarcinski | Files touched by this commit (2) |  |
Log message:
py-sqlalchemy: updated to 2.0.49
2.0.49
orm
[orm] [bug]
Fixed issue where Session.get() would bypass the identity map and emit \
unnecessary SQL when with_for_update=False was passed, rather than treating it \
equivalently to the default of None. Pull request courtesy of Joshua Swanson.
[orm] [bug]
Fixed issue where chained joinedload() options would not be applied correctly \
when the final relationship in the chain is declared on a base mapper and \
accessed through a subclass mapper in a with_polymorphic() query. The path \
registry now correctly computes the natural path when a property declared on a \
base class is accessed through a path containing a subclass mapper, ensuring the \
loader option can be located during query compilation.
[orm] [bug] [inheritance]
Fixed issue where using Load.options() to apply a chained loader option such as \
joinedload() or selectinload() with PropComparator.of_type() for a polymorphic \
relationship would not generate the necessary clauses for the polymorphic \
subclasses. The polymorphic loading strategy is now correctly propagated when \
using a call such as joinedload(A.b).options(joinedload(B.c.of_type(poly))) to \
match the behavior of direct chaining e.g. \
joinedload(A.b).joinedload(B.c.of_type(poly)).
[orm] [bug] [inheritance]
Fixed issue where using chained loader options such as selectinload() after \
joinedload() with PropComparator.of_type() for a polymorphic relationship would \
not properly apply the chained loader option. The loader option is now correctly \
applied when using a call such as \
joinedload(A.b.of_type(poly)).selectinload(poly.SubClass.c) to eagerly load \
related objects.
typing
[typing] [bug]
Fixed a typing issue where the typed members of func would return the \
appropriate class of the same name, however this creates an issue for \
typecheckers such as Zuban and pyrefly that assume PEP 749 style typechecking \
even if the file states that it’s a PEP 563 file; they see the returned name \
as indicating the method object and not the class object. These typecheckers are \
actually following along with an upcoming test harness that insists on PEP 749 \
style name resolution for this case unconditionally. Since PEP 749 is the way of \
the future regardless, differently-named type aliases have been added for these \
return types.
postgresql
[postgresql] [bug]
Fixed regular expression used when reflecting foreign keys in PostgreSQL to \
support escaped quotes in table names. Pull request courtesy of Austin Graham
mssql
[mssql] [usecase]
Enhanced the aioodbc dialect to expose the fast_executemany attribute of the \
pyodbc cursor. This allows the fast_executemany parameter to work with the \
mssql+aioodbc dialect. Pull request courtesy Georg Sieber.
[mssql] [usecase]
Remove warning for SQL Server dialect when a new version is detected. The \
warning was originally added more than 15 years ago due to an unexpected value \
returned when using an old version of FreeTDS. The assumption is that since then \
the issue has been resolved, so make the SQL Server dialect behave like the \
other ones that don’t have an upper bound check on the version number.
[mssql] [bug] [reflection]
Fixed regression from version 2.0.42 caused by 12654 where the updated column \
reflection query would receive SQL Server “type alias” names for special \
types such as sysname, whereas previously the base name would be received (e.g. \
nvarchar for sysname), leading to warnings that such types could not be \
reflected and resulting in NullType, rather than the expected NVARCHAR for a \
type like sysname. The column reflection query now joins sys.types a second time \
to look up the base type when the user type name is not present in \
MSDialect.ischema_names, and both names are checked in MSDialect.ischema_names \
for a match. Pull request courtesy Carlos Serrano.
oracle
[oracle] [bug]
Fixed issue in Oracle dialect where the RAW datatype would not reflect the \
length parameter. Pull request courtesy Daniel Sullivan.
|
2026-03-04 06:46:27 by Adam Ciarcinski | Files touched by this commit (2) |  |
Log message:
py-sqlalchemy: updated to 2.0.48
2.0.48
engine
[engine] [bug]
Fixed a critical issue in Engine where connections created in conjunction with \
the DialectEvents.do_connect() event listeners would receive shared, mutable \
collections for the connection arguments, leading to a variety of potential \
issues including unlimited growth of the argument list as well as elements \
within the parameter dictionary being shared among concurrent connection calls. \
In particular this could impact do_connect routines making use of complex \
mutable authentication structures.
|
2026-02-24 20:40:24 by Adam Ciarcinski | Files touched by this commit (2) |  |
Log message:
py-sqlalchemy: updated to 2.0.47
2.0.47
orm
[orm] [bug]
Fixed issue when using ORM mappings with Python 3.14’s PEP 649 feature that no \
longer requires “future annotations”, where the ORM’s introspection of the \
__init__ method of mapped classes would fail if non-present identifiers in \
annotations were present. The vendored getfullargspec() method has been amended \
to use Format.FORWARDREF under Python 3.14 to prevent resolution of names that \
aren’t present.
engine
[engine] [usecase]
The connection object returned by Engine.raw_connection() now supports the \
context manager protocol, automatically returning the connection to the pool \
when exiting the context.
postgresql
[postgresql] [bug]
Fixed an issue in the PostgreSQL dialect where foreign key constraint reflection \
would incorrectly swap or fail to capture onupdate and ondelete values when \
these clauses appeared in a different order than expected in the constraint \
definition. This issue primarily affected PostgreSQL-compatible databases such \
as CockroachDB, which may return ON DELETE before ON UPDATE in the constraint \
definition string. The reflection logic now correctly parses both clauses \
regardless of their ordering.
[postgresql] [bug]
Fixed issue in the “Insert Many Values” Behavior for INSERT statements \
feature where using PostgreSQL’s ON CONFLICT clause with \
Insert.returning.sort_by_parameter_order enabled would generate invalid SQL when \
the insert used an implicit sentinel (server-side autoincrement primary key). \
The generated SQL would incorrectly declare a sentinel counter column in the \
imp_sen table alias without providing corresponding values in the VALUES clause, \
leading to a ProgrammingError indicating column count mismatch. The fix allows \
batch execution mode when embed_values_counter is active, as the embedded \
counter provides the ordering capability needed even with upsert behaviors, \
rather than unnecessarily downgrading to row-at-a-time execution.
[postgresql] [bug]
Fixed issue where Insert.on_conflict_do_update() parameters were not respecting \
compilation options such as literal_binds=True. Pull request courtesy Loïc \
Simon.
[postgresql] [bug]
Fixed issue where Insert.on_conflict_do_update() using parametrized bound \
parameters in the set_ clause would fail when used with executemany batching. \
For dialects that use the use_insertmanyvalues_wo_returning optimization \
(psycopg2), insertmanyvalues is now disabled when there is an ON CONFLICT \
clause. For cases with RETURNING, row-at-a-time mode is used when the SET clause \
contains parametrized bindparams (bindparams that receive values from the \
parameters dict), ensuring each row’s parameters are correctly applied. ON \
CONFLICT statements using expressions like excluded.<column> continue to \
batch normally.
mysql
[mysql] [bug]
Fixed issue where DDL compilation options were registered to the hard-coded \
dialect name mysql. This made it awkward for MySQL-derived dialects like \
MariaDB, StarRocks, etc. to work with such options when different sets of \
options exist for different platforms. Options are now registered under the \
actual dialect name, and a fallback was added to help avoid errors when an \
option does not exist for that dialect.
To maintain backwards compatibility, when using the MariaDB dialect with the \
options mysql_with_parser or mysql_using without also specifying the \
corresponding mariadb_ prefixed options, a deprecation warning will be emitted. \
The mysql_ prefixed options will continue to work during the deprecation period. \
Users should update their code to additionally specify mariadb_with_parser and \
mariadb_using when using the mariadb:// dialect, or specify both options to \
support both dialects.
Pull request courtesy Tiansu Yu.
sqlite
[sqlite] [bug]
Fixed issue where Insert.on_conflict_do_update() parameters were not respecting \
compilation options such as literal_binds=True. Pull request courtesy Loïc \
Simon.
[sqlite] [bug]
Fixed issue where Insert.on_conflict_do_update() using parametrized bound \
parameters in the set_ clause would fail when used with executemany batching. \
Row-at-a-time mode is now used for ON CONFLICT statements with RETURNING that \
contain parametrized bindparams, ensuring each row’s parameters are correctly \
applied. ON CONFLICT statements using expressions like excluded.<column> \
continue to batch normally.
|
2026-01-25 14:16:10 by Adam Ciarcinski | Files touched by this commit (2) |  |
Log message:
py-sqlalchemy: updated to 2.0.46
2.0.46
typing
[typing] [bug]
Fixed typing issues where ORM mapped classes and aliased entities could not be \
used as keys in result row mappings or as join targets in select statements. \
Patterns such as row._mapping[User], row._mapping[aliased(User)], \
row._mapping[with_polymorphic(...)] (rejected by both mypy and Pylance), and \
.join(aliased(User)) (rejected by Pylance) are documented and fully supported at \
runtime but were previously rejected by type checkers. The type definitions for \
_KeyType and _FromClauseArgument have been updated to accept these ORM entity \
types.
postgresql
[postgresql] [bug]
Fixed issue where PostgreSQL JSONB operators Comparator.path_match() and \
Comparator.path_exists() were applying incorrect VARCHAR casts to the right-hand \
side operand when used with newer PostgreSQL drivers such as psycopg. The \
operators now indicate the right-hand type as JSONPATH, which currently results \
in no casting taking place, but is also compatible with explicit casts if the \
implementation were require it at a later point.
[postgresql] [bug]
Fixed regression in PostgreSQL dialect where JSONB subscription syntax would \
generate incorrect SQL for cast() expressions returning JSONB, causing syntax \
errors. The dialect now properly wraps cast expressions in parentheses when \
using the [] subscription syntax, generating (CAST(...))[index] instead of \
CAST(...)[index] to comply with PostgreSQL syntax requirements. This extends the \
fix from 12778 which addressed the same issue for function calls.
[postgresql] [bug]
Improved the foreign key reflection regular expression pattern used by the \
PostgreSQL dialect to be more permissive in matching identifier characters, \
allowing it to correctly handle unicode characters in table and column names. \
This change improves compatibility with PostgreSQL variants such as CockroachDB \
that may use different quoting patterns in combination with unicode characters \
in their identifiers. Pull request courtesy Gord Thompson.
mariadb
[mariadb] [bug]
Fixed the SQL compilation for the mariadb sequence “NOCYCLE” keyword that is \
to be emitted when the Sequence.cycle parameter is set to False on a Sequence. \
Pull request courtesy Diego Dupin.
sqlite
[sqlite] [bug]
Fixed issue in the aiosqlite driver where SQLAlchemy’s setting of \
aiosqlite’s worker thread to “daemon” stopped working because the \
aiosqlite architecture moved the location of the worker thread in version \
0.22.0. This “daemon” flag is necessary so that a program is able to exit if \
the SQLite connection itself was not explicitly closed, which is particularly \
likely with SQLAlchemy as it maintains SQLite connections in a connection pool. \
While it’s perfectly fine to call AsyncEngine.dispose() before program exit, \
this is not historically or technically necessary for any driver of any known \
backend, since a primary feature of relational databases is durability. The \
change also implements support for “terminate” with aiosqlite when using \
version version 0.22.1 or greater, which implements a sync .stop() method.
mssql
[mssql] [usecase]
Added support for the IF EXISTS clause when dropping indexes on SQL Server 2016 \
(13.x) and later versions. The DropIndex.if_exists parameter is now honored by \
the SQL Server dialect, allowing conditional index drops that will not raise an \
error if the index does not exist. Pull request courtesy Edgar Ramírez \
Mondragón.
|
2025-12-11 16:21:27 by Adam Ciarcinski | Files touched by this commit (2) |  |
Log message:
py-sqlalchemy: updated to 2.0.45
2.0.45
orm
[orm] [bug]
Fixed issue where calling Mapper.add_property() within mapper event hooks such \
as MapperEvents.instrument_class(), MapperEvents.after_mapper_constructed(), or \
MapperEvents.before_mapper_configured() would raise an AttributeError because \
the mapper’s internal property collections were not yet initialized. The \
Mapper.add_property() method now handles early-stage property additions \
correctly, allowing properties including column properties, deferred columns, \
and relationships to be added during mapper initialization events. Pull request \
courtesy G Allajmi.
[orm] [bug]
Fixed issue in Python 3.14 where dataclass transformation would fail when a \
mapped class using MappedAsDataclass included a relationship() referencing a \
class that was not available at runtime (e.g., within a TYPE_CHECKING block). \
This occurred when using Python 3.14’s PEP 649 deferred annotations feature, \
which is the default behavior without a from __future__ import annotations \
directive.
examples
[examples] [bug]
Fixed the “short_selects” performance example where the cache was being used \
in all the examples, making it impossible to compare performance with and \
without the cache. Less important comparisons like “lambdas” and “baked \
queries” have been removed.
sql
[sql] [bug]
Some improvements to the ClauseElement.params() method to replace bound \
parameters in a query were made, however the ultimate issue in 12915 involving \
ORM aliased() cannot be fixed fully until 2.1, where the method is being \
rewritten to work without relying on Core cloned traversal.
[sql] [bug]
Fixed issue where using the ColumnOperators.in_() operator with a nested \
CompoundSelect statement (e.g. an INTERSECT of UNION queries) would raise a \
NotImplementedError when the nested compound select was the first argument to \
the outer compound select. The _scalar_type() internal method now properly \
handles nested compound selects.
typing
[typing] [bug]
Fixed typing issue where Select.with_for_update() would not support lists of ORM \
entities or other FROM clauses in the Select.with_for_update.of parameter. Pull \
request courtesy Shamil.
[typing] [bug]
Fixed typing issue where coalesce would not return the correct return type when \
a nullable form of that argument were passed, even though this function is meant \
to select the non-null entry among possibly null arguments. Pull request \
courtesy Yannick PÉROUX.
postgresql
[postgresql] [usecase]
Added support for reflection of collation in types for PostgreSQL. The collation \
will be set only if different from the default one for the type. Pull request \
courtesy Denis Laxalde.
[postgresql] [bug]
Fixed issue where PostgreSQL dialect options such as postgresql_include on \
PrimaryKeyConstraint and UniqueConstraint were rendered in the wrong position \
when combined with constraint deferrability options like deferrable=True. Pull \
request courtesy G Allajmi.
[postgresql] [bug]
Fixed the structure of the SQL string used for the “Insert Many Values” \
Behavior for INSERT statements feature when an explicit sequence with nextval() \
is used. The SQL function invocation for the sequence has been moved from being \
rendered inline within each tuple inside of VALUES to being rendered once in the \
SELECT that reads from VALUES. This change ensures the function is invoked in \
the correct order as rows are processed, rather than assuming PostgreSQL will \
execute inline function calls within VALUES in a particular order. While current \
PostgreSQL versions appear to handle the previous approach correctly, the \
database does not guarantee this behavior for future versions.
mysql
[mysql] [usecase]
Added support for MySQL 8.0.1 + FOR SHARE to be emitted for the \
Select.with_for_update() method, which offers compatibility with NOWAIT and SKIP \
LOCKED. The new syntax is used only for MySQL when version 8.0.1 or higher is \
detected. Pull request courtesy JetDrag.
sqlite
[sqlite] [bug] [reflection]
A series of improvements have been made for reflection of CHECK constraints on \
SQLite. The reflection logic now correctly handles table names containing the \
strings “CHECK” or “CONSTRAINT”, properly supports all four SQLite \
identifier quoting styles (double quotes, single quotes, brackets, and \
backticks) for constraint names, and accurately parses CHECK constraint \
expressions containing parentheses within string literals using balanced \
parenthesis matching with string context tracking. Big thanks to GruzdevAV for \
new test cases and implementation ideas.
[sqlite] [bug]
Fixed issue where SQLite dialect would fail to reflect constraint names that \
contained uppercase letters or other characters requiring quoting. The regular \
expressions used to parse primary key, foreign key, and unique constraint names \
from the CREATE TABLE statement have been updated to properly handle both quoted \
and unquoted constraint names.
tests
[tests] [change]
A noxfile.py has been added to allow testing with nox. This is a direct port of \
2.1’s move to nox, however leaves the tox.ini file in place and retains all \
test documentation in terms of tox. Version 2.1 will move to nox fully, \
including deprecation warnings for tox and new testing documentation.
|
2025-10-23 17:38:22 by Adam Ciarcinski | Files touched by this commit (2) |  |
Log message:
py-sqlalchemy: updated to 2.0.44
2.0.44
platform
[platform] [bug]
Unblocked automatic greenlet installation for Python 3.14 now that there are \
greenlet wheels on pypi for python 3.14.
orm
[orm] [usecase]
The way ORM Annotated Declarative interprets Python PEP 695 type aliases in \
Mapped[] annotations has been refined to expand the lookup scheme. A PEP 695 \
type can now be resolved based on either its direct presence in \
registry.type_annotation_map or its immediate resolved value, as long as a \
recursive lookup across multiple PEP 695 types is not required for it to \
resolve. This change reverses part of the restrictions introduced in 2.0.37 as \
part of 11955, which deprecated (and disallowed in 2.1) the ability to resolve \
any PEP 695 type that was not explicitly present in \
registry.type_annotation_map. Recursive lookups of PEP 695 types remains \
deprecated in 2.0 and disallowed in version 2.1, as do implicit lookups of \
NewType types without an entry in registry.type_annotation_map.
engine
[engine] [bug]
Implemented initial support for free-threaded Python by adding new tests and \
reworking the test harness to include Python 3.13t and Python 3.14t in test \
runs. Two concurrency issues have been identified and fixed: the first involves \
initialization of the .c collection on a FromClause, a continuation of 12302, \
where an optional mutex under free-threading is added; the second involves \
synchronization of the pool “first_connect” event, which first received \
thread synchronization in 2964, however under free-threading the creation of the \
mutex itself runs under the same free-threading mutex. Support for free-threaded \
wheels on Pypi is implemented as well within the 2.1 series only. Initial pull \
request and test suite courtesy Lysandros Nikolaou.
sql
[sql] [bug]
Improved the implementation of UpdateBase.returning() to use more robust logic \
in setting up the .c collection of a derived statement such as a CTE. This fixes \
issues related to RETURNING clauses that feature expressions based on returned \
columns with or without qualifying labels.
schema
[schema] [bug]
Fixed issue where MetaData.reflect() did not forward dialect-specific keyword \
arguments to the Inspector methods, causing options like oracle_resolve_synonyms \
to be ignored during reflection. The method now ensures that all extra kwargs \
passed to MetaData.reflect() are forwarded to Inspector.get_table_names() and \
related reflection methods. Pull request courtesy Lukáš Kožušník.
typing
[typing] [bug]
Fixed typing bug where the Session.execute() method advertised that it would \
return a CursorResult if given an insert/update/delete statement. This is not \
the general case as several flavors of ORM insert/update do not actually yield a \
CursorResult which cannot be differentiated at the typing overload level, so the \
method now yields Result in all cases. For those cases where CursorResult is \
known to be returned and the .rowcount attribute is required, please use \
typing.cast().
[typing] [bug]
Added new decorator mapped_as_dataclass(), which is a function based form of \
registry.mapped_as_dataclass(); the method form registry.mapped_as_dataclass() \
does not seem to be correctly recognized within the scope of PEP 681 in recent \
mypy versions.
postgresql
[postgresql] [bug]
Fixed issue where selecting an enum array column containing NULL values would \
fail to parse properly in the PostgreSQL dialect. The _split_enum_values() \
function now correctly handles NULL entries by converting them to Python None \
values.
sqlite
[sqlite] [bug]
Fixed issue where SQLite table reflection would fail for tables using WITHOUT \
ROWID and/or STRICT table options when the table contained generated columns. \
The regular expression used to parse CREATE TABLE statements for generated \
column detection has been updated to properly handle these SQLite table options \
that appear after the column definitions. Pull request courtesy Tip ten Brink.
mssql
[mssql] [bug]
Improved the base implementation of the asyncio cursor such that it includes the \
option for the underlying driver’s cursor to be actively closed in those cases \
where it requires await in order to complete the close sequence, rather than \
relying on garbage collection to “close” it, when a plain Result is returned \
that does not use await for any of its methods. The previous approach of relying \
on gc was fine for MySQL and SQLite dialects but has caused problems with the \
aioodbc implementation on top of SQL Server. The new option is enabled for those \
dialects which have an “awaitable” cursor.close(), which includes the \
aioodbc, aiomysql, and asyncmy dialects (aiosqlite is also modified for 2.1 \
only).
[mssql] [bug]
Fixed issue where the index reflection for SQL Server would not correctly return \
the order of the column inside an index when the order of the columns in the \
index did not match the order of the columns in the table. Pull request courtesy \
of Allen Chen.
[mssql] [bug] [reflection]
Fixed issue in the MSSQL dialect’s foreign key reflection query where \
duplicate rows could be returned when a foreign key column and its referenced \
primary key column have the same name, and both the referencing and referenced \
tables have indexes with the same name. This resulted in an \
“ForeignKeyConstraint with duplicate source column references are not \
supported” error when attempting to reflect such tables. The query has been \
corrected to exclude indexes on the child table when looking for unique indexes \
referenced by foreign keys.
misc
[bug] [ext]
Fixed issue caused by an unwanted functional change while typing the MutableList \
class. This change also reverts all other functional changes done in the same \
change.
|
| 2025-10-09 09:58:14 by Thomas Klausner | Files touched by this commit (442) |
Log message:
*: remove reference to (removed) Python 3.9
|