Path to this page:
Subject: CVS commit: pkgsrc/databases/py-sqlalchemy
From: Adam Ciarcinski
Date: 2019-08-26 12:26:49
Message id: 20190826102649.A8C8DFBF4@cvs.NetBSD.org
Log Message:
py-sqlalchemy: updated to 1.3.7
1.3.7
Released: August 14, 2019
orm
[orm] [bug]
Fixed regression caused by new selectinload for many-to-one logic where a \
primaryjoin condition not based on real foreign keys would cause KeyError if a \
related object did not exist for a given key value on the parent object.
[orm] [bug]
Fixed bug where using Query.first() or a slice expression in conjunction with a \
query that has an expression based “offset” applied would raise TypeError, \
due to an “or” conditional against “offset” that did not expect it to be \
a SQL expression as opposed to an integer or None.
sql
[sql] [bug]
Fixed issue where Index object which contained a mixture of functional \
expressions which were not resolvable to a particular column, in combination \
with string-based column names, would fail to initialize its internal state \
correctly leading to failures during DDL compilation.
[sql] [bug]
Fixed bug where TypeEngine.column_expression() method would not be applied to \
subsequent SELECT statements inside of a UNION or other CompoundSelect, even \
though the SELECT statements are rendered at the topmost level of the statement. \
New logic now differentiates between rendering the column expression, which is \
needed for all SELECTs in the list, vs. gathering the returned data type for the \
result row, which is needed only for the first SELECT.
[sql] [bug]
Fixed issue where internal cloning of SELECT constructs could lead to a key \
error if the copy of the SELECT changed its state such that its list of columns \
changed. This was observed to be occurring in some ORM scenarios which may be \
unique to 1.3 and above, so is partially a regression fix.
postgresql
[postgresql] [usecase]
Added new dialect flag for the psycopg2 dialect, executemany_mode which \
supersedes the previous experimental use_batch_mode flag. executemany_mode \
supports both the “execute batch” and “execute values” functions \
provided by psycopg2, the latter which is used for compiled insert() constructs. \
Pull request courtesy Yuval Dinari.
See also
Psycopg2 Fast Execution Helpers
mysql
[mysql] [bug]
The MySQL dialects will emit “SET NAMES” at the start of a connection when \
charset is given to the MySQL driver, to appease an apparent behavior observed \
in MySQL 8.0 that raises a collation error when a UNION includes string columns \
unioned against columns of the form CAST(NULL AS CHAR(..)), which is what \
SQLAlchemy’s polymorphic_union function does. The issue seems to have affected \
PyMySQL for at least a year, however has recently appeared as of mysqlclient \
1.4.4 based on changes in how this DBAPI creates a connection. As the presence \
of this directive impacts three separate MySQL charset settings which each have \
intricate effects based on their presense, SQLAlchemy will now emit the \
directive on new connections to ensure correct behavior.
[mysql] [bug]
Added another fix for an upstream MySQL 8 issue where a case sensitive table \
name is reported incorrectly in foreign key constraint reflection, this is an \
extension of the fix first added for 4344 which affects a case sensitive column \
name. The new issue occurs through MySQL 8.0.17, so the general logic of the \
88718 fix remains in place.
See also
https://bugs.mysql.com/bug.php?id=96365 - upstream bug
[mysql] [usecase]
Added reserved words ARRAY and MEMBER to the MySQL reserved words list, as MySQL \
8.0 has now made these reserved.
sqlite
[sqlite] [bug]
The dialects that support json are supposed to take arguments json_serializer \
and json_deserializer at the create_engine() level, however the SQLite dialect \
calls them _json_serilizer and _json_deserilalizer. The names have been \
corrected, the old names are accepted with a change warning, and these \
parameters are now documented as create_engine.json_serializer and \
create_engine.json_deserializer.
[sqlite] [bug]
Fixed bug where usage of “PRAGMA table_info” in SQLite dialect meant that \
reflection features to detect for table existence, list of table columns, and \
list of foreign keys, would default to any table in any attached database, when \
no schema name was given and the table did not exist in the base schema. The fix \
explicitly runs PRAGMA for the ‘main’ schema and then the ‘temp’ schema \
if the ‘main’ returned no rows, to maintain the behavior of tables + temp \
tables in the “no schema” namespace, attached tables only in the \
“schema” namespace.
mssql
[mssql] [usecase]
Added new mssql.try_cast() construct for SQL Server which emits “TRY_CAST” \
syntax. Pull request courtesy Leonel Atencio.
misc
[bug] [events]
Fixed issue in event system where using the once=True flag with dynamically \
generated listener functions would cause event registration of future events to \
fail if those listener functions were garbage collected after they were used, \
due to an assumption that a listened function is strongly referenced. The \
“once” wrapped is now modified to strongly reference the inner function \
persistently, and documentation is updated that using “once” does not imply \
automatic de-registration of listener functions.
1.3.6
orm
[orm] [feature]
Added new loader option method Load.options() which allows loader options to be \
constructed hierarchically, so that many sub-options can be applied to a \
particular path without needing to call defaultload() many times. Thanks to \
Alessio Bogon for the idea.
[orm] [bug]
Fixed regression caused by 4365 where a join from an entity to itself without \
using aliases no longer raises an informative error message, instead failing on \
an assertion. The informative error condition has been restored.
[orm] [bug]
Fixed an issue where the orm._ORMJoin.join() method, which is a \
not-internally-used ORM-level method that exposes what is normally an internal \
process of Query.join(), did not propagate the full and outerjoin keyword \
arguments correctly. Pull request courtesy Denis Kataev.
[orm] [bug]
Fixed bug where a many-to-one relationship that specified uselist=True would \
fail to update correctly during a primary key change where a related column \
needs to change.
[orm] [bug]
Fixed bug where the detection for many-to-one or one-to-one use with a \
“dynamic” relationship, which is an invalid configuration, would fail to \
raise if the relationship were configured with uselist=True. The current fix is \
that it warns, instead of raises, as this would otherwise be backwards \
incompatible, however in a future release it will be a raise.
[orm] [bug]
Fixed bug where a synonym created against a mapped attribute that does not exist \
yet, as is the case when it refers to backref before mappers are configured, \
would raise recursion errors when trying to test for attributes on it which \
ultimately don’t exist (as occurs when the classes are run through Sphinx \
autodoc), as the unconfigured state of the synonym would put it into an \
attribute not found loop.
[orm] [performance]
The optimization applied to selectin loading in 4340 where a JOIN is not needed \
to eagerly load related items is now applied to many-to-one relationships as \
well, so that only the related table is queried for a simple join condition. In \
this case, the related items are queried based on the value of a foreign key \
column on the parent; if these columns are deferred or otherwise not loaded on \
any of the parent objects in the collection, the loader falls back to the JOIN \
method.
engine
[engine] [bug]
Fixed bug where using reflection function such as MetaData.reflect() with an \
Engine object that had execution options applied to it would fail, as the \
resulting OptionEngine proxy object failed to include a .engine attribute used \
within the reflection routines.
sql
[sql] [bug]
Adjusted the initialization for Enum to minimize how often it invokes the \
.__members__ attribute of a given PEP-435 enumeration object, to suit the case \
where this attribute is expensive to invoke, as is the case for some popular \
third party enumeration libraries.
[sql] [bug] [postgresql]
oduce the correct operator precedence in combination with the array index operator.
[sql] [bug]
Fixed an unlikely issue where the “corresponding column” routine for unions \
and other CompoundSelect objects could return the wrong column in some \
overlapping column situtations, thus potentially impacting some ORM operations \
when set operations are in use, if the underlying select() constructs were used \
previously in other similar kinds of routines, due to a cached value not being \
cleared.
postgresql
[postgresql] [usecase]
Added support for reflection of indexes on PostgreSQL partitioned tables, which \
was added to PostgreSQL as of version 11.
[postgresql] [usecase]
Added support for multidimensional Postgresql array literals via nesting the \
postgresql.array object within another one. The multidimensional array type is \
detected automatically.
See also
postgresql.array
mysql
[mysql] [bug]
Fixed bug where the special logic to render “NULL” for the TIMESTAMP \
datatype when nullable=True would not work if the column’s datatype were a \
TypeDecorator or a Variant. The logic now ensures that it unwraps down to the \
original TIMESTAMP so that this special case NULL keyword is correctly rendered \
when requested.
[mysql] [bug]
Enhanced MySQL/MariaDB version string parsing to accommodate for exotic MariaDB \
version strings where the “MariaDB” word is embedded among other \
alphanumeric characters such as “MariaDBV1”. This detection is critical in \
order to correctly accommodate for API features that have split between MySQL \
and MariaDB such as the “transaction_isolation” system variable.
sqlite
[sqlite] [usecase]
Added support for composite (tuple) IN operators with SQLite, by rendering the \
VALUES keyword for this backend. As other backends such as DB2 are known to use \
the same syntax, the syntax is enabled in the base compiler using a \
dialect-level flag tuple_in_values. The change also includes support for \
“empty IN tuple” expressions for SQLite when using “in_()” between a \
tuple value and an empty set.
mssql
[mssql] [bug]
Ensured that the queries used to reflect indexes and view definitions will \
explicitly CAST string parameters into NVARCHAR, as many SQL Server drivers \
frequently treat string values, particularly those with non-ascii characters or \
larger string values, as TEXT which often don’t compare correctly against \
VARCHAR characters in SQL Server’s information schema tables for some reason. \
These CAST operations already take place for reflection queries against SQL \
Server information_schema. tables but were missing from three additional queries \
that are against sys. tables.
Files: