]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
7 years ago- add "leaks memory" to documented issues w/ mysqlconnector,
Mike Bayer [Sat, 30 Jun 2018 22:30:25 +0000 (18:30 -0400)] 
- add "leaks memory" to documented issues w/ mysqlconnector,
references #4296

Change-Id: I5b663d3444d3732a83a32443c128faffe62f11d9
(cherry picked from commit c7d364b385e6c4605c50d0ee9264dfac0bc84dde)

7 years agoVersion 1.2.10 placeholder
Mike Bayer [Fri, 29 Jun 2018 17:45:17 +0000 (13:45 -0400)] 
Version 1.2.10 placeholder

7 years ago- 1.2.9 rel_1_2_9
Mike Bayer [Fri, 29 Jun 2018 17:36:01 +0000 (13:36 -0400)] 
- 1.2.9

7 years agoMerge "Add unique_constraint_name to MSSQL FK reflection" into rel_1_2
mike bayer [Fri, 29 Jun 2018 16:26:38 +0000 (12:26 -0400)] 
Merge "Add unique_constraint_name to MSSQL FK reflection" into rel_1_2

7 years agoFixed typo
Alex Grönholm [Mon, 25 Jun 2018 12:35:31 +0000 (15:35 +0300)] 
Fixed typo

The name of the strategy is `raise_on_sql` as indicated elsewhere in the documentation.

(cherry picked from commit 6daffe5406fcb4c4015229f0737a4c8218c66d76)

7 years agoAdd unique_constraint_name to MSSQL FK reflection
Sean Dunn [Fri, 29 Jun 2018 14:26:57 +0000 (10:26 -0400)] 
Add unique_constraint_name to MSSQL FK reflection

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.

Fixes: #4228
Change-Id: I7dabaaee0944e1030048826ba39fc574b0d63031
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/457
(cherry picked from commit ca94ea8ab583f8ab366ee5971bfc1bdd96e54cc9)

7 years agoMerge "Reflect ASC/DESC in MySQL index columns" into rel_1_2
mike bayer [Thu, 28 Jun 2018 23:48:33 +0000 (19:48 -0400)] 
Merge "Reflect ASC/DESC in MySQL index columns" into rel_1_2

7 years agoReflect ASC/DESC in MySQL index columns
Mike Bayer [Thu, 28 Jun 2018 18:33:14 +0000 (14:33 -0400)] 
Reflect ASC/DESC in MySQL index columns

Fixed bug in index reflection where on MySQL 8.0 an index that includes
ASC or DESC in an indexed column specfication would not be correctly
reflected, as MySQL 8.0 introduces support for returning this information
in a table definition string.

Change-Id: I21f64984ade690aac8c87dbe3aad0c1ee8e9727f
Fixes: #4293
(cherry picked from commit 9d2dc7911b7767b97814479d228072b6f566a864)

7 years agoUpdate URL for PyMySQL documentation
Logan Rosen [Thu, 28 Jun 2018 20:04:27 +0000 (16:04 -0400)] 
Update URL for PyMySQL documentation

(cherry picked from commit b694a309e89e7c3e57e83dd10e9a75c66672c396)

7 years agoVendor python3 formatargspec
Mike Bayer [Thu, 28 Jun 2018 15:49:02 +0000 (11:49 -0400)] 
Vendor python3 formatargspec

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.

Change-Id: I751652fac7f605a3a10b547ba8c5f34fef1de945
Fixes: #4291
(cherry picked from commit 536d5187a038a44aec624dd2a99792f49dec82ed)

7 years agoMerge "Add do_setinputsizes event for cx_Oracle" into rel_1_2
mike bayer [Thu, 28 Jun 2018 14:44:05 +0000 (10:44 -0400)] 
Merge "Add do_setinputsizes event for cx_Oracle" into rel_1_2

7 years agoTry to get mysqlconnector somewhat working
Mike Bayer [Wed, 27 Jun 2018 20:08:23 +0000 (16:08 -0400)] 
Try to get mysqlconnector somewhat working

Add CI support for MySQL connector and try to fix some of the
more obvious issues.  CI tests will run against MySQL 5.7
only for starters as there appear to be issues with
MySQL 8.0

Change-Id: Id8971143a8385a5c84f0646c21c4c21e793ce3a2
(cherry picked from commit 83750628d180b9b9e5a6ae9a2ecb3a001553cb81)

7 years agoAdd do_setinputsizes event for cx_Oracle
Mike Bayer [Tue, 26 Jun 2018 20:53:51 +0000 (16:53 -0400)] 
Add do_setinputsizes event for cx_Oracle

Added a new event currently used only by the cx_Oracle dialect,
:meth:`.DialectEvents.setiputsizes`.  The event passes a dictionary of
:class:`.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.

Change-Id: I43b97c8e3c840cad6f01edb274dc9cfed19cb5fc
Fixes: #4290
(cherry picked from commit c270efdfb38a266ac042be2a0d11b6ff7e5ee619)

7 years agoEnsure BakedQuery is cloned before we add options to it
Mike Bayer [Mon, 25 Jun 2018 02:50:06 +0000 (22:50 -0400)] 
Ensure BakedQuery is cloned before we add options to it

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.

Change-Id: Iaceecb50557f78484d09e55b3029a0483dfe873f
Fixes: #4286
(cherry picked from commit f243c00dda1484da97e706b7237670cdce6f10b9)

7 years agoMerge "fix TypeReflectionTest for sqlite 3.24" into rel_1_2
mike bayer [Tue, 26 Jun 2018 03:51:17 +0000 (23:51 -0400)] 
Merge "fix TypeReflectionTest for sqlite 3.24" into rel_1_2

7 years agoLook up adapter info for previous left side in chained query.join()
Mike Bayer [Wed, 13 Jun 2018 22:13:21 +0000 (18:13 -0400)] 
Look up adapter info for previous left side in chained query.join()

Fixed issue where chaining multiple join elements inside of
:meth:`.Query.join` might not correctly adapt to the previous left-hand
side, when chaining joined inheritance classes that share the same base
class.

Change-Id: I4b846430b7362912dbebf50599ec15a1eb978fd4
Fixes: #3505
(cherry picked from commit f683ddf16b34513d9f589202f2cdff9d0e0fad6b)

7 years agoMerge "Fix UnboundLocalError in mssql during isolation level grab" into rel_1_2
mike bayer [Tue, 26 Jun 2018 02:42:51 +0000 (22:42 -0400)] 
Merge "Fix UnboundLocalError in mssql during isolation level grab" into rel_1_2

7 years agoMerge "Support JOIN in UPDATE..FROM" into rel_1_2
mike bayer [Mon, 25 Jun 2018 22:39:26 +0000 (18:39 -0400)] 
Merge "Support JOIN in UPDATE..FROM" into rel_1_2

7 years agofix TypeReflectionTest for sqlite 3.24
Nils Philippsen [Sun, 24 Jun 2018 15:47:05 +0000 (11:47 -0400)] 
fix TypeReflectionTest for sqlite 3.24

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.

Change-Id: I396562cecb5ca774f29e9234845bcc6a399fc5cb
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/452
(cherry picked from commit 40a5d0a4b006780167976b296984eb9790f3df7f)

7 years agoFix UnboundLocalError in mssql during isolation level grab
Mike Bayer [Mon, 18 Jun 2018 14:12:56 +0000 (17:12 +0300)] 
Fix UnboundLocalError in mssql during isolation level grab

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.

Fixes: #4273
Co-authored-by: wikiped <wikiped@yandex.ru>
Change-Id: I39877c1f65f9cf8602fb1dceaf03072357759564
(cherry picked from commit e2913f65c4e5720394105584c69e7b9e8c2d373c)

7 years agoUse utf8mb4 (or utf8mb3) for all things MySQL
Mike Bayer [Sun, 24 Jun 2018 17:06:38 +0000 (13:06 -0400)] 
Use utf8mb4 (or utf8mb3) for all things 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.

Change-Id: Ib596ea7de4f69f976872a33bffa4c902d17dea25
Fixes: #4283
Fixes: #4192
(cherry picked from commit c99345ee9994c3ea2a5e6536cc3365f18d017cc1)

7 years agoCompare mappers more accurately in Load._chop_path
Mike Bayer [Mon, 25 Jun 2018 04:23:54 +0000 (00:23 -0400)] 
Compare mappers more accurately in Load._chop_path

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.

Change-Id: I2a69349d3e38814e2c7e6012fc04fbc0e47658a4
Fixes: #4287
(cherry picked from commit 7d2a581a58e9ca4ffbcb39a384ba6950a966de7a)

7 years agoMerge "render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL" into...
mike bayer [Sun, 24 Jun 2018 15:57:34 +0000 (11:57 -0400)] 
Merge "render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL" into rel_1_2

7 years agoSupport JOIN in UPDATE..FROM
Mike Bayer [Wed, 13 Jun 2018 19:59:35 +0000 (15:59 -0400)] 
Support JOIN in UPDATE..FROM

The :class:`.Update` construct now accommodates a :class:`.Join` 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.

Change-Id: I7b2bca627849384d5377abb0c94626463e4fad04
Fixes: #3645
(cherry picked from commit 58540ae93db30fb12f331587c32bb2d76db79ab3)

7 years agoRemove stale ON UPDATE/ON DELETE comment.
Andrew Gaul [Wed, 20 Jun 2018 00:29:34 +0000 (17:29 -0700)] 
Remove stale ON UPDATE/ON DELETE comment.

SQLite supports both of these features.

(cherry picked from commit 6bb50e12930dce0471f74b24f93b3ff1569d94dd)

7 years agorender WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL
Mike Bayer [Fri, 15 Jun 2018 02:17:00 +0000 (22:17 -0400)] 
render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL

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.

Also adds test suite support CTEs against backends.

Change-Id: I8ac337104d5c546dd4f0cd305632ffb56ac8bf90
Fixes: #4275
Fixes: #4230
(cherry picked from commit 3619edcb8aa3ceef2a44925b85315fc0e90c5982)

7 years agoLookup index columns in parent table by key for copy
Mike Bayer [Fri, 15 Jun 2018 02:56:21 +0000 (22:56 -0400)] 
Lookup index columns in parent table by key for copy

Fixed regression in 1.2 due to :ticket:`4147` where a :class:`.Table` that
has had some of its indexed columns redefined with new ones, as would occur
when overriding columns during reflection or when using
:paramref:`.Table.extend_existing`, such that the :meth:`.Table.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.

Change-Id: I521aa2c9f3baa0e84598bbdd6ffe4bf07b6e3ba8
Fixes: #4279
(cherry picked from commit 8f7766cc61479f3c9220c640230eeecd3d49ccc8)

7 years agoupdate client-side/server-side SQL default expression documentation
Mike Bayer [Wed, 13 Jun 2018 16:01:20 +0000 (12:01 -0400)] 
update client-side/server-side SQL default expression documentation

These docs were inaccurate and verbose, try to modernize them
with up to date information and add cues to allow the reader
to understand them quickly.

Change-Id: I997d9b8963d90c73f5960fe29d8f1b5005299da7
(cherry picked from commit da5323c2fae39aab45d305f723a73483563b2307)

7 years agoImporting InspectionAttr twice, now once
hendawy [Wed, 27 Dec 2017 14:02:43 +0000 (14:02 +0000)] 
Importing InspectionAttr twice, now once

Change-Id: Ifc250d9361bf277d4269f8b58d40ce056b29dd83
(cherry picked from commit 07444e39e3b0cc9cde620e67bea27708ff0fc3bc)
(cherry picked from commit 7ab8d604584972678b234836fae726207a24ba65)

7 years agoIterate options per path for baked cache key
Mike Bayer [Wed, 6 Jun 2018 20:35:34 +0000 (16:35 -0400)] 
Iterate options per path for baked cache key

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 original :class:`.Query` 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
:meth:`.Query.options` to prevent the same option objects from being
applied repeatedly.

Change-Id: I955fe2f50186abd8e753ad490fd3eb8f017e26f9
Fixes: #4270
(cherry picked from commit 006da86a398f98b899c04bb9e4eee2e9a4cf10d4)

7 years agoMerge "Support undocumented non-entity sequence Query argument" into rel_1_2
mike bayer [Wed, 6 Jun 2018 13:31:30 +0000 (09:31 -0400)] 
Merge "Support undocumented non-entity sequence Query argument" into rel_1_2

7 years agoMerge "Add Query.lazy_load_from attribute for sharding" into rel_1_2
mike bayer [Wed, 6 Jun 2018 13:29:42 +0000 (09:29 -0400)] 
Merge "Add Query.lazy_load_from attribute for sharding" into rel_1_2

7 years agoAdd the kwargs to the Adapt method
Fokko Driesprong [Mon, 4 Jun 2018 19:37:18 +0000 (21:37 +0200)] 
Add the kwargs to the Adapt method

This will override the original signature of the method:
https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/sql/type_api.py#L522

(cherry picked from commit 5bdab5b0eea21d51cc30652c7e3a713c89bfe013)

7 years agoSmall docs style fixes in inheritance.rst
BR [Mon, 4 Jun 2018 16:33:39 +0000 (12:33 -0400)] 
Small docs style fixes in inheritance.rst

Change-Id: I01d217cf1a8a1a8791e3b44167dfc4d6a0c77cdb
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/445
(cherry picked from commit 63307d201e0c442466e84863989774de2918bcd7)

7 years agoAdd Query.lazy_load_from attribute for sharding
Mike Bayer [Mon, 28 May 2018 17:03:14 +0000 (13:03 -0400)] 
Add Query.lazy_load_from attribute for sharding

Added new attribute :attr:`.Query.lazy_loaded_from` which is populated
with an :class:`.InstanceState` that is using this :class:`.Query` 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().

Also repaired an issue in the :meth:`.Result.with_post_criteria`
method added in I899808734458e25a023142c2c5bb37cbed869479
for :ticket:`4128` where the "unbake subquery loaders" version was calling
the post crtieria functions given the :class:`.Result` as the argument
rather than applying them to the :class:`.Query`.

Change-Id: I3c0919ce7fd151b80fe2f9b5f99f60df31c2d73d
Fixes: #4243
(cherry picked from commit a574b409296ef793cec8e1d00f1f7be48f15325e)

7 years agoSupport undocumented non-entity sequence Query argument
Mike Bayer [Fri, 1 Jun 2018 21:54:11 +0000 (16:54 -0500)] 
Support undocumented non-entity sequence Query argument

Fixed regression caused by :ticket:`4256` (itself a regression fix for
:ticket:`4228`) which breaks an undocumented behavior which converted for a
non-sequence of entities passed directly to the :class:`.Query` 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
to :class:`.Query`.

Change-Id: I97546f5ab5af29f37c86321f39d564f98a12daf5
Fixes: #4269
(cherry picked from commit 5628da627c4f248a817eafd72ecdf4793809f68d)

7 years agoVersion 1.2.9 placeholder
Mike Bayer [Mon, 28 May 2018 19:23:41 +0000 (15:23 -0400)] 
Version 1.2.9 placeholder

7 years ago- 1.2.8 rel_1_2_8
Mike Bayer [Mon, 28 May 2018 19:16:36 +0000 (15:16 -0400)] 
- 1.2.8

7 years agoMutex on _CONFIGURE_MUTEX in automap.prepare()
Mike Bayer [Sun, 27 May 2018 17:45:20 +0000 (13:45 -0400)] 
Mutex on _CONFIGURE_MUTEX in automap.prepare()

Fixed a race condition which could occur if automap
:meth:`.AutomapBase.prepare` were used within a multi-threaded context
against other threads which  may call :func:`.configure_mappers` as a
result of use of other mappers.  The unfinished mapping work of automap
is particularly sensitive to being pulled in by a
:func:`.configure_mappers` step leading to errors.

Change-Id: I6d36df6639bf5cb8f137187dff68f386f5e84f88
Fixes: #4266
(cherry picked from commit 2ac7cad7179ff594d8bb3df9856c891bf4e51097)

7 years agoTurn oracle BINARY_DOUBLE, BINARY_FLOAT, DOUBLE_PRECISION into floats
Mike Bayer [Wed, 23 May 2018 20:22:48 +0000 (16:22 -0400)] 
Turn oracle BINARY_DOUBLE, BINARY_FLOAT, DOUBLE_PRECISION into floats

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, :class:`.oracle.BINARY_FLOAT`,
:class:`.oracle.BINARY_DOUBLE` and :class:`.oracle.DOUBLE_PRECISION` now
subclass :class:`.Float`, since these are floating point datatypes, not
decimal.  These datatypes were already defaulting the
:paramref:`.Float.asdecimal` flag to False in line with what
:class:`.Float` already does.

Added reflection capabilities for the :class:`.oracle.BINARY_FLOAT`,
:class:`.oracle.BINARY_DOUBLE` datatypes.

Change-Id: Id99b912e83052654a17d07dc92b4dcb958cb7600
Fixes: #4264
(cherry picked from commit 28c7450b61beeb0bfb3d082cfcd12493c182e0ee)

7 years agocall setinputsizes() for integer types
Mike Bayer [Fri, 18 May 2018 16:51:40 +0000 (12:51 -0400)] 
call setinputsizes() for integer types

Altered the Oracle dialect such that when an :class:`.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.

Change-Id: Ida80cc2c2c37ffc0e05da4b5df2dadfab55a01f2
Fixes: #4259
(cherry picked from commit c7ae04d1c5c4aa6c6099584ae386d6ab9ef7b290)

7 years agoSkip for SQL Server on non-native boolean unconstrained
Mike Bayer [Thu, 17 May 2018 23:57:01 +0000 (19:57 -0400)] 
Skip for SQL Server on non-native boolean unconstrained

As SQL Server is now non-native boolean as of
I4765d2a2a00b0d14f50282603cc4d48d4739dac1 but uses the BIT
type, we need to constrain this test to continue to not
run against SQL Server.

Change-Id: I214faf2b788a0e8e10725622e3e71f3b70805533
(cherry picked from commit d2bacad469c0b07cc707b563e37e835abcf96eb8)

7 years agoMerge "Update dogpile.cache example to be compatible with baked query." into rel_1_2
mike bayer [Thu, 17 May 2018 21:26:01 +0000 (17:26 -0400)] 
Merge "Update dogpile.cache example to be compatible with baked query." into rel_1_2

7 years agoUpdate dogpile.cache example to be compatible with baked query.
Mike Bayer [Wed, 16 May 2018 20:31:40 +0000 (16:31 -0400)] 
Update dogpile.cache example to be compatible with baked query.

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
:ticket:`4256`.  The issue here is also worked-around by the fix in
:ticket:`4128`.

Note that this recipe requires
I3f86fcb12a6a9a89aa308b335e75c25969bcc30e in order for the
"advanced" example to work.

Change-Id: I9d35417f1d6c1906555583b8225d3da7f81736f7
Fixes: #4258
(cherry picked from commit 2c7f2954f793cbb4d991a870c1f725fc98e2e83f)

7 years agoFix string formatting TypeError if tuple is passed
Miguel Ventura [Mon, 14 May 2018 20:56:58 +0000 (16:56 -0400)] 
Fix string formatting TypeError if tuple is passed

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.

Change-Id: I50d5d32d5f80ec79703a42d4b19b42c2f9701f24
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/442
(cherry picked from commit 0b0b58c938c6a38fccc3e0ba59876b3b6b4f8009)

7 years agoMerge "Prevent double-checkins and guard during reset-on-return invalidations" into...
mike bayer [Thu, 17 May 2018 03:20:21 +0000 (23:20 -0400)] 
Merge "Prevent double-checkins and guard during reset-on-return invalidations" into rel_1_2

7 years agoChange query._identity_lookup into a normal instance method
Mike Bayer [Wed, 16 May 2018 15:16:57 +0000 (11:16 -0400)] 
Change query._identity_lookup into a normal instance method

Fixed regression in 1.2.7 caused by :ticket:`4228`, which itself was fixing
a 1.2-level regression, where the ``query_cls`` callable passed to a
:class:`.Session` was assumed to be a subclass of :class:`.Query`  with
class method availability, as opposed to an arbitrary callable.    In
particular, the dogpile caching example illustrates ``query_cls`` as a
function and not a :class:`.Query` subclass.

Change-Id: I3f86fcb12a6a9a89aa308b335e75c25969bcc30e
Fixes: #4256
(cherry picked from commit 3fa38a1a2313b4644daa431d629394d6bb14497a)

7 years agoMerge existing query params in baked lazy load
Mike Bayer [Mon, 26 Feb 2018 00:54:37 +0000 (19:54 -0500)] 
Merge existing query params in baked lazy load

Corrected backport, was supposed to be in 1.2.5 however
never got backported.

Fixed a long-standing regression that occurred in version
1.0, which prevented the use of a custom :class:`.MapperOption`
that alters the _params of a :class:`.Query` 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
:meth:`.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
:class:`.MapperOption` will now cause lazy loaders related to
the target object to use a non-baked query by default unless
the :meth:`.MapperOption._generate_cache_key` method is implemented.
In particular, this repairs one regression which occured 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,
the ``RelationshipCache`` 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 :ticket:`4258`.

This is a cherry-pick / squash from:
4a31c30fa5ebd6af0e72937b21b2e5ee79e12631
2e46f73f35b9036287f5f567c09a8cb786fe5fd3
b9f428a589a1718efa20e5555be45ae3f767e89e

Change-Id: I899808734458e25a023142c2c5bb37cbed869479
Fixes: #4128
7 years agoPrevent double-checkins and guard during reset-on-return invalidations
Mike Bayer [Tue, 15 May 2018 20:15:51 +0000 (16:15 -0400)] 
Prevent double-checkins and guard during reset-on-return invalidations

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 enclosing :class:`.Connection`
object (such as from calling :meth:`.Session.close` without a rollback or
commit, or calling :meth:`.Connection.close` without first closing a
transaction declared with :meth:`.Connection.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.

Change-Id: If5bb6941e36326846b14918c33ebfdd5604f642e
Fixes: #4252
(cherry picked from commit dada909a1009ad2f77063752ac8c13a7808dd916)

7 years agoMerge "Use identity_token for refresh(), unexpire, undefer" into rel_1_2
mike bayer [Sun, 13 May 2018 15:25:51 +0000 (11:25 -0400)] 
Merge "Use identity_token for refresh(), unexpire, undefer" into rel_1_2

7 years agoUse identity_token for refresh(), unexpire, undefer
Mike Bayer [Thu, 3 May 2018 16:35:23 +0000 (12:35 -0400)] 
Use identity_token for refresh(), unexpire, undefer

The horizontal sharding extension now makes use of the identity token
added to ORM identity keys as part of :ticket:`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.

Change-Id: Ib91637a65d94ace7405998b8410d62944a83f2eb
Fixes: #4247
(cherry picked from commit 4b71933489cae21ad94b71b0bc7271c075ad0dda)

7 years agoDefault server_version_info to (0, )
Mike Bayer [Fri, 11 May 2018 13:19:10 +0000 (09:19 -0400)] 
Default server_version_info to (0, )

Fixed a bug in the test suite where if an external dialect returned
``None`` for ``server_version_info``, the exclusion logic would raise an
``AttributeError``.

Change-Id: I9124d3ac5484941081127274e6eb71f392fb94f7
Fixes: #4249
(cherry picked from commit 29ce87273e3f66797d87edc9673fd3868e28249a)

7 years agoSQL Server is not native boolean; add new flag for CHECK constraint
Mike Bayer [Thu, 10 May 2018 15:39:06 +0000 (11:39 -0400)] 
SQL Server is not native boolean; add new flag for CHECK constraint

Fixed a 1.2 regression caused by :ticket:`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 <column>".   The SQL Server dialect now goes back to being
non-native boolean, but with an extra flag that still avoids creating
the CHECK constraint.

Change-Id: I4765d2a2a00b0d14f50282603cc4d48d4739dac1
Fixes: #4250
(cherry picked from commit bd1d6012dcbe5fbc6d1097a79d85b972b0d4fd8a)

7 years ago- add a tl;dr to postgresql search_path section as it's long
Mike Bayer [Sun, 6 May 2018 13:02:02 +0000 (09:02 -0400)] 
- add a tl;dr to postgresql search_path section as it's long
and will be easier to read if we know where it's going first.

Change-Id: I2766cf4655451ed514d4dc95ac60406b9f4a8ddb
(cherry picked from commit 513a6e5bcea5dccabaf86166906233542a4669e7)

7 years ago- modernize versioning examples
Mike Bayer [Sat, 5 May 2018 21:42:57 +0000 (17:42 -0400)] 
- modernize versioning examples
- add new example versioned_rows_w_versionid

Change-Id: I592cd5eb7db50162b4c4ad6191813d9def2b6d7c
(cherry picked from commit 70f8f6a169daa3e4f25f2b6983ff4750443a8307)

7 years ago- add sap-hana
Mike Bayer [Thu, 3 May 2018 13:59:36 +0000 (09:59 -0400)] 
- add sap-hana

Change-Id: Id3ddd78fceb31df40c5f00f8b21320b0da8488af
(cherry picked from commit 21b6ec97318e87ab1bf36acf469eb9deb9823e0e)

7 years ago- block cx_Oracle 6.3 due to https://github.com/oracle/python-cx_Oracle/issues/176
Mike Bayer [Tue, 1 May 2018 17:16:40 +0000 (13:16 -0400)] 
- block cx_Oracle 6.3 due to https://github.com/oracle/python-cx_Oracle/issues/176

Change-Id: If13288789f5f32eb3ffb18c774752bb68a9ffb2a
(cherry picked from commit 29c5f7a5d5dae47bef823804096cb4a7122ff8fa)

7 years agoFix reference leak in compiled cache
Olivier Grisel [Wed, 25 Apr 2018 13:54:00 +0000 (09:54 -0400)] 
Fix reference leak in compiled cache

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.

Change-Id: Icfb0f38111a165780f6dd3e4e3382a03df79ce26
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/441
(cherry picked from commit 30b02003a70f37aa83e20de6229afe2a3600b648)

7 years agoVersion 1.2.8 placeholder
Mike Bayer [Fri, 20 Apr 2018 20:35:53 +0000 (16:35 -0400)] 
Version 1.2.8 placeholder

7 years ago- 1.2.7 rel_1_2_7
Mike Bayer [Fri, 20 Apr 2018 20:28:18 +0000 (16:28 -0400)] 
- 1.2.7

7 years agoRefactor "get" to allow for pluggable identity token schemes
Mike Bayer [Fri, 20 Apr 2018 15:44:09 +0000 (11:44 -0400)] 
Refactor "get" to allow for pluggable identity token schemes

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 of ``ShardedQuery`` which should be noted for other
derivations of this class.

Change-Id: I04fa60535deec2d0cdec89f602935dfebeb9eb9d
Fixes: #4228
(cherry picked from commit 43f278356d94b5342a1020a9a97feea0bb7cd88f)

7 years ago- more type cache warmup
Mike Bayer [Fri, 20 Apr 2018 18:34:52 +0000 (14:34 -0400)] 
- more type cache warmup

Change-Id: I1b4327d38b5a09b73298c99f37919ee9f48aad0b
(cherry picked from commit 65ba2606be7f0eef2736270a099940ab2c218c4d)

7 years agobump variance for these sqlite-sensitive tests
Mike Bayer [Fri, 20 Apr 2018 17:53:18 +0000 (13:53 -0400)] 
bump variance for these sqlite-sensitive tests

Change-Id: I351c277afca7e53afc887c77a8b6dcaccf75d165
(cherry picked from commit c8bb359b7406b70cf964f8b3ed6a25bb0603ad5f)

7 years agoDocument how to opt-out of NCHAR for cx_Oracle
Mike Bayer [Fri, 20 Apr 2018 17:31:45 +0000 (13:31 -0400)] 
Document how to opt-out of NCHAR for cx_Oracle

Unfortunately, we need to bind Python unicode values as
NCHAR as in the case where non-ascii characters are present,
it's necessary.  We can't know in all cases how this value is being
used, so in those cases where Oracle will not accept NCHAR the
user should explicitly cast a value down to String.

Change-Id: I1a70739033435a7bf5effe2fa810ab064cea9188
Fixes: #4242
(cherry picked from commit e6e1c02c96b077700187420019194989ea55a646)

7 years agoupdate callcounts for py36, get rid of old callcounts
Mike Bayer [Fri, 20 Apr 2018 16:42:07 +0000 (12:42 -0400)] 
update callcounts for py36, get rid of old callcounts

Change-Id: Ib732ffa57c6c398d77ae2d3e0ac9b5cc09b40b4b
(cherry picked from commit 887636beb14235fb56af8e361d07d96de7ea152e)

7 years agoEnsure select_from_entity adapter is used in adjust_for_single_inheritance
Mike Bayer [Thu, 19 Apr 2018 21:07:32 +0000 (17:07 -0400)] 
Ensure select_from_entity adapter is used in adjust_for_single_inheritance

Fixed issue in single-inheritance loading where the use of an aliased
entity against a single-inheritance subclass in conjunction with the
:meth:`.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.

Change-Id: Ic2cbe94a5269c101b1f98da9a466180dd4452783
Fixes: #4241
(cherry picked from commit 4f2d0913fe4fe4f5182f85903a6b3be65ac4fd94)

7 years agoFix - Order of records is not guaranteed
Pat Buxton [Mon, 16 Apr 2018 14:06:13 +0000 (10:06 -0400)] 
Fix - Order of records is not guaranteed

 * Causes intermittent failure against Greenplum cluster
 * Tested using Greenplum dialact:
     https://github.com/PlaidCloud/sqlalchemy-greenplum

Change-Id: I6387e98f17a3667612fdaaadb27a08f79ec46398
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/440
(cherry picked from commit 5d5b9fe63d6d416bf21969bd1c27c1e1a754a2d3)

7 years agoReflect Oracle NUMBER(NULL, 0) as INTEGER
Kent Bower [Wed, 11 Apr 2018 21:21:26 +0000 (17:21 -0400)] 
Reflect Oracle NUMBER(NULL, 0) as INTEGER

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.

Change-Id: I4627febd46cab7085299c0a5700ee0f0bdca513c
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/437
(cherry picked from commit a3473c08d35e2cce32b014519df5f774c0166cf1)

7 years agoCorrect join for FKs with schema in SQL Server
Mike Bayer [Wed, 11 Apr 2018 13:29:00 +0000 (09:29 -0400)] 
Correct join for FKs with schema in SQL Server

Fixed 1.2 regression caused by :ticket:`4060` where the query used to
reflect SQL Server cross-schema foreign keys was limiting the criteria
incorrectly.

Additionally, added some rework of the inter-schema reflection tests
so that MySQL, MSSQL can be included, breaking out some of the
Postgresql-specific behaviors into separate requirements.

Fixes: #4234
Change-Id: I20c8e70707075f1767b79127c2c27d4b313c6515
(cherry picked from commit 9d5e117f6fcc38d8773bc943c615888dc8a3a819)

7 years agoEnsure all visit_sequence accepts **kw args
Mike Bayer [Wed, 4 Apr 2018 17:36:28 +0000 (13:36 -0400)] 
Ensure all visit_sequence accepts **kw args

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.

Change-Id: Ibdab7d340aea7429a210c9535ccf1a3e85f074fb
Fixes: #4231
(cherry picked from commit b4eb29253cb29a069973503f36d1103d4a18311c)

7 years agoUse base __ne__ implementation for range types w/ None
Mike Bayer [Tue, 3 Apr 2018 19:35:00 +0000 (15:35 -0400)] 
Use base __ne__ implementation for range types w/ None

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 Python ``None`` value.

Also break up range tests into backend round trip and straight
compilation suites.

Change-Id: Ibaee132b1ea7dac8b799495a27f98f82a7d9c028
Fixes: #4229
(cherry picked from commit e1ac5dc63cc13cfbabe0ec7fbb3521bfb1b7b750)

7 years agoAdd postgresl.REGCLASS type for casting table names to OIDs and vice versa
Sebastian Bank [Mon, 2 Apr 2018 15:25:08 +0000 (11:25 -0400)] 
Add postgresl.REGCLASS type for casting table names to OIDs and vice versa

Fixes: #4160
Change-Id: Id0bdbad1be3a0950dc8f35895ee13d9264244722
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/435
(cherry picked from commit 9f986ce10c6755af3f347a56f9ea03e0e2c5943e)

7 years agoFix bindparam type param fixes #4220
Mike Bayer [Sun, 1 Apr 2018 14:33:40 +0000 (10:33 -0400)] 
Fix bindparam type param fixes #4220

Change-Id: I0f40bc3145d4cab1a12d2174b9f0f60b4ce736f5
(cherry picked from commit 55371f4cffa730f65f1b687e9f6287d2ac189227)

7 years agoVersion 1.2.7 placeholder
Mike Bayer [Fri, 30 Mar 2018 20:29:53 +0000 (16:29 -0400)] 
Version 1.2.7 placeholder

7 years ago- 1.2.6 rel_1_2_6
Mike Bayer [Fri, 30 Mar 2018 20:24:20 +0000 (16:24 -0400)] 
- 1.2.6

7 years agoMerge "Add support for declarative partitioning in PostgreSQL 10" into rel_1_2
mike bayer [Fri, 30 Mar 2018 20:22:31 +0000 (16:22 -0400)] 
Merge "Add support for declarative partitioning in PostgreSQL 10" into rel_1_2

7 years agoAdd support for declarative partitioning in PostgreSQL 10
Vsevolod Solovyov [Thu, 15 Mar 2018 13:00:47 +0000 (09:00 -0400)] 
Add support for declarative partitioning in PostgreSQL 10

Added support for "PARTITION BY" in Postgresql table definitions,
using "postgresql_partition_by".  Pull request courtesy
Vsevolod Solovyov.

Change-Id: Id74d6882d7193fae1e5fd44b6e12d6852866fcc4
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/430
(cherry picked from commit 0174d698a8ed155b51cc44c503b10bc67b16dfc9)

7 years agoFilter non-integer characters from pyodbc SQL Server version
Mike Bayer [Fri, 30 Mar 2018 15:22:30 +0000 (11:22 -0400)] 
Filter non-integer characters from pyodbc SQL Server version

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.

Change-Id: I4ab18a07e19231091b5e877ba1fccd5eda72a992
Fixes: #4227
(cherry picked from commit f55c4f6bd2cb2f2b18e62159361ce7ecb5897396)

7 years agoInvalidate on failed connect handler
Mike Bayer [Wed, 28 Mar 2018 15:58:47 +0000 (11:58 -0400)] 
Invalidate on failed connect handler

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.

Change-Id: I61d6f4827a98ab8455f1c3e1c55d046eeccec09a
Fixes: #4225
(cherry picked from commit c5437296713288cbfcd323032ca48a75a97e10e5)

7 years agoLink to the ExpireRelationshipOnFKChange recipe for deletes
Mike Bayer [Mon, 26 Mar 2018 22:10:16 +0000 (18:10 -0400)] 
Link to the ExpireRelationshipOnFKChange recipe for deletes

The recipe now supports interception of delete() and a
corresponding update of related objects.

Change-Id: I2aa3bfdd477ceccff6cfb3e66ed73311705010c7

7 years agoDon't warn for mixin-based __table_args__, __mapper_args__ declared_attr
Mike Bayer [Wed, 21 Mar 2018 13:59:46 +0000 (09:59 -0400)] 
Don't warn for mixin-based __table_args__, __mapper_args__ declared_attr

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 overidding one
of these methods on a mapped class.  The warning still emits for regular
attribute names.

Change-Id: Iae7ed0bd625a2c163c910aa777cef4779128580a
Fixes: #4221
(cherry picked from commit 37955a52995cdbb66a9d5835c20ee58fb98ddffc)

7 years agoTrack if we're rendering within the CTE recursively
Mike Bayer [Wed, 14 Mar 2018 15:04:43 +0000 (11:04 -0400)] 
Track if we're rendering within the CTE recursively

Fixed a regression that occurred from the previous fix to :ticket:`4204` in
version 1.2.5, where a CTE that refers to itself after the
:meth:`.CTE.alias` method has been called would not refer to iself
correctly.

Change-Id: Iaa63d65ad2b90c8693f9953fbb32dbb10c73a037
Fixes: #4204
(cherry picked from commit ef2859bbc8bb8104bf4e429a52efb50a712d834a)

7 years agoIgnore non-primary mappers within mutable instrumentation
Mike Bayer [Mon, 12 Mar 2018 16:50:52 +0000 (12:50 -0400)] 
Ignore non-primary mappers within mutable instrumentation

Fixed bug where using :meth:`.Mutable.associate_with` or
:meth:`.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.

Change-Id: I2630d9f771a171aece03181ccf9159885f68f25e
Fixes: #4215
(cherry picked from commit 0fd508ad32a6f94653757a5ae10c1eae14e099fc)

7 years agoMerge "Raise cx_Oracle minimum version to 5.2" into rel_1_2
mike bayer [Thu, 8 Mar 2018 17:36:53 +0000 (12:36 -0500)] 
Merge "Raise cx_Oracle minimum version to 5.2" into rel_1_2

7 years agoMake it much more clear that concrete mapping is limited
Mike Bayer [Wed, 7 Mar 2018 23:05:07 +0000 (18:05 -0500)] 
Make it much more clear that concrete mapping is limited

Change-Id: Icb2ea787b0defbf5f1244b144759c1e8acff3f0f
(cherry picked from commit ea20a1181774a282de298d75212af6f8daf359c9)

7 years agoRaise cx_Oracle minimum version to 5.2
Mike Bayer [Wed, 7 Mar 2018 21:27:26 +0000 (16:27 -0500)] 
Raise cx_Oracle minimum version to 5.2

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.

Change-Id: I6fa4238f1722789924f4a6473fdce6f524333825
Fixes: #4211
(cherry picked from commit 4982a250a9b22795b47caf5fc42225689c1da919)

7 years agoAdd notes regarding flat=True
Mike Bayer [Wed, 7 Mar 2018 21:03:07 +0000 (16:03 -0500)] 
Add notes regarding flat=True

Start documenting that flat=True and aliased=True don't work
with selectable particularly when selectable is an aliased select
already.  References #4212

Change-Id: I6e576165f06387350ae97e43ad979e575a4912b9

7 years agocherry-pick changelog update for 1.1.19
Mike Bayer [Tue, 6 Mar 2018 19:10:39 +0000 (14:10 -0500)] 
cherry-pick changelog update for 1.1.19

(cherry picked from commit beab362b2e892fe11d0526064eabd136d3b1f8ee)

7 years agocherry-pick changelog from 1.1.18
Mike Bayer [Tue, 6 Mar 2018 19:10:39 +0000 (14:10 -0500)] 
cherry-pick changelog from 1.1.18

(cherry picked from commit 8cc7e589d242384f1b468149767d31df50277457)

7 years agoVersion 1.2.6 placeholder
Mike Bayer [Tue, 6 Mar 2018 18:58:22 +0000 (13:58 -0500)] 
Version 1.2.6 placeholder

7 years ago- 1.2.5 rel_1_2_5
Mike Bayer [Tue, 6 Mar 2018 18:51:31 +0000 (13:51 -0500)] 
- 1.2.5

7 years ago- add missing versions for #4208
Mike Bayer [Tue, 6 Mar 2018 18:18:30 +0000 (13:18 -0500)] 
- add missing versions for #4208

Change-Id: I307b4b81e472cb6473d201fece26753878dd38f1

7 years agoMerge "Add Query.enable_single_entity()" into rel_1_2
mike bayer [Tue, 6 Mar 2018 17:49:52 +0000 (12:49 -0500)] 
Merge "Add Query.enable_single_entity()" into rel_1_2

7 years agoMerge "Clone _cte_alias instead of assigning "self"" into rel_1_2
mike bayer [Tue, 6 Mar 2018 17:49:07 +0000 (12:49 -0500)] 
Merge "Clone _cte_alias instead of assigning "self"" into rel_1_2

7 years agoAdd Query.enable_single_entity()
Eric Atkin [Wed, 28 Feb 2018 21:00:38 +0000 (16:00 -0500)] 
Add Query.enable_single_entity()

Added new feature :meth:`.Query.only_return_tuples`.  Causes the
:class:`.Query` object to return keyed tuple objects unconditionally even
if the query is against a single entity.   Pull request courtesy Eric
Atkin.

Change-Id: Ib0b7f5f78431aa68082e5b200ed577daa4222336
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/425
(cherry picked from commit 451f81ef53a8065db20257af2a4a245196cc07d9)

7 years agoClone _cte_alias instead of assigning "self"
Mike Bayer [Tue, 6 Mar 2018 02:36:18 +0000 (21:36 -0500)] 
Clone _cte_alias instead of assigning "self"

Fixed bug in :class:.`CTE` construct along the same lines as that of
:ticket:`4204` where a :class:`.CTE` that was aliased would not copy itself
correctly during a "clone" operation as is frequent within the ORM as well
as when using the :meth:`.ClauseElement.params` method.

Change-Id: Id68d72dd244dedfc7bd6116c9a5123c51a55ea20
Fixes: #4210
(cherry picked from commit 9a13f007e2342def94cc7362eeadd5ec8c988340)

7 years agoDon't include AliasedClass when pickling options
Mike Bayer [Mon, 5 Mar 2018 19:48:00 +0000 (14:48 -0500)] 
Don't include AliasedClass when pickling options

Fixed 1.2 regression where a mapper option that contains an
:class:`.AliasedClass` object, as is typical when using the
:meth:`.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.

Change-Id: I4b36a422b7c0e6a6da7ee3ba3ab282c13917a31f
Fixes: #4209
(cherry picked from commit 08a8e8cf3b06ed9eb4003f5727a3551d2b479509)

7 years agoOnly replace first occurrence for COLLATE/ARRAY syntax
Mike Bayer [Mon, 5 Mar 2018 16:33:30 +0000 (11:33 -0500)] 
Only replace first occurrence for COLLATE/ARRAY syntax

Fixed bug in Postgresql COLLATE / ARRAY adjustment first introduced
in :ticket:`4006` where new behaviors in Python 3.7 regular expressions
caused the fix to fail.

Change-Id: Ied3893d7cac210befa0277b55b3b895b0ba1f0d2
Fixes: #4208
7 years agoAdd python 3.7 environment
Mike Bayer [Mon, 5 Mar 2018 14:43:26 +0000 (09:43 -0500)] 
Add python 3.7 environment

Change-Id: I4ed7bd6ffd1c8c9b5169cf21709ec19801580126
(cherry picked from commit 243f980479c8c05e927a39af649db6dfb67993f4)

7 years agoGet MySQL version info from @@version
Mike Bayer [Fri, 2 Mar 2018 20:08:08 +0000 (15:08 -0500)] 
Get MySQL version info from @@version

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.

Change-Id: Iafd39be8c9bf1982d58b34cc997ae1016ad6c48c
Fixes: #4205
(cherry picked from commit 9ba77e8d3b682bff89fdab5e80271a96a52fe8c8)