SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 
Changelog for python312-SQLAlchemy1-1.4.54-21.10.i586.rpm :

* Thu Sep 19 2024 Steve Kowalik - Update to 1.4.54:
* Fixed regression from 1.3 where the column key used for a hybrid property might be populated with that of the underlying column that it returns.
* The pin for ``setuptools<69.3`` in ``pyproject.toml`` has been removed.
* Set up full Python 3.13 support to the extent currently possible, repairing issues within internal language helpers as well as the serializer extension module.
* Adjustments to the C extensions, which are specific to the SQLAlchemy 1.x series, to work under Python 3.13.
* Fixed regression going back to 1.4 where accessing a collection using the \"dynamic\" strategy on a transient object and attempting to query would raise an internal error.
* Fixed bug where ORM :func:`_orm.with_loader_criteria` would not apply itself to a :meth:`_sql.Select.join` where the ON clause were given as a plain SQL comparison, rather than as a relationship target or similar.
* Fixed regression introduced by the fix when using pool pre-ping with PyMySQL version older than 1.0.
* Fixed critical issue in asyncio version of the connection pool where calling :meth:`_asyncio.AsyncEngine.dispose` would produce a new connection pool that did not fully re-establish the use of asyncio-compatible mutexes
* Fixed fundamental issue which prevented some forms of ORM \"annotations\" from taking place for subqueries which made use of :meth:`_sql.Select.join` against a relationship target
* Repaired a new incompatibility in the MySQL \"pre-ping\" routine where the ``False`` argument passed to ``connection.ping()``, which is intended to disable an unwanted \"automatic reconnect\" feature- Switch to pyproject macros.
* Mon Sep 25 2023 Ondřej Súkup - update to 1.4.49
* support for python3.12
* see https://docs.sqlalchemy.org/en/20/changelog/changelog_14.html#change-1.4.49
* Tue May 09 2023 Dominique Leuenberger - Properly advertise this package also as python-SQLAlchemy.
* Sat May 06 2023 Dirk Müller - remove parallel testing, too unstable- readd provides which is needed to select between 1.x and 2.x
* Thu May 04 2023 Dirk Müller - rename to SQLAlchemy1
* Fri Apr 21 2023 Dirk Müller - add sle15_python_module_pythons (jsc#PED-68)
* Thu Apr 13 2023 Matej Cepl - Make calling of %{sle15modernpython} optional.
* Wed Feb 15 2023 Dirk Müller - update to 1.4.46:
* A new deprecation “uber warning” is now emitted at runtime the first time any SQLAlchemy 2.0 deprecation warning would normally be emitted, but the SQLALCHEMY_WARN_20 environment variable is not set. see https://docs.sqlalchemy.org/en/20/changelog/changelog_14.html#change-1.4.46
* Mon Jan 02 2023 Dirk Müller - update to 1.4.45: see https://docs.sqlalchemy.org/en/20/changelog/changelog_14.html#change-1.4.45
* Sat Oct 22 2022 Arun Persaud - update to version 1.4.42:
* orm + The Session.execute.bind_arguments dictionary is no longer mutated when passed to Session.execute() and similar; instead, it’s copied to an internal dictionary for state changes. Among other things, this fixes and issue where the “clause” passed to the Session.get_bind() method would be incorrectly referring to the Select construct used for the “fetch” synchronization strategy, when the actual query being emitted was a Delete or Update. This would interfere with recipes for “routing sessions”. References: #8614 + A warning is emitted in ORM configurations when an explicit remote() annotation is applied to columns that are local to the immediate mapped class, when the referenced class does not include any of the same table columns. Ideally this would raise an error at some point as it’s not correct from a mapping point of view. References: #7094 + A warning is emitted when attempting to configure a mapped class within an inheritance hierarchy where the mapper is not given any polymorphic identity, however there is a polymorphic discriminator column assigned. Such classes should be abstract if they never intend to load directly. References: #7545 + Fixed regression for 1.4 in contains_eager() where the “wrap in subquery” logic of joinedload() would be inadvertently triggered for use of the contains_eager() function with similar statements (e.g. those that use distinct(), limit() or offset()), which would then lead to secondary issues with queries that used some combinations of SQL label names and aliasing. This “wrapping” is not appropriate for contains_eager() which has always had the contract that the user-defined SQL statement is unmodified with the exception of adding the appropriate columns to be fetched. References: #8569 + Fixed regression where using ORM update() with synchronize_session=’fetch’ would fail due to the use of evaluators that are now used to determine the in-Python value for expressions in the the SET clause when refreshing objects; if the evaluators make use of math operators against non-numeric values such as PostgreSQL JSONB, the non-evaluable condition would fail to be detected correctly. The evaluator now limits the use of math mutation operators to numeric types only, with the exception of “+” that continues to work for strings as well. SQLAlchemy 2.0 may alter this further by fetching the SET values completely rather than using evaluation. References: [#8507]
* engine + Fixed issue where mixing “
*” with additional explicitly-named column expressions within the columns clause of a select() construct would cause result-column targeting to sometimes consider the label name or other non-repeated names to be an ambiguous target. References: #8536
* asyncio + Improved implementation of asyncio.shield() used in context managers as added in #8145, such that the “close” operation is enclosed within an asyncio.Task which is then strongly referenced as the operation proceeds. This is per Python documentation indicating that the task is otherwise not strongly referenced. References: #8516
* postgresql + aggregate_order_by now supports cache generation. References: [#8574]
* mysql + Adjusted the regular expression used to match “CREATE VIEW” when testing for views to work more flexibly, no longer requiring the special keyword “ALGORITHM” in the middle, which was intended to be optional but was not working correctly. The change allows view reflection to work more completely on MySQL-compatible variants such as StarRocks. Pull request courtesy John Bodley. References: #8588
* mssql + Fixed yet another regression in SQL Server isolation level fetch (see #8231, #8475), this time with “Microsoft Dynamics CRM Database via Azure Active Directory”, which apparently lacks the system_views view entirely. Error catching has been extended that under no circumstances will this method ever fail, provided database connectivity is present. References: #8525- Also remove the conditional definition of python_module.
* Sat Sep 17 2022 Dirk Müller - update to 1.4.41:
* Fixed issue where use of the :func:`_sql.table` construct, passing a string for the :paramref:`_sql.table.schema` parameter, would fail to take the \"schema\" string into account when producing a cache key, thus leading to caching collisions if multiple, same-named :func:`_sql.table` constructs with different schemas were used.
* Fixed event listening issue where event listeners added to a superclass would be lost if a subclass were created which then had its own listeners associated. The practical example is that of the :class:`.sessionmaker` class created after events have been associated with the :class:`_orm.Session` class.
* Hardened the cache key strategy for the :func:`_orm.aliased` and :func:`_orm.with_polymorphic` constructs. While no issue involving actual statements being cached can easily be demonstrated (if at all), these two constructs were not including enough of what makes them unique in their cache keys for caching on the aliased construct alone to be accurate.
* Fixed regression appearing in the 1.4 series where a joined-inheritance query placed as a subquery within an enclosing query for that same entity would fail to render the JOIN correctly for the inner query. The issue manifested in two different ways prior and subsequent to version 1.4.18 (related issue :ticket:`6595`), in one case rendering JOIN twice, in the other losing the JOIN entirely. To resolve, the conditions under which \"polymorphic loading\" are applied have been scaled back to not be invoked for simple joined inheritance queries.
* Fixed issue in :mod:`sqlalchemy.ext.mutable` extension where collection links to the parent object would be lost if the object were merged with :meth:`.Session.merge` while also passing :paramref:`.Session.merge.load` as False.
* Fixed issue involving :func:`_orm.with_loader_criteria` where a closure variable used as bound parameter value within the lambda would not carry forward correctly into additional relationship loaders such as :func:`_orm.selectinload` and :func:`_orm.lazyload` after the statement were cached, using the stale originally-cached value instead.
* Fixed regression caused by the fix for :ticket:`8231` released in 1.4.40 where connection would fail if the user did not have permission to query the ``dm_exec_sessions`` or ``dm_pdw_nodes_exec_sessions`` system views when trying to determine the current transaction isolation level.
* Integrated support for asyncpg\'s ``terminate()`` method call for cases where the connection pool is recycling a possibly timed-out connection, where a connection is being garbage collected that wasn\'t gracefully
* Wed Aug 17 2022 Arun Persaud - update to version 1.4.40:
* orm + [orm] [bug] Fixed issue where referencing a CTE multiple times in conjunction with a polymorphic SELECT could result in multiple “clones” of the same CTE being constructed, which would then trigger these two CTEs as duplicates. To resolve, the two CTEs are deep-compared when this occurs to ensure that they are equivalent, then are treated as equivalent. References: #8357 + [orm] [bug] A select() construct that is passed a sole ‘
*’ argument for SELECT
*, either via string, text(), or literal_column(), will be interpreted as a Core-level SQL statement rather than as an ORM level statement. This is so that the
*, when expanded to match any number of columns, will result in all columns returned in the result. the ORM- level interpretation of select() needs to know the names and types of all ORM columns up front which can’t be achieved when \'
*\' is used. If \'
* is used amongst other expressions simultaneously with an ORM statement, an error is raised as this can’t be interpreted correctly by the ORM. References: #8235
* orm declarative + [orm] [declarative] [bug] Fixed issue where a hierarchy of classes set up as an abstract or mixin declarative classes could not declare standalone columns on a superclass that would then be copied correctly to a declared_attr callable that wanted to make use of them on a descendant class. References: #8190
* engine + [engine] [usecase] Implemented new Connection.execution_options.yield_per execution option for Connection in Core, to mirror that of the same yield_per option available in the ORM. The option sets both the Connection.execution_options.stream_results option at the same time as invoking Result.yield_per(), to provide the most common streaming result configuration which also mirrors that of the ORM use case in its usage pattern. See also: Using Server Side Cursors (a.k.a. stream results) - revised documentation + [engine] [bug] Fixed bug in Result where the usage of a buffered result strategy would not be used if the dialect in use did not support an explicit “server side cursor” setting, when using Connection.execution_options.stream_results. This is in error as DBAPIs such as that of SQLite and Oracle already use a non-buffered result fetching scheme, which still benefits from usage of partial result fetching. The “buffered” strategy is now used in all cases where Connection.execution_options.stream_results is set. + [engine] [bug] Added FilterResult.yield_per() so that result implementations such as MappingResult, ScalarResult and AsyncResult have access to this method. References: #8199
* sql + [sql] [bug] Adjusted the SQL compilation for string containment functions .contains(), .startswith(), .endswith() to force the use of the string concatenation operator, rather than relying upon the overload of the addition operator, so that non-standard use of these operators with for example bytestrings still produces string concatenation operators. References: #8253
* mypy + [mypy] [bug] Fixed a crash of the mypy plugin when using a lambda as a Column default. Pull request curtesy of tchapi. References: #8196
* asyncio + [asyncio] [bug] Added asyncio.shield() to the connection and session release process specifically within the __aexit__() context manager exit, when using AsyncConnection or AsyncSession as a context manager that releases the object when the context manager is complete. This appears to help with task cancellation when using alternate concurrency libraries such as anyio, uvloop that otherwise don’t provide an async context for the connection pool to release the connection properly during task cancellation. References: #8145
* postgresql + [postgresql] [bug] Fixed issue in psycopg2 dialect where the “multiple hosts” feature implemented for #4392, where multiple host:port pairs could be passed in the query string as ?host=host1:port1&host=host2:port2&host=host3:port3 was not implemented correctly, as it did not propagate the “port” parameter appropriately. Connections that didn’t use a different “port” likely worked without issue, and connections that had “port” for some of the entries may have incorrectly passed on that hostname. The format is now corrected to pass hosts/ports appropriately. As part of this change, maintained support for another multihost style that worked unintentionally, which is comma-separated ?host=h1,h2,h3&port=p1,p2,p3. This format is more consistent with libpq’s query-string format, whereas the previous format is inspired by a different aspect of libpq’s URI format but is not quite the same thing. If the two styles are mixed together, an error is raised as this is ambiguous. References: #4392
* mssql + [mssql] [bug] Fixed issues that prevented the new usage patterns for using DML with ORM objects presented at Using INSERT, UPDATE and ON CONFLICT (i.e. upsert) to return ORM Objects from working correctly with the SQL Server pyodbc dialect. References: #8210 + [mssql] [bug] Fixed issue where the SQL Server dialect’s query for the current isolation level would fail on Azure Synapse Analytics, due to the way in which this database handles transaction rollbacks after an error has occurred. The initial query has been modified to no longer rely upon catching an error when attempting to detect the appropriate system view. Additionally, to better support this database’s very specific “rollback” behavior, implemented new parameter ignore_no_transaction_on_rollback indicating that a rollback should ignore Azure Synapse error ‘No corresponding transaction found. (111214)’, which is raised if no transaction is present in conflict with the Python DBAPI. Initial patch and valuable debugging assistance courtesy of AATTww2406. See also: Avoiding transaction-related exceptions on Azure Synapse Analytics References: #8231
* misc + [bug] [types] Fixed issue where TypeDecorator would not correctly proxy the __getitem__() operator when decorating the ARRAY datatype, without explicit workarounds. References: #7249
* Sat Jul 09 2022 Arun Persaud - update to version 1.4.39:
* orm + [orm] [bug] [regression] Fixed regression caused by #8133 where the pickle format for mutable attributes was changed, without a fallback to recognize the old format, causing in-place upgrades of SQLAlchemy to no longer be able to read pickled data from previous versions. A check plus a fallback for the old format is now in place. References: #8133- changes from version 1.4.38:
* orm + [orm] [bug] [regression] Fixed regression caused by #8064 where a particular check for column correspondence was made too liberal, resulting in incorrect rendering for some ORM subqueries such as those using PropComparator.has() or PropComparator.any() in conjunction with joined-inheritance queries that also use legacy aliasing features. References: [#8162] + [orm] [bug] [sql] Fixed an issue where GenerativeSelect.fetch() would not be applied when executing a statement using the ORM. References: #8091 + [orm] [bug] Fixed issue where a with_loader_criteria() option could not be pickled, as is necessary when it is carried along for propagation to lazy loaders in conjunction with a caching scheme. Currently, the only form that is supported as picklable is to pass the “where criteria” as a fixed module-level callable function that produces a SQL expression. An ad-hoc “lambda” can’t be pickled, and a SQL expression object is usually not fully picklable directly. References: #8109
* engine + [engine] [bug] Repaired a deprecation warning class decorator that was preventing key objects such as Connection from having a proper __weakref__ attribute, causing operations like Python standard library inspect.getmembers() to fail. References: [#8115]
* sql + [sql] [bug] Fixed multiple observed race conditions related to lambda_stmt(), including an initial “dogpile” issue when a new Python code object is initially analyzed among multiple simultaneous threads which created both a performance issue as well as some internal corruption of state. Additionally repaired observed race condition which could occur when “cloning” an expression construct that is also in the process of being compiled or otherwise accessed in a different thread due to memoized attributes altering the __dict__ while iterated, for Python versions prior to 3.10; in particular the lambda SQL construct is sensitive to this as it holds onto a single statement object persistently. The iteration has been refined to use dict.copy() with or without an additional iteration instead. References: #8098 + [sql] [bug] Enhanced the mechanism of Cast and other “wrapping” column constructs to more fully preserve a wrapped Label construct, including that the label name will be preserved in the .c collection of a Subquery. The label was already able to render in the SQL correctly on the outside of the construct which it was wrapped inside. References: #8084 + [sql] [bug] Adjusted the fix made for #8056 which adjusted the escaping of bound parameter names with special characters such that the escaped names were translated after the SQL compilation step, which broke a published recipe on the FAQ illustrating how to merge parameter names into the string output of a compiled SQL string. The change restores the escaped names that come from compiled.params and adds a conditional parameter to SQLCompiler.construct_params() named escape_names that defaults to True, restoring the old behavior by default. References: [#8113]
* schema + [schema] [bug] Fixed bugs involving the Table.include_columns and the Table.resolve_fks parameters on Table; these little-used parameters were apparently not working for columns that refer to foreign key constraints. In the first case, not-included columns that refer to foreign keys would still attempt to create a ForeignKey object, producing errors when attempting to resolve the columns for the foreign key constraint within reflection; foreign key constraints that refer to skipped columns are now omitted from the table reflection process in the same way as occurs for Index and UniqueConstraint objects with the same conditions. No warning is produced however, as we likely want to remove the include_columns warnings for all constraints in 2.0. In the latter case, the production of table aliases or subqueries would fail on an FK related table not found despite the presence of resolve_fks=False; the logic has been repaired so that if a related table is not found, the ForeignKey object is still proxied to the aliased table or subquery (these ForeignKey objects are normally used in the production of join conditions), but it is sent with a flag that it’s not resolvable. The aliased table / subquery will then work normally, with the exception that it cannot be used to generate a join condition automatically, as the foreign key information is missing. This was already the behavior for such foreign key constraints produced using non-reflection methods, such as joining Table objects from different MetaData collections. References: #8100, #8101 + [schema] [bug] [mssql] Fixed issue where Table objects that made use of IDENTITY columns with a Numeric datatype would produce errors when attempting to reconcile the “autoincrement” column, preventing construction of the Column from using the Column.autoincrement parameter as well as emitting errors when attempting to invoke an Insert construct. References: #8111
* extensions + [extensions] [bug] Fixed bug in Mutable where pickling and unpickling of an ORM mapped instance would not correctly restore state for mappings that contained multiple Mutable-enabled attributes. References: #8133
* Sat Jun 04 2022 Dirk Müller - update to 1.4.37
* details on https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-1.4.37
* Fixed issue where using a column_property() construct containing a subquery against an already-mapped column attribute would not correctly apply ORM-compilation behaviors to the subquery, including that the “IN” expression added for a single-table inherits expression would fail to be included.
* Fixed issue where ORM results would apply incorrect key names to the returned Row objects in the case where the set of columns to be selected were changed, such as when using Select.with_only_columns().
* Fixed bug, likely a regression from 1.3, where usage of column names that require bound parameter escaping, more concretely when using Oracle with column names that require quoting such as those that start with an underscore, or in less common cases with some PostgreSQL drivers when using column names that contain percent signs, would cause the ORM versioning feature to not work correctly if the versioning column itself had such a name, as the ORM assumes certain bound parameter naming conventions that were being interfered with via the quotes. This issue is related to #8053 and essentially revises the approach towards fixing this, revising the original issue #5653 that created the initial implementation for generalized bound-parameter name quoting.
* Wed May 04 2022 Dirk Müller - update to 1.4.36:
* details on https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-1.4.36
* Fixed regression where the change made for #7861, released in version 1.4.33, that brought the Insert construct to be partially recognized as an ORM-enabled statement
* Modified the DeclarativeMeta metaclass to pass cls.__dict__ into the declarative scanning process to look for attributes, rather than the separate dictionary passed to the type’s __init__() method
* Fixed a memory leak in the C extensions which could occur when calling upon named members of Row when the member does not exist under Python 3
* Added a warning regarding a bug which exists in the Result.columns() method when passing 0 for the index in conjunction with a Result that will return a single ORM entity, which indicates that the current behavior of Result.columns() is broken in this case as the Result object will yield scalar values and not Row objects
* Fixed bug where ForeignKeyConstraint naming conventions using the referred_column_0 naming convention key would not work if the foreign key constraint were set up as a ForeignKey object rather than an explicit ForeignKeyConstraint object.
* Wed Apr 20 2022 pgajdosAATTsuse.com- python-mock is not required for build
* Sun Apr 10 2022 Arun Persaud - update to version 1.4.35:
* sql + [sql] [bug] Fixed bug in newly implemented FunctionElement.table_valued.joins_implicitly feature where the parameter would not automatically propagate from the original TableValuedAlias object to the secondary object produced when calling upon TableValuedAlias.render_derived() or TableValuedAlias.alias(). Additionally repaired these issues in TableValuedAlias: - repaired a potential memory issue which could occur when repeatedly calling TableValuedAlias.render_derived() against successive copies of the same object (for .alias(), we currently have to still continue chaining from the previous element. not sure if this can be improved but this is standard behavior for .alias() elsewhere) - repaired issue where the individual element types would be lost when calling upon TableValuedAlias.render_derived() or TableValuedAlias.alias(). References: #7890 + [sql] [bug] [regression] Fixed regression caused by #7823 which impacted the caching system, such that bound parameters that had been “cloned” within ORM operations, such as polymorphic loading, would in some cases not acquire their correct execution-time value leading to incorrect bind values being rendered. References: #7903- changes from version 1.4.34:
* orm + [orm] [bug] [regression] Fixed regression caused by #7861 where invoking an Insert construct which contained ORM entities directly via Session.execute() would fail. References: #7878
* postgresql + [postgresql] [bug] Scaled back a fix made for #6581 where “executemany values” mode for psycopg2 were disabled for all “ON CONFLICT” styles of INSERT, to not apply to the “ON CONFLICT DO NOTHING” clause, which does not include any parameters and is safe for “executemany values” mode. “ON CONFLICT DO UPDATE” is still blocked from “executemany values” as there may be additional parameters in the DO UPDATE clause that cannot be batched (which is the original issue fixed by #6581). References: #7880- changes from version 1.4.33:
* orm + [orm] [usecase] Added with_polymorphic.adapt_on_names to the with_polymorphic() function, which allows a polymorphic load (typically with concrete mapping) to be stated against an alternative selectable that will adapt to the original mapped selectable on column names alone. References: #7805 + [orm] [usecase] Added new attributes UpdateBase.returning_column_descriptions and UpdateBase.entity_description to allow for inspection of ORM attributes and entities that are installed as part of an Insert, Update, or Delete construct. The Select.column_descriptions accessor is also now implemented for Core-only selectables. References: #7861 + [orm] [bug] [regression] Fixed regression in “dynamic” loader strategy where the Query.filter_by() method would not be given an appropriate entity to filter from, in the case where a “secondary” table were present in the relationship being queried and the mapping were against something complex such as a “with polymorphic”. References: #7868 + [orm] [bug] Fixed bug where composite() attributes would not work in conjunction with the selectin_polymorphic() loader strategy for joined table inheritance. References: #7801 + [orm] [bug] [performance] Improvements in memory usage by the ORM, removing a significant set of intermediary expression objects that are typically stored when a copy of an expression object is created. These clones have been greatly reduced, reducing the number of total expression objects stored in memory by ORM mappings by about 30%. References: #7823 + [orm] [bug] Fixed issue where the selectin_polymorphic() loader option would not work with joined inheritance mappers that don’t have a fixed “polymorphic_on” column. Additionally added test support for a wider variety of usage patterns with this construct. References: #7799 + [orm] [bug] Fixed bug in with_loader_criteria() function where loader criteria would not be applied to a joined eager load that were invoked within the scope of a refresh operation for the parent object. References: #7862 + [orm] [bug] Fixed issue where the Mapper would reduce a user-defined Mapper.primary_key argument too aggressively, in the case of mapping to a UNION where for some of the SELECT entries, two columns are essentially equivalent, but in another, they are not, such as in a recursive CTE. The logic here has been changed to accept a given user-defined PK as given, where columns will be related to the mapped selectable but no longer “reduced” as this heuristic can’t accommodate for all situations. References: #7842
* engine + [engine] [usecase] Added new parameter Engine.dispose.close, defaulting to True. When False, the engine disposal does not touch the connections in the old pool at all, simply dropping the pool and replacing it. This use case is so that when the original pool is transferred from a parent process, the parent process may continue to use those connections. See also Using Connection Pools with Multiprocessing or os.fork() - revised documentation References: #7815, #7877 + [engine] [bug] Further clarified connection-level logging to indicate the BEGIN, ROLLBACK and COMMIT log messages do not actually indicate a real transaction when the AUTOCOMMIT isolation level is in use; messaging has been extended to include the BEGIN message itself, and the messaging has also been fixed to accommodate when the Engine level create_engine.isolation_level parameter was used directly. References: #7853
* sql + [sql] [usecase] Added new parameter FunctionElement.table_valued.joins_implicitly, for the FunctionElement.table_valued() construct. This parameter indicates that the given table-valued function implicitly joins to the table it refers towards, essentially disabling the “from linting” feature, i.e. the “cartesian product” warning, from taking effect due to the presence of this parameter. May be used for functions such as func.json_each(). References: #7845 + [sql] [bug] The bindparam.literal_execute parameter now takes part of the cache generation of a bindparam(), since it changes the sql string generated by the compiler. Previously the correct bind values were used, but the literal_execute would be ignored on subsequent executions of the same query. References: #7876 + [sql] [bug] [regression] Fixed regression caused by #7760 where the new capabilities of TextualSelect were not fully implemented within the compiler properly, leading to issues with composed INSERT constructs such as “INSERT FROM SELECT” and “INSERT…ON CONFLICT” when combined with CTE and textual statements. References: #7798
* schema + [schema] [usecase] Added support so that the Table.to_metadata.referred_schema_fn callable passed to Table.to_metadata() may return the value BLANK_SCHEMA to indicate that the referenced foreign key should be reset to None. The RETAIN_SCHEMA symbol may also be returned from this function to indicate “no change”, which will behave the same as None currently does which also indicates no change. References: [#7860]
* sqlite + [sqlite] [bug] [reflection] Fixed bug where the name of CHECK constraints under SQLite would not be reflected if the name were created using quotes, as is the case when the name uses mixed case or special characters. References: #5463
* mssql + [mssql] [bug] [regression] Fixed regression caused by #7160 where FK reflection in conjunction with a low compatibility level setting (compatibility level 80: SQL Server 2000) causes an “Ambiguous column name” error. Patch courtesy AATTLin-Your. References: #7812
* misc + [bug] [ext] Improved the error message that’s raised for the case where the association_proxy() construct attempts to access a target attribute at the class level, and this access fails. The particular use case here is when proxying to a hybrid attribute that does not include a working class-level implementation. References: #7827
* Sat Mar 12 2022 Arun Persaud - update to version 1.4.32:
* orm + [orm] [bug] [regression] Fixed regression where the ORM exception that is to be raised when an INSERT silently fails to actually insert a row (such as from a trigger) would not be reached, due to a runtime exception raised ahead of time due to the missing primary key value, thus raising an uninformative exception rather than the correct one. For 1.4 and above, a new FlushError is added for this case that’s raised earlier than the previous “null identity” exception was for 1.3, as a situation where the number of rows actually INSERTed does not match what was expected is a more critical situation in 1.4 as it prevents batching of multiple objects from working correctly. This is separate from the case where a newly fetched primary key is fetched as NULL, which continues to raise the existing “null identity” exception. References: #7594 + [orm] [bug] Fixed issue where using a fully qualified path for the classname in relationship() that nonetheless contained an incorrect name for path tokens that were not the first token, would fail to raise an informative error and would instead fail randomly at a later step. References: #7697
* engine + [engine] [bug] Adjusted the logging for key SQLAlchemy components including Engine, Connection to establish an appropriate stack level parameter, so that the Python logging tokens funcName and lineno when used in custom logging formatters will report the correct information, which can be useful when filtering log output; supported on Python 3.8 and above. Pull request courtesy Markus Gerstel. References: #7612
* sql + [sql] [bug] Fixed type-related error messages that would fail for values that were tuples, due to string formatting syntax, including compile of unsupported literal values and invalid boolean values. References: #7721 + [sql] [bug] [mysql] Fixed issues in MySQL SET datatype as well as the generic Enum datatype where the __repr__() method would not render all optional parameters in the string output, impacting the use of these types in Alembic autogenerate. Pull request for MySQL courtesy Yuki Nishimine. References: #7598, [#7720], #7789 + [sql] [bug] The Enum datatype now emits a warning if the Enum.length argument is specified without also specifying Enum.native_enum as False, as the parameter is otherwise silently ignored in this case, despite the fact that the Enum datatype will still render VARCHAR DDL on backends that don’t have a native ENUM datatype such as SQLite. This behavior may change in a future release so that “length” is honored for all non-native “enum” types regardless of the “native_enum” setting. + [sql] [bug] Fixed issue where the HasCTE.add_cte() method as called upon a TextualSelect instance was not being accommodated by the SQL compiler. The fix additionally adds more “SELECT”-like compiler behavior to TextualSelect including that DML CTEs such as UPDATE and INSERT may be accommodated. References: #7760
* asyncio + [asyncio] [bug] Fixed issues where a descriptive error message was not raised for some classes of event listening with an async engine, which should instead be a sync engine instance. + [asyncio] [bug] Fixed issue where the AsyncSession.execute() method failed to raise an informative exception if the Connection.execution_options.stream_results execution option were used, which is incompatible with a sync-style Result object when using an asyncio calling style, as the operation to fetch more rows would need to be awaited. An exception is now raised in this scenario in the same way one was already raised when the Connection.execution_options.stream_results option would be used with the AsyncConnection.execute() method. Additionally, for improved stability with state-sensitive database drivers such as asyncmy, the cursor is now closed when this error condition is raised; previously with the asyncmy dialect, the connection would go into an invalid state with unconsumed server side results remaining. References: #7667
* postgresql + [postgresql] [usecase] Added compiler support for the PostgreSQL NOT VALID phrase when rendering DDL for the CheckConstraint, ForeignKeyConstraint and ForeignKey schema constructs. Pull request courtesy Gilbert Gilb’s. References: #7600
* mysql + [mysql] [bug] [regression] Fixed regression caused by #7518 where changing the syntax “SHOW VARIABLES” to “SELECT AATTAATT” broke compatibility with MySQL versions older than 5.6, including early 5.0 releases. While these are very old MySQL versions, a change in compatibility was not planned, so version-specific logic has been restored to fall back to “SHOW VARIABLES” for MySQL server versions < 5.6. References: #7518
* mariadb + [mariadb] [bug] [regression] Fixed regression in mariadbconnector dialect as of mariadb connector 1.0.10 where the DBAPI no longer pre-buffers cursor.lastrowid, leading to errors when inserting objects with the ORM as well as causing non-availability of the CursorResult.inserted_primary_key attribute. The dialect now fetches this value proactively for situations where it applies. References: #7738
* sqlite + [sqlite] [usecase] Added support for reflecting SQLite inline unique constraints where the column names are formatted with SQLite “escape quotes” [] or `, which are discarded by the database when producing the column name. References: #7736 + [sqlite] [bug] Fixed issue where SQLite unique constraint reflection would fail to detect a column-inline UNIQUE constraint where the column name had an underscore in its name. References: #7736
* oracle + [oracle] [bug] Fixed issue in Oracle dialect where using a column name that requires quoting when written as a bound parameter, such as \"_id\", would not correctly track a Python generated default value due to the bound-parameter rewriting missing this value, causing an Oracle error to be raised. References: #7676 + [oracle] [bug] [regression] Added support to parse “DPI” error codes from cx_Oracle exception objects such as DPI-1080 and DPI-1010, both of which now indicate a disconnect scenario as of cx_Oracle 8.3. References: #7748
* tests + [tests] [bug] Improvements to the test suite’s integration with pytest such that the “warnings” plugin, if manually enabled, will not interfere with the test suite, such that third parties can enable the warnings plugin or make use of the -W parameter and SQLAlchemy’s test suite will continue to pass. Additionally, modernized the detection of the “pytest-xdist” plugin so that plugins can be globally disabled using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 without breaking the test suite if xdist were still installed. Warning filters that promote deprecation warnings to errors are now localized to SQLAlchemy-specific warnings, or within SQLAlchemy-specific sources for general Python deprecation warnings, so that non-SQLAlchemy deprecation warnings emitted from pytest plugins should also not impact the test suite. References: #7599 + [tests] [bug] Made corrections to the default pytest configuration regarding how test discovery is configured, to fix issue where the test suite would not configure warnings correctly and also attempt to load example suites as tests, in the specific case where the SQLAlchemy checkout were located in an absolute path that had a super-directory named “test”. References: #7045
* Sat Jan 29 2022 Arun Persaud - specfile:
* update copyright year- update to version 1.4.31:
* orm + [orm] [bug] Fixed issue in Session.bulk_save_objects() where the sorting that takes place when the preserve_order parameter is set to False would sort partially on Mapper objects, which is rejected in Python 3.11. References: #7591
* postgresql + [postgresql] [bug] [regression] Fixed regression where the change in #7148 to repair ENUM handling in PostgreSQL broke the use case of an empty ARRAY of ENUM, preventing rows that contained an empty array from being handled correctly when fetching results. References: #7590
* mysql + [mysql] [bug] [regression] Fixed regression in asyncmy dialect caused by #7567 where removal of the PyMySQL dependency broke binary columns, due to the asyncmy dialect not being properly included within CI tests. References: #7593
* mssql + [mssql] Added support for FILESTREAM when using VARBINARY(max) in MSSQL. References: #7243- changes from version 1.4.30:
* orm + [orm] [bug] Fixed issue in joined-inheritance load of additional attributes functionality in deep multi-level inheritance where an intermediary table that contained no columns would not be included in the tables joined, instead linking those tables to their primary key identifiers. While this works fine, it nonetheless in 1.4 began producing the cartesian product compiler warning. The logic has been changed so that these intermediary tables are included regardless. While this does include additional tables in the query that are not technically necessary, this only occurs for the highly unusual case of deep 3+ level inheritance with intermediary tables that have no non primary key columns, potential performance impact is therefore expected to be negligible. References: #7507 + [orm] [bug] Fixed issue where calling upon registry.map_imperatively() more than once for the same class would produce an unexpected error, rather than an informative error that the target class is already mapped. This behavior differed from that of the mapper() function which does report an informative message already. References: #7579 + [orm] [bug] [asyncio] Added missing method AsyncSession.invalidate() to the AsyncSession class. References: #7524 + [orm] [bug] [regression] Fixed regression which appeared in 1.4.23 which could cause loader options to be mis-handled in some cases, in particular when using joined table inheritance in combination with the polymorphic_load=\"selectin\" option as well as relationship lazy loading, leading to a TypeError. References: #7557 + [orm] [bug] [regression] Fixed ORM regression where calling the aliased() function against an existing aliased() construct would fail to produce correct SQL if the existing construct were against a fixed table. The fix allows that the original aliased() construct is disregarded if it were only against a table that’s now being replaced. It also allows for correct behavior when constructing a aliased() without a selectable argument against a aliased() that’s against a subuquery, to create an alias of that subquery (i.e. to change its name). The nesting behavior of aliased() remains in place for the case where the outer aliased() object is against a subquery which in turn refers to the inner aliased() object. This is a relatively new 1.4 feature that helps to suit use cases that were previously served by the deprecated Query.from_self() method. References: #7576 + [orm] [bug] Fixed issue where Select.correlate_except() method, when passed either the None value or no arguments, would not correlate any elements when used in an ORM context (that is, passing ORM entities as FROM clauses), rather than causing all FROM elements to be considered as “correlated” in the same way which occurs when using Core-only constructs. References: #7514 + [orm] [bug] [regression] Fixed regression from 1.3 where the “subqueryload” loader strategy would fail with a stack trace if used against a query that made use of Query.from_statement() or Select.from_statement(). As subqueryload requires modifying the original statement, it’s not compatible with the “from_statement” use case, especially for statements made against the text() construct. The behavior now is equivalent to that of 1.3 and previously, which is that the loader strategy silently degrades to not be used for such statements, typically falling back to using the lazyload strategy. References: #7505
* sql + [sql] [bug] [postgresql] Added additional rule to the system that determines TypeEngine implementations from Python literals to apply a second level of adjustment to the type, so that a Python datetime with or without tzinfo can set the timezone=True parameter on the returned DateTime object, as well as Time. This helps with some round-trip scenarios on type-sensitive PostgreSQL dialects such as asyncpg, psycopg3 (2.0 only). References: #7537 + [sql] [bug] Added an informative error message when a method object is passed to a SQL construct. Previously, when such a callable were passed, as is a common typographical error when dealing with method-chained SQL constructs, they were interpreted as “lambda SQL” targets to be invoked at compilation time, which would lead to silent failures. As this feature was not intended to be used with methods, method objects are now rejected. References: #7032
* mypy + [mypy] [bug] Fixed Mypy crash when running id daemon mode caused by a missing attribute on an internal mypy Var instance. References: #7321
* asyncio + [asyncio] [usecase] Added new method AdaptedConnection.run_async() to the DBAPI connection interface used by asyncio drivers, which allows methods to be called against the underlying “driver” connection directly within a sync-style function where the await keyword can’t be used, such as within SQLAlchemy event handler functions. The method is analogous to the AsyncConnection.run_sync() method which translates async-style calls to sync-style. The method is useful for things like connection-pool on-connect handlers that need to invoke awaitable methods on the driver connection when it’s first created. References: #7580
* postgresql + [postgresql] [usecase] Added string rendering to the UUID datatype, so that stringifying a statement with “literal_binds” that uses this type will render an appropriate string value for the PostgreSQL backend. Pull request courtesy José Duarte. References: #7561 + [postgresql] [bug] [asyncpg] Improved support for asyncpg handling of TIME WITH TIMEZONE, which was not fully implemented. References: #7537 + [postgresql] [bug] [mssql] [reflection] Fixed reflection of covering indexes to report include_columns as part of the dialect_options entry in the reflected index dictionary, thereby enabling round trips from reflection->create to be complete. Included columns continue to also be present under the include_columns key for backwards compatibility. References: [#7382] + [postgresql] [bug] Fixed handling of array of enum values which require escape characters. References: #7418 + mysql + [mysql] [change] Replace SHOW VARIABLES LIKE statement with equivalent SELECT AATTAATTvariable in MySQL and MariaDB dialect initialization. This should avoid mutex contention caused by SHOW VARIABLES, improving initialization performance. References: #7518 + [mysql] [bug] Removed unnecessary dependency on PyMySQL from the asyncmy dialect. Pull request courtesy long2ice. References: [#7567]
* Mon Dec 27 2021 Matej Cepl - Update to 1.4.29: - truly, just plenty of small bugfixes, see the changelog on the Web https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-1.4.29
* Sat Dec 18 2021 Dirk Müller - update to 1.4.28: Bugfixes, see
* https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-1.4.28
* Sun Dec 05 2021 Dirk Müller - update to 1.4.27: Bugfixes
* see https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-1.4.27
* Wed Oct 27 2021 Dirk Müller - update to version 1.4.26:
* a repair to the workings of the update() statement in an ORM context when used with hybrid and composite attributes.
* Fixes for the with_loader_criteria() ORM option
* adjustments to the ORM Session interface to accommodate for new API features
* some new legacy warnings for lesser used patterns with Query.join()
* SQL / ORM fixes for the use case of selecting from repeated, non-labeled column expressions, typically the null() construct when used as a placeholder in a UNION statement.
* For PostgreSQL, refinements to the \"expanding IN\" SQL feature when used with PostgreSQL ARRAY datatypes as well as fixes for the mostly PostgreSQL-specific any_() and all_() column methods.
* For MySQL, repaired support for new behaviors in MariaDB 10.6
* For SQL Server, reflection fixes and improvements for foreign key constraints as well table /view detection.
* Sat Oct 16 2021 Dirk Müller - update to version 1.4.25:
* Fixed regression due to :ticket:`7024` where the reorganization of the \"platform machine\" names used by the ``greenlet`` dependency mis-spelled \"aarch64\" and additionally omitted uppercase \"AMD64\" as is needed for Windows machines.
* Fixed a bug in :meth:`_asyncio.AsyncSession.execute` and :meth:`_asyncio.AsyncSession.stream` that required ``execution_options`` to be an instance of ``immutabledict`` when defined. It now correctly accepts any mapping.
* Improve the interface used by adapted drivers, like the asyncio ones, to access the actual connection object returned by the driver.
* Implemented missing methods in :class:`_functions.FunctionElement` which, while unused, would lead pylint to report them as unimplemented abstract methods.
* Fixed an issue where :meth:`_reflection.has_table` returned ``True`` for local temporary tables that actually belonged to a different SQL Server session (connection). An extra check is now performed to ensure that the temp table detected is in fact owned by the current session.
* Fixed issue where the ability of the :meth:`_events.ConnectionEvents.before_execute` method to alter the SQL statement object passed, returning the new object to be invoked, was inadvertently removed. This behavior has been restored.
* Ensure that ``str()`` is called on the an :paramref:`_url.URL.create.password` argument, allowing usage of objects that implement the ``__str__()`` method as password attributes. Also clarified that one such object is not appropriate to dynamically change the password for each database connection; the approaches at :ref:`engines_dynamic_tokens` should be used instead.
* Fixed ORM issue where column expressions passed to ``query()`` or ORM-enabled ``select()`` would be deduplicated on the identity of the object, such as a phrase like ``select(A.id, null(), null())`` would produce only one \"NULL\" expression, which previously was not the case in 1.3. However, the change also allows for ORM expressions to render as given as well, such as ``select(A.data, A.data)`` will produce a result row with two columns.
* Fixed issue where mypy plugin would crash when interpreting a ``query_expression()`` construct.
* Added new methods :meth:`_orm.Session.scalars`,
* Added loader options to :meth:`_orm.Session.merge` and :meth:`_asyncio.AsyncSession.merge` via a new :paramref:`_orm.Session.merge.options` parameter, which will apply the given loader options to the ``get()`` used internally by merge, allowing eager loading of relationships etc. to be applied when the merge process loads a new object. Pull request courtesy Daniel Stone.
* Added initial support for the ``asyncmy`` asyncio database driver for MySQL and MariaDB. This driver is very new, however appears to be the only current alternative to the ``aiomysql`` driver which currently appears to be unmaintained and is not working with current Python versions. Much thanks to long2ice for the pull request for this dialect.
* Fixed a two issues where combinations of ``select()`` and ``join()`` when adapted to form a copy of the element would not completely copy the state of all column objects associated with subqueries. A key problem this caused is that usage of the :meth:`_sql.ClauseElement.params` method (which should probably be moved into a legacy category as it is inefficient and error prone) would leave copies of the old :class:`_sql.BindParameter` objects around, leading to issues in correctly setting the parameters at execution time.
* Thu Jul 22 2021 Arun Persaud - update to version 1.4.22:
* orm + Fixed issue in new Table.table_valued() method where the resulting TableValuedColumn construct would not respond correctly to alias adaptation as is used throughout the ORM, such as for eager loading, polymorphic loading, etc. + Fixed issue where usage of the 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 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 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. + 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. + 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.
* engine + Added some guards against KeyError in the event system to accommodate the case that the interpreter is shutting down at the same time Engine.dispose() is being called, which would cause stack trace warnings.
* sql + Fixed issue where use of the 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. + Fixed issue where type-specific bound parameter handlers would not be called upon in the case of using the Insert.values() method with the Python None value; in particular, this would be noticed when using the JSON datatype as well as related PostgreSQL specific types such as 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 Insert.- changes from version 1.4.21:
* orm + 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 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 relationship.active_history flag is not set. As is documented in 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 relationship.active_history flag can be set to True on the relationship. + Fixed regression caused in 1.4.19 due to #6503 and related involving Query.with_entities() where the new structure used would be inappropriately transferred to an enclosing Query when making use of set operations such as Query.union(), causing the JOIN instructions within to be applied to the outside query as well. + Fixed regression which appeared in version 1.4.3 due to #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 with_polymorphic() against a mapping which uses a column_property() which in turn makes use of a scalar select that includes a aliased() object of the mapped table. + 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.
* sql + Added new method HasCTE.add_cte() to each of the select(), insert(), update() and delete() constructs. This method will add the given 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. + 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. + Fixed regression where the tablesample() construct would fail to be executable when constructed given a floating-point sampling value not embedded within a SQL function.
* postgresql + Fixed issue in Insert.on_conflict_do_nothing() and 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. + 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. + Fixed issue in Insert.on_conflict_do_nothing() and 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.
* mssql + 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.
* Sun Jul 11 2021 Antonio Larrosa - update to version 1.4.20:
* orm + [orm] [bug] [regression] Fixed regression in ORM regarding an internal reconstitution step for the 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. References: #6680 + [orm] [bug] [regression] Adjusted Query.union() and similar set operations to be correctly compatible with the new capabilities just added in #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 undefer() option to be used at the top level of such a Query without having to apply the option to each of the elements within the UNION. References: #6678 + [orm] [bug] Adjusted the check in the mapper for a callable object that is used as a AATTvalidates validator function or a AATTreconstructor 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. References: #6538
* engine + [engine] [bug] Fixed an issue in the C extension for the Row class which could lead to a memory leak in the unlikely case of a 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 Row implementation to accommodate for this case. References: #5348 + [engine] [bug] Fixed old issue where a 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. References: #6665
* sql + [sql] [usecase] Add a impl parameter to PickleType constructor, allowing any arbitary type to be used in place of the default implementation of LargeBinary. Pull request courtesy jason3gb. References: #6646 + [sql] [bug] [orm] Fixed the class hierarchy for the Sequence and the more general DefaultGenerator base, as these are “executable” as statements they need to include Executable in their hierarchy, not just StatementRole as was applied arbitrarily to Sequence previously. The fix allows Sequence to work in all .execute() methods including with Session.execute() which was not working in the case that a SessionEvents.do_orm_execute() handler was also established. References: #6668
* schema + [schema] [bug] Fixed issue where passing None for the value of 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. References: #6685
* mysql + [mysql] [usecase] 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. References: #6659
* misc + [bug] [ext] [regression] Fixed regression in sqlalchemy.ext.automap extension such that the use case of creating an explicit mapped class to a table that is also the relationship.secondary element of a relationship() that automap will be generating would emit the “overlaps” warnings introduced in 1.4 and discussed at relationship X will copy column Q to column P, which conflicts with relationship(s): ‘Y’. 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. References: #6679- changes from version 1.4.19:
* orm + [orm] [bug] [regression] Fixed further regressions in the same area as that of #6052 where loader options as well as invocations of methods like Query.join() would fail if the left side of the statement for which the option/join depends upon were replaced by using the Query.with_entities() method, or when using 2.0 style queries when using the 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. References: #6253, #6503 + [orm] [bug] 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 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 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 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. References: #6661
* sql + [sql] [bug] 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. References: #6663
* mypy + [mypy] [bug] 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. References: #6476
* asyncio + [asyncio] [usecase] Implemented async_scoped_session to address some asyncio-related incompatibilities between scoped_session and AsyncSession, in which some methods (notably the async_scoped_session.remove() method) should be used with the await keyword. References: #6583 + [asyncio] [bug] [postgresql] 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. References: #6652
* postgresql + [postgresql] [bug] [oracle] 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. References: #6649 + [postgresql] [bug] 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. References: #6621
* mysql + [mysql] [usecase] Added new construct match, which provides for the full range of MySQL’s MATCH operator including multiple column support and modifiers. Pull request courtesy Anton Kovalevich. References: #6132
* mssql + [mssql] [change] Made improvements to the server version regexp used by the pymssql dialect to prevent a regexp overflow in case of an invalid version string. References: #6253, #6503 + [mssql] [bug] 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. References: #6658- changes from version 1.4.18:
* orm + [orm] [performance] [bug] [regression] 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. References: #6596 + [orm] [bug] Clarified the current purpose of the 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. References: #6072, #6487 + [orm] [bug] [regression] Adjusted the means by which classes such as scoped_session and AsyncSession are generated from the base Session class, such that custom 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. References: #6285 + [orm] [bug] [regression] 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. References: #6595 + [orm] [bug] 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. References: #6591 + [orm] [bug] The warning that’s emitted for 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. References: #6400
* asyncio + [asyncio] [usecase] 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 async_object_session(), async_session() as well as a new InstanceState attribute InstanceState.async_session have been added, which are used to retrieve the original AsyncSession associated with an ORM mapped object, a Session associated with an AsyncSession, and an AsyncSession associated with an InstanceState, respectively. This patch also implements new methods AsyncSession.in_nested_transaction(), AsyncSession.get_transaction(), AsyncSession.get_nested_transaction(). References: #6319 + [asyncio] [bug] Fixed an issue that presented itself when using the NullPool or the StaticPool with an async engine. This mostly affected the aiosqlite dialect. References: #6575 + [asyncio] [bug] 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. References: #6592
* postgresql + [postgresql] [bug] [regression] 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. References: #6581
* sqlite + [sqlite] [bug] Add note regarding encryption-related pragmas for pysqlcipher passed in the url. This change is also backported to: 1.3.25. References: #6589 + [sqlite] [bug] [regression] The fix for pysqlcipher released in version 1.4.3 #5848 was unfortunately non-working, in that the new on_connect_url hook was erroneously not receiving a URL object under normal usage of 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. References: #6586- changes from version 1.4.17:
* orm + [orm] [bug] [regression] 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. References: #6558- changes from version 1.4.16:
* general + [general] [bug] Resolved various deprecation warnings which were appearing as of Python version 3.10.0b1. References: #6540, #6543
* orm + [orm] [bug] Fixed issue when using relationship.cascade_backrefs parameter set to False, which per cascade_backrefs behavior deprecated for removal in 2.0 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 AttributeEvents.append_wo_mutation(). References: #6471 + [orm] [bug] [regression] 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 Select.join() given an ORM attribute as a target. References: #6550 + [orm] [bug] [regression] 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. References: #6495 + [orm] [bug] Enhanced the bind resolution rules for Session.execute() so that when a non-ORM statement such as an 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 Session that has a bind map set up on a common superclass without specific mappers or tables named in the map. References: #6484
* engine + [engine] [bug] Fixed issue where an AATT sign in the database portion of a URL would not be interpreted correctly if the URL also had a username:password section. References: #6482 + [engine] [bug] Fixed a long-standing issue with 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. References: #6329
* sql + [sql] [bug] [regression] Fixed regression in dynamic loader strategy and relationship() overall where the 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. References: #6549
* mssql + [mssql] [usecase] Implemented support for a CTE construct to be used directly as the target of a delete() construct, i.e. “WITH … AS cte DELETE FROM cte”. This appears to be a useful feature of SQL Server. References: #6464
* misc + [bug] [ext] Fixed a deprecation warning that was emitted when using automap_base() without passing an existing Base. References: #6529 + [bug] [pep484] 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. References: #6461 + [bug] [ext] [regression] 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 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. References: #6390- Drop patch:
* tests_overcome_bpo42967.patch
* Fri May 14 2021 Arun Persaud - updated line numbers in patch- update to version 1.4.15:
* general + [general] [feature] 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.
* orm + [orm] [bug] [regression] Fixed additional regression caused by “eager loaders run on unexpire” feature #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. + [orm] [bug] Fixed issue in subquery loader strategy which prevented caching from working correctly. This would have been seen in the logs as a “generated” message instead of “cached” for all subqueryload SQL emitted, which by saturating the cache with new keys would degrade overall performance; it also would produce “LRU size alert” warnings.
* sql + [sql] [bug] Adjusted the logic added as part of #6397 in 1.4.12 so that internal mutation of the BindParameter object occurs within the clause construction phase as it did before, rather than in the compilation phase. In the latter case, the mutation still produced side effects against the incoming construct and additionally could potentially interfere with other internal mutation routines.
* mysql + [mysql] [bug] [documentation] 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.- changes from version 1.4.14:
* orm + [orm] [bug] [regression] Fixed regression involving lazy=\'dynamic\' loader in conjunction with a detached object. The previous behavior was that the dynamic loader upon calling methods like .all() returns empty lists for detached objects without error, this has been restored; however a warning is now emitted as this is not the correct result. Other dynamic loader scenarios correctly raise DetachedInstanceError.
* engine + [engine] [usecase] [orm] Applied consistent behavior to the use case of calling .commit() or .rollback() inside of an existing .begin() context manager, with the addition of potentially emitting SQL within the block subsequent to the commit or rollback. This change continues upon the change first added in [#6155] where the use case of calling “rollback” inside of a .begin() contextmanager block was proposed: o calling .commit() or .rollback() will now be allowed without error or warning within all scopes, including that of legacy and future Engine, ORM Session, asyncio AsyncEngine. Previously, the Session disallowed this. o The remaining scope of the context manager is then closed; when the block ends, a check is emitted to see if the transaction was already ended, and if so the block returns without action. o It will now raise an error if subsequent SQL of any kind is emitted within the block, after .commit() or .rollback() is called. The block should be closed as the state of the executable object would otherwise be undefined in this state. + [engine] [bug] [regression] Established a deprecation path for calling upon the CursorResult.keys() method for a statement that returns no rows to provide support for legacy patterns used by the “records” package as well as any other non-migrated applications. Previously, this would raise ResourceClosedException unconditionally in the same way as it does when attempting to fetch rows. While this is the correct behavior going forward, the _cursor.LegacyCursorResult object will now in this case return an empty list for .keys() as it did in 1.3, while also emitting a 2.0 deprecation warning. The _cursor.CursorResult, used when using a 2.0-style “future” engine, will continue to raise as it does now.
* sql + [sql] [bug] [regression] Fixed regression caused by the “empty in” change just made in #6397 1.4.12 where the expression needs to be parenthesized for the “not in” use case, otherwise the condition will interfere with the other filtering criteria. + [sql] [bug] [regression] The TypeDecorator class will now emit a warning when used in SQL compilation with caching unless the .cache_ok flag is set to True or False. A new class-level attribute TypeDecorator.cache_ok may be set which will be used as an indication that all the parameters passed to the object are safe to be used as a cache key if set to True, False means they are not.
* Thu May 06 2021 Antonio Larrosa - Remove %ifpython2 (python2 flavor is disabled).- Do not use %if %{python_version_nodots} for BuildRequires.
* Wed May 05 2021 Antonio Larrosa - Remove broken %ifpython3 since the python2 flavor is disabled anyway.
* Tue May 04 2021 Antonio Larrosa - update to 1.4.13: orm
* Fixed regression in selectinload loader strategy that would cause it to cache its internal state incorrectly when handling relationships that join across more than one column, such as when using a composite foreign key. The invalid caching would then cause other unrelated loader operations to fail. References: #6410
* Fixed regression where Query.filter_by() would not work if the lead entity were a SQL function or other expression derived from the primary entity in question, rather than a simple entity or column of that entity. Additionally, improved the behavior of Select.filter_by() overall to work with column expressions even in a non-ORM context. References: #6414
* Fixed regression where using selectinload() and subqueryload() to load a two-level-deep path would lead to an attribute error. References: #6419
* Fixed regression where using the noload() loader strategy in conjunction with a “dynamic” relationship would lead to an attribute error as the noload strategy would attempt to apply itself to the dynamic loader. References: #6420 engine
* Restored a legacy transactional behavior that was inadvertently removed from the Connection as it was never tested as a known use case in previous versions, where calling upon the Connection.begin_nested() method, when no transaction is present, does not create a SAVEPOINT at all and instead starts an outer transaction, returning a RootTransaction object instead of a NestedTransaction object. This RootTransaction then will emit a real COMMIT on the database connection when committed. Previously, the 2.0 style behavior was present in all cases that would autobegin a transaction but not commit it, which is a behavioral change. When using a 2.0 style connection object, the behavior is unchanged from previous 1.4 versions; calling Connection.begin_nested() will “autobegin” the outer transaction if not already present, and then as instructed emit a SAVEPOINT, returning the NestedTransaction object. The outer transaction is committed by calling upon Connection.commit(), as is “commit-as-you-go” style usage. In non-“future” mode, while the old behavior is restored, it also emits a 2.0 deprecation warning as this is a legacy behavior. References: #6408 asyncio
* Fixed a regression introduced by #6337 that would create an asyncio.Lock which could be attached to the wrong loop when instantiating the async engine before any asyncio loop was started, leading to an asyncio error message when attempting to use the engine under certain circumstances. References: #6409 postgresql
* Add support for server side cursors in the pg8000 dialect for PostgreSQL. This allows use of the Connection.execution_options.stream_results option. References: #6198
* Tue May 04 2021 Antonio Larrosa - Removed use of pytest-xdist which is giving intermitent failed builds with internal errors like: INTERNALERROR> E RuntimeError: There is no current event loop in thread \'Dummy-1\'. [...] INTERNALERROR> /usr/lib/python3.9/site-packages/xdist/ dsession.py:190: AssertionError [gw6] node down: Not properly terminated
* Fri Apr 30 2021 Antonio Larrosa - Update to 1.4.12:
* There are many changes between the 1.4 and 1.3 branch so please check the full list at: https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html- Update to the 1.4 branch: Version 1.4 is taking on a different focus than other SQLAlchemy releases in that it is in many ways attempting to serve as a potential migration point for a more dramatic series of API changes currently planned for release 2.0 of SQLAlchemy.
* Python 3.6 is the minimum Python 3 version; Python 2.7 still supported
* ORM Query is internally unified with select, update, delete; 2.0 style execution available.
* Transparent SQL Compilation Caching added to All DQL, DML Statements in Core, ORM.
* Declarative is now integrated into the ORM with new features
* Python Dataclasses, attrs Supported w/ Declarative, Imperative Mappings.
* Asynchronous IO Support for Core and ORM
* Many Core and ORM statement objects now perform much of their construction and validation in the compile phase
* Repaired internal importing conventions such that code linters may work correctly
* Support for SQL Regular Expression operators
* SQLAlchemy 2.0 Deprecations Mode
* API and Behavioral Changes - Core - A SELECT statement is no longer implicitly considered to be a FROM clause - select().join() and outerjoin() add JOIN criteria to the current query, rather than creating a subquery - The URL object is now immutable - Changes to CreateEnginePlugin - select(), case() now accept positional expressions - All IN expressions render parameters for each value in the list on the fly (e.g. expanding parameters) - Built-in FROM linting will warn for any potential cartesian products in a SELECT statement - New Result object - RowProxy is no longer a “proxy”; is now called Row and behaves like an enhanced named tuple - Rationale: To behave more like a named tuple rather than a mapping - Proxying behavior goes away, was also unnecessary in modern usage - SELECT objects and derived FROM clauses allow for duplicate columns and column labels - Improved column labeling for simple column expressions using CAST or similar - New \"post compile\" bound parameters used for LIMIT/OFFSET in Oracle, SQL Server - Connection-level transactions can now be inactive based on subtransaction - Enum and Boolean datatypes no longer default to \"create constraint\"
* New Features - ORM - Raiseload for Columns - ORM Batch inserts with psycopg2 now batch statements with RETURNING in most cases - ORM Bulk Update and Delete use RETURNING for \"fetch\" strategy when available
* Behavioral Changes - ORM - The \"KeyedTuple\" object returned by Query is replaced by Row - Session features new “autobegin” behavior - Viewonly relationships don’t synchronize backrefs - cascade_backrefs behavior deprecated for removal in 2.0 - Eager loaders emit during unexpire operations - Accessing an uninitialized collection attribute on a transient object no longer mutates __dict__ - The \"New instance conflicts with existing identity\" error is now a warning - Persistence-related cascade operations disallowed with viewonly=True - Stricter behavior when querying inheritance mappings using custom queries
* Dialect Changes - psycopg2 version 2.7 or higher is required for the PostgreSQL psycopg2 dialect - psycopg2 dialect no longer has limitations regarding bound parameter names - psycopg2 dialect features \"execute_values\" with RETURNING for INSERT statements by default - Removed “join rewriting” logic from SQLite dialect; updated imports - Added Sequence support for MariaDB 10.3 - Added Sequence support distinct from IDENTITY to SQL Server
* For an explanation of each of those changes, check - https://docs.sqlalchemy.org/en/14/changelog/migration_14.html- For the full list of changes in each revision in the 1.4 branch please read:
* https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html- Do not build the python2 flavor. Python 2.7 is supposed to be supported but currently fails to build.- Rebase patch:
* tests_overcome_bpo42967.patch
* Tue Feb 23 2021 Matej Cepl - Add tests_overcome_bpo42967.patch to over effects of bpo#42967, which forbade mixing amps and semicolons in query strings as separators (gh#sqlalchemy/sqlalchemy#5969).
* Tue Feb 23 2021 Dirk Müller - update to 1.3.23:
* Release 1.3.23 contains an array of bugfixes specific to dialects such as Oracle, PostgreSQL, and MySQL.
* Wed Jan 20 2021 John Vandenberg - Skip one failing test on Python 3.6
 
ICM