Releases: sqlalchemy/sqlalchemy
1.2.12
1.2.12
Released: September 19, 2018
-
[bug] [postgresql] Fixed bug in PostgreSQL dialect where compiler keyword arguments such as
literal_binds=True
were not being propagated to a DISTINCT ON
expression.References: #4325
-
[bug] [ext] Fixed issue where
BakedQuery
did not include the specific query
class used by theSession
as part of the cache key, leading to
incompatibilities when using custom query classes, in particular the
ShardedQuery
which has some different argument signatures.References: #4328
-
[bug] [postgresql] Fixed the
postgresql.array_agg()
function, which is a slightly
altered version of the usualfunctions.array_agg()
function, to also
accept an incoming "type" argument without forcing an ARRAY around it,
essentially the same thing that was fixed for the generic function in 1.1
in #4107.References: #4324
-
[bug] [postgresql] Fixed bug in PostgreSQL ENUM reflection where a case-sensitive, quoted name
would be reported by the query including quotes, which would not match a
target column during table reflection as the quotes needed to be stripped
off.References: #4323
-
[bug] [orm] Added a check within the weakref cleanup for the
InstanceState
object to check for the presence of thedict
builtin, in an effort to
reduce error messages generated when these cleanups occur during interpreter
shutdown. Pull request courtesy Romuald Brunet. -
[bug] [declarative] [orm] Fixed bug where the declarative scan for attributes would receive the
expression proxy delivered by a hybrid attribute at the class level, and
not the hybrid attribute itself, when receiving the descriptor via the
@declared_attr
callable on a subclass of an already-mapped class. This
would lead to an attribute that did not report itself as a hybrid when
viewed withinMapper.all_orm_descriptors
.References: #4326
-
[bug] [orm] Fixed bug where use of
Lateral
construct in conjunction with
Query.join()
as well asQuery.select_entity_from()
would not
apply clause adaption to the right side of the join. "lateral" introduces
the use case of the right side of a join being correlatable. Previously,
adaptation of this clause wasn't considered. Note that in 1.2 only,
a selectable introduced byQuery.subquery()
is still not adapted
due to #4304; the selectable needs to be produced by the
select()
function to be the right side of the "lateral" join.References: #4334
-
[bug] [oracle] Fixed issue for cx_Oracle 7.0 where the behavior of Oracle param.getvalue()
now returns a list, rather than a single scalar value, breaking
autoincrement logic throughout the Core and ORM. The dml_ret_array_val
compatibility flag is used for cx_Oracle 6.3 and 6.4 to establish compatible
behavior with 7.0 and forward, for cx_Oracle 6.2.1 and prior a version
number check falls back to the old logic.References: #4335
-
[bug] [orm] Fixed 1.2 regression caused by #3472 where the handling of an
"updated_at" style column within the context of a post-update operation
would also occur for a row that is to be deleted following the update,
meaning both that a column with a Python-side value generator would show
the now-deleted value that was emitted for the UPDATE before the DELETE
(which was not the previous behavior), as well as that a SQL- emitted value
generator would have the attribute expired, meaning the previous value
would be unreachable due to the row having been deleted and the object
detached from the session.The "postfetch" logic that was added as part of
#3472 is now skipped entirely for an object that ultimately is to
be deleted.References: #4327
1.2.11
1.2.11
Released: August 20, 2018
-
[bug] [py3k] Started importing "collections" from "collections.abc" under Python 3.3 and
greater for Python 3.8 compatibility. Pull request courtesy Nathaniel
Knight. -
Fixed issue where the "schema" name used for a SQLite database within table
reflection would not quote the schema name correctly. Pull request
courtesy Phillip Cloud. -
[bug] [sql] Fixed issue that is closely related to #3639 where an expression
rendered in a boolean context on a non-native boolean backend would
be compared to 1/0 even though it is already an implicitly boolean
expression, whenColumnElement.self_group()
were used. While this
does not affect the user-friendly backends (MySQL, SQLite) it was not
handled by Oracle (and possibly SQL Server). Whether or not the
expression is implicitly boolean on any database is now determined
up front as an additional check to not generate the integer comparison
within the compilation of the statement.References: #4320
-
[bug] [oracle] For cx_Oracle, Integer datatypes will now be bound to "int", per advice
from the cx_Oracle developers. Previously, using cx_Oracle.NUMBER caused a
loss in precision within the cx_Oracle 6.x series.References: #4309
-
[bug] [declarative] [orm] Fixed issue in previously untested use case, allowing a declarative mapped
class to inherit from a classically-mapped class outside of the declarative
base, including that it accommodates for unmapped intermediate classes. An
unmapped intermediate class may specify__abstract__
, which is now
interpreted correctly, or the intermediate class can remain unmarked, and
the classically mapped base class will be detected within the hierarchy
regardless. In order to anticipate existing scenarios which may be mixing
in classical mappings into existing declarative hierarchies, an error is
now raised if multiple mapped bases are detected for a given class.References: #4321
-
[bug] [sql] Added missing window function parameters
WithinGroup.over.range_
andWithinGroup.over.rows
parameters to theWithinGroup.over()
and
FunctionFilter.over()
methods, to correspond to the range/rows
feature added to the "over" method of SQL functions as part of
#3049 in version 1.1.References: #4322
-
[bug] [sql] Fixed bug where the multi-table support for UPDATE and DELETE statements
did not consider the additional FROM elements as targets for correlation,
when a correlated SELECT were also combined with the statement. This
change now includes that a SELECT statement in the WHERE clause for such a
statement will try to auto-correlate back to these additional tables in the
parent UPDATE/DELETE or unconditionally correlate if
Select.correlate()
is used. Note that auto-correlation raises an
error if the SELECT statement would have no FROM clauses as a result, which
can now occur if the parent UPDATE/DELETE specifies the same tables in its
additional set of tables; specifySelect.correlate()
explicitly to
resolve.References: #4313
1.2.10
1.2.10
Released: July 13, 2018
-
[bug] [sql] Fixed bug where a
Sequence
would be dropped explicitly before any
Table
that refers to it, which breaks in the case when the
sequence is also involved in a server-side default for that table, when
usingMetaData.drop_all()
. The step which processes sequences
to be dropped via non server-side column default functions is now invoked
after the table itself is dropped.References: #4300
-
[bug] [orm] Fixed bug in
Bundle
construct where placing two columns of the
same name would be de-duplicated, when theBundle
were used as
part of the rendered SQL, such as in the ORDER BY or GROUP BY of the statement.References: #4295
-
[bug] [orm] Fixed regression in 1.2.9 due to #4287 where using a
Load
option in conjunction with a string wildcard would result
in a TypeError.References: #4298
1.2.9
1.2.9
Released: June 29, 2018
-
[bug] [mysql] Fixed percent-sign doubling in mysql-connector-python dialect, which does
not require de-doubling of percent signs. Additionally, the mysql-
connector-python driver is inconsistent in how it passes the column names
in cursor.description, so a workaround decoder has been added to
conditionally decode these randomly-sometimes-bytes values to unicode only
if needed. Also improved test support for mysql-connector-python, however
it should be noted that this driver still has issues with unicode that
continue to be unresolved as of yet. -
[bug] [mssql] Fixed bug in MSSQL reflection where when two same-named tables in different
schemas had same-named primary key constraints, foreign key constraints
referring to one of the tables would have their columns doubled, causing
errors. Pull request courtesy Sean Dunn.References: #4288
-
[bug] [sql] Fixed regression in 1.2 due to #4147 where a
Table
that
has had some of its indexed columns redefined with new ones, as would occur
when overriding columns during reflection or when using
Table.extend_existing
, such that theTable.tometadata()
method would fail when attempting to copy those indexes as they still
referred to the replaced column. The copy logic now accommodates for this
condition.References: #4279
-
[bug] [mysql] Fixed bug in index reflection where on MySQL 8.0 an index that includes
ASC or DESC in an indexed column specification would not be correctly
reflected, as MySQL 8.0 introduces support for returning this information
in a table definition string.References: #4293
-
[bug] [orm] Fixed issue where chaining multiple join elements inside of
Query.join()
might not correctly adapt to the previous left-hand
side, when chaining joined inheritance classes that share the same base
class.References: #3505
-
[bug] [orm] Fixed bug in cache key generation for baked queries which could cause a
too-short cache key to be generated for the case of eager loads across
subclasses. This could in turn cause the eagerload query to be cached in
place of a non-eagerload query, or vice versa, for a polymorhic "selectin"
load, or possibly for lazy loads or selectin loads as well.References: #4287
-
[bug] [sqlite] Fixed issue in test suite where SQLite 3.24 added a new reserved word that
conflicted with a usage in TypeReflectionTest. Pull request courtesy Nils
Philippsen. -
[feature] [oracle] Added a new event currently used only by the cx_Oracle dialect,
DialectEvents.setiputsizes()
. The event passes a dictionary of
BindParameter
objects to DBAPI-specific type objects that will be
passed, after conversion to parameter names, to the cx_Oracle
cursor.setinputsizes()
method. This allows both visibility into the
setinputsizes process as well as the ability to alter the behavior of what
datatypes are passed to this method.References: #4290
-
[bug] [orm] Fixed bug in new polymorphic selectin loading where the BakedQuery used
internally would be mutated by the given loader options, which would both
inappropriately mutate the subclass query as well as carry over the effect
to subsequent queries.References: #4286
-
[bug] [py3k] Replaced the usage of inspect.formatargspec() with a vendored version
copied from the Python standard library, as inspect.formatargspec()
is deprecated and as of Python 3.7.0 is emitting a warning.References: #4291
-
[ext] [feature] Added new attribute
Query.lazy_loaded_from
which is populated
with anInstanceState
that is using thisQuery
in
order to lazy load a relationship. The rationale for this is that
it serves as a hint for the horizontal sharding feature to use, such that
the identity token of the state can be used as the default identity token
to use for the query within id_chooser().References: #4243
-
[bug] [mysql] Fixed bug in MySQLdb dialect and variants such as PyMySQL where an
additional "unicode returns" check upon connection makes explicit use of
the "utf8" character set, which in MySQL 8.0 emits a warning that utf8mb4
should be used. This is now replaced with a utf8mb4 equivalent.
Documentation is also updated for the MySQL dialect to specify utf8mb4 in
all examples. Additional changes have been made to the test suite to use
utf8mb3 charsets and databases (there seem to be collation issues in some
edge cases with utf8mb4), and to support configuration default changes made
in MySQL 8.0 such as explicit_defaults_for_timestamp as well as new errors
raised for invalid MyISAM indexes.References: #4283
-
[bug] [mysql] The
Update
construct now accommodates aJoin
object
as supported by MySQL for UPDATE..FROM. As the construct already
accepted an alias object for a similar purpose, the feature of UPDATE
against a non-table was already implied so this has been added.References: #3645
-
[bug] [mssql] [py3k] Fixed issue within the SQL Server dialect under Python 3 where when running
against a non-standard SQL server database that does not contain either the
"sys.dm_exec_sessions" or "sys.dm_pdw_nodes_exec_sessions" views, leading
to a failure to fetch the isolation level, the error raise would fail due
to an UnboundLocalError.References: #4273
-
[bug] [orm] Fixed regression caused by #4256 (itself a regression fix for
#4228) which breaks an undocumented behavior which converted for a
non-sequence of entities passed directly to theQuery
constructor
into a single-element sequence. While this behavior was never supported or
documented, it's already in use so has been added as a behavioral contract
toQuery
.References: #4269
-
[bug] [orm] Fixed an issue that was both a performance regression in 1.2 as well as an
incorrect result regarding the "baked" lazy loader, involving the
generation of cache keys from the originalQuery
object's loader
options. If the loader options were built up in a "branched" style using
common base elements for multiple options, the same options would be
rendered into the cache key repeatedly, causing both a performance issue as
well as generating the wrong cache key. This is fixed, along with a
performance improvement when such "branched" options are applied via
Query.options()
to prevent the same option objects from being
applied repeatedly.References: #4270
-
[bug] [mysql] [oracle] Fixed INSERT FROM SELECT with CTEs for the Oracle and MySQL dialects, where
the CTE was being placed above the entire statement as is typical with
other databases, however Oracle and MariaDB 10.2 wants the CTE underneath
the "INSERT" segment. Note that the Oracle and MySQL dialects don't yet
work when a CTE is applied to a subquery inside of an UPDATE or DELETE
statement, as the CTE is still applied to the top rather than inside the
subquery.References: #4275
1.2.8
1.2.8
Released: May 28, 2018
-
[bug] [orm] Fixed regression in 1.2.7 caused by #4228, which itself was fixing
a 1.2-level regression, where thequery_cls
callable passed to a
Session
was assumed to be a subclass ofQuery
with
class method availability, as opposed to an arbitrary callable. In
particular, the dogpile caching example illustratesquery_cls
as a
function and not aQuery
subclass.References: #4256
-
[bug] [engine] Fixed connection pool issue whereby if a disconnection error were raised
during the connection pool's "reset on return" sequence in conjunction with
an explicit transaction opened against the enclosingConnection
object (such as from callingSession.close()
without a rollback or
commit, or callingConnection.close()
without first closing a
transaction declared withConnection.begin()
), a double-checkin would
result, which could then lead towards concurrent checkouts of the same
connection. The double-checkin condition is now prevented overall by an
assertion, as well as the specific double-checkin scenario has been
fixed.References: #4252
-
[bug] [oracle] The Oracle BINARY_FLOAT and BINARY_DOUBLE datatypes now participate within
cx_Oracle.setinputsizes(), passing along NATIVE_FLOAT, so as to support the
NaN value. Additionally,oracle.BINARY_FLOAT
,
oracle.BINARY_DOUBLE
andoracle.DOUBLE_PRECISION
now
subclassFloat
, since these are floating point datatypes, not
decimal. These datatypes were already defaulting the
Float.asdecimal
flag to False in line with what
Float
already does.References: #4264
-
[bug] [oracle] Added reflection capabilities for the
oracle.BINARY_FLOAT
,
oracle.BINARY_DOUBLE
datatypes. -
[bug] [ext] The horizontal sharding extension now makes use of the identity token
added to ORM identity keys as part of #4137, when an object
refresh or column-based deferred load or unexpiration operation occurs.
Since we know the "shard" that the object originated from, we make
use of this value when refreshing, thereby avoiding queries against
other shards that don't match this object's identity in any case.References: #4247
-
[bug] [sql] Fixed issue where the "ambiguous literal" error message used when
interpreting literal values as SQL expression values would encounter a
tuple value, and fail to format the message properly. Pull request courtesy
Miguel Ventura. -
[bug] [mssql] Fixed a 1.2 regression caused by #4061 where the SQL Server
"BIT" type would be considered to be "native boolean". The goal here
was to avoid creating a CHECK constraint on the column, however the bigger
issue is that the BIT value does not behave like a true/false constant
and cannot be interpreted as a standalone expression, e.g.
"WHERE ". The SQL Server dialect now goes back to being
non-native boolean, but with an extra flag that still avoids creating
the CHECK constraint.References: #4250
-
[bug] [oracle] Altered the Oracle dialect such that when an
Integer
type is in
use, the cx_Oracle.NUMERIC type is set up for setinputsizes(). In
SQLAlchemy 1.1 and earlier, cx_Oracle.NUMERIC was passed for all numeric
types unconditionally, and in 1.2 this was removed to allow for better
numeric precision. However, for integers, some database/client setups
will fail to coerce boolean values True/False into integers which introduces
regressive behavior when using SQLAlchemy 1.2. Overall, the setinputsizes
logic seems like it will need a lot more flexibility going forward so this
is a start for that.References: #4259
-
[bug] [engine] Fixed a reference leak issue where the values of the parameter dictionary
used in a statement execution would remain referenced by the "compiled
cache", as a result of storing the key view used by Python 3 dictionary
keys(). Pull request courtesy Olivier Grisel. -
[bug] [orm] Fixed a long-standing regression that occurred in version
1.0, which prevented the use of a customMapperOption
that alters the _params of aQuery
object for a
lazy load, since the lazy loader itself would overwrite those
parameters. This applies to the "temporal range" example
on the wiki. Note however that the
Query.populate_existing()
method is now required in
order to rewrite the mapper options associated with an object
already loaded in the identity map.As part of this change, a custom defined
MapperOption
will now cause lazy loaders related to
the target object to use a non-baked query by default unless
theMapperOption._generate_cache_key()
method is implemented.
In particular, this repairs one regression which occurred when
using the dogpile.cache "advanced" example, which was not
returning cached results and instead emitting SQL due to an
incompatibility with the baked query loader; with the change,
theRelationshipCache
option included for many releases
in the dogpile example will disable the "baked" query altogether.
Note that the dogpile example is also modernized to avoid both
of these issues as part of issue #4258.References: #4128
-
[bug] [ext] Fixed a race condition which could occur if automap
AutomapBase.prepare()
were used within a multi-threaded context
against other threads which may callconfigure_mappers()
as a
result of use of other mappers. The unfinished mapping work of automap
is particularly sensitive to being pulled in by a
configure_mappers()
step leading to errors.References: #4266
-
[bug] [orm] Fixed bug where the new
baked.Result.with_post_criteria()
method would not interact with a subquery-eager loader correctly,
in that the "post criteria" would not be applied to embedded
subquery eager loaders. This is related to #4128 in that
the post criteria feature is now used by the lazy loader. -
[bug] [tests] Fixed a bug in the test suite where if an external dialect returned
None
forserver_version_info
, the exclusion logic would raise an
AttributeError
.References: #4249
-
[bug] [orm] Updated the dogpile.caching example to include new structures that
accommodate for the "baked" query system, which is used by default within
lazy loaders and some eager relationship loaders. The dogpile.caching
"relationship_caching" and "advanced" examples were also broken due to
#4256. The issue here is also worked-around by the fix in
#4128.References: #4258
1.2.7
1.2.7
Released: April 20, 2018
-
[bug] [orm] Fixed regression in 1.2 within sharded query feature where the
new "identity_token" element was not being correctly considered within
the scope of a lazy load operation, when searching the identity map
for a related many-to-one element. The new behavior will allow for
making use of the "id_chooser" in order to determine the best identity
key to retrieve from the identity map. In order to achieve this, some
refactoring of 1.2's "identity_token" approach has made some slight changes
to the implementation ofShardedQuery
which should be noted for other
derivations of this class.References: #4228
-
[bug] [postgresql] Fixed bug where the special "not equals" operator for the PostgreSQL
"range" datatypes such as DATERANGE would fail to render "IS NOT NULL" when
compared to the PythonNone
value.References: #4229
-
[bug] [mssql] Fixed 1.2 regression caused by #4060 where the query used to
reflect SQL Server cross-schema foreign keys was limiting the criteria
incorrectly.References: #4234
-
[bug] [oracle] The Oracle NUMBER datatype is reflected as INTEGER if the precision is NULL
and the scale is zero, as this is how INTEGER values come back when
reflected from Oracle's tables. Pull request courtesy Kent Bower. -
[feature] [postgresql] Added new PG type
postgresql.REGCLASS
which assists in casting
table names to OID values. Pull request courtesy Sebastian Bank.References: #4160
-
[bug] [sql] Fixed issue where the compilation of an INSERT statement with the
"literal_binds" option that also uses an explicit sequence and "inline"
generation, as on PostgreSQL and Oracle, would fail to accommodate the
extra keyword argument within the sequence processing routine.References: #4231
-
[bug] [orm] Fixed issue in single-inheritance loading where the use of an aliased
entity against a single-inheritance subclass in conjunction with the
Query.select_from()
method would cause the SQL to be rendered with
the unaliased table mixed in to the query, causing a cartesian product. In
particular this was affecting the new "selectin" loader when used against a
single-inheritance subclass.References: #4241
1.2.6
1.2.6
Released: March 30, 2018
-
[bug] [mssql] Adjusted the SQL Server version detection for pyodbc to only allow for
numeric tokens, filtering out non-integers, since the dialect does tuple-
numeric comparisons with this value. This is normally true for all known
SQL Server / pyodbc drivers in any case.References: #4227
-
[feature] [postgresql] Added support for "PARTITION BY" in PostgreSQL table definitions,
using "postgresql_partition_by". Pull request courtesy
Vsevolod Solovyov. -
[bug] [sql] Fixed a regression that occurred from the previous fix to #4204 in
version 1.2.5, where a CTE that refers to itself after the
CTE.alias()
method has been called would not refer to itself
correctly.References: #4204
-
[bug] [engine] Fixed bug in connection pool where a connection could be present in the
pool without all of its "connect" event handlers called, if a previous
"connect" handler threw an exception; note that the dialects themselves
have connect handlers that emit SQL, such as those which set transaction
isolation, which can fail if the database is in a non-available state, but
still allows a connection. The connection is now invalidated first if any
of the connect handlers fail.References: #4225
-
[bug] [oracle] The minimum cx_Oracle version supported is 5.2 (June 2015). Previously,
the dialect asserted against version 5.0 but as of 1.2.2 we are using some
symbols that did not appear until 5.2.References: #4211
-
[bug] [declarative] Removed a warning that would be emitted when calling upon
__table_args__
,__mapper_args__
as named with a@declared_attr
method, when called from a non-mapped declarative mixin. Calling these
directly is documented as the approach to use when one is overriding one
of these methods on a mapped class. The warning still emits for regular
attribute names.References: #4221
-
[bug] [orm] Fixed bug where using
Mutable.associate_with()
or
Mutable.as_mutable()
in conjunction with a class that has non-
primary mappers set up with alternatively-named attributes would produce an
attribute error. Since non-primary mappers are not used for persistence,
the mutable extension now excludes non-primary mappers from its
instrumentation steps.References: #4215
1.2.5
1.2.5
Released: March 6, 2018
-
[bug] [mysql] MySQL dialects now query the server version using
SELECT @@version
explicitly to the server to ensure we are getting the correct version
information back. Proxy servers like MaxScale interfere with the value
that is passed to the DBAPI's connection.server_version value so this
is no longer reliable.This change is also backported to: 1.1.18
References: #4205
-
[bug] [postgresql] [py3k] Fixed bug in PostgreSQL COLLATE / ARRAY adjustment first introduced
in #4006 where new behaviors in Python 3.7 regular expressions
caused the fix to fail.This change is also backported to: 1.1.18
References: #4208
-
[bug] [sql] Fixed bug in :class:.
CTE
construct along the same lines as that of
#4204 where aCTE
that was aliased would not copy itself
correctly during a "clone" operation as is frequent within the ORM as well
as when using theClauseElement.params()
method.References: #4210
-
[bug] [orm] Fixed bug in new "polymorphic selectin" loading when a selection of
polymorphic objects were to be partially loaded from a relationship
lazy loader, leading to an "empty IN" condition within the load that
raises an error for the "inline" form of "IN".References: #4199
-
[bug] [sql] Fixed bug in CTE rendering where a
CTE
that was also turned into
anAlias
would not render its "ctename AS aliasname" clause
appropriately if there were more than one reference to the CTE in a FROM
clause.References: #4204
-
[bug] [orm] Fixed 1.2 regression where a mapper option that contains an
AliasedClass
object, as is typical when using the
QueryableAttribute.of_type()
method, could not be pickled. 1.1's
behavior was to omit the aliased class objects from the path, so this
behavior is restored.References: #4209
-
[feature] [orm] Added new feature
Query.only_return_tuples()
. Causes the
Query
object to return keyed tuple objects unconditionally even
if the query is against a single entity. Pull request courtesy Eric
Atkin. -
[bug] [sql] Fixed bug in new "expanding IN parameter" feature where the bind parameter
processors for values wasn't working at all, tests failed to cover this
pretty basic case which includes that ENUM values weren't working.References: #4198
v1.1.18
1.1.18
Released: March 6, 2018
postgresql
-
[postgresql] [bug] [py3k] Fixed bug in PostgreSQL COLLATE / ARRAY adjustment first introduced
in #4006 where new behaviors in Python 3.7 regular expressions
caused the fix to fail.References: #4208
mysql
-
[mysql] [bug] MySQL dialects now query the server version using
SELECT @@version
explicitly to the server to ensure we are getting the correct version
information back. Proxy servers like MaxScale interfere with the value
that is passed to the DBAPI's connection.server_version value so this
is no longer reliable.References: #4205
1.2.4
1.2.4
Released: February 22, 2018
-
[bug] [orm] Fixed 1.2 regression in ORM versioning feature where a mapping against a
select()
oralias()
that also used a versioning column
against the underlying table would fail due to the check added as part of
#3673.References: #4193
-
[bug] [engine] Fixed regression caused in 1.2.3 due to fix from #4181 where
the changes to the event system involvingEngine
and
OptionEngine
did not accommodate for event removals, which
would raise anAttributeError
when invoked at the class
level.References: #4190
-
[bug] [sql] Fixed bug where CTE expressions would not have their name or alias name
quoted when the given name is case sensitive or otherwise requires quoting.
Pull request courtesy Eric Atkin.References: #4197