]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
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 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)

7 years agonew default branch for gitreview
Mike Bayer [Fri, 2 Mar 2018 19:28:33 +0000 (14:28 -0500)] 
new default branch for gitreview

Change-Id: I78d9086893a5e4a3c85febe56faf477fb32204c2

7 years ago- add some seealsos for the transient object that loads use case
Mike Bayer [Fri, 2 Mar 2018 16:58:52 +0000 (11:58 -0500)] 
- add some seealsos for the transient object that loads use case

Change-Id: Ibfa79a3721f31806223906cccf4547673b3d42f1

7 years agoCheck existing CTE for an alias name when rendering FROM clause
Mike Bayer [Thu, 1 Mar 2018 15:45:39 +0000 (10:45 -0500)] 
Check existing CTE for an alias name when rendering FROM clause

Fixed bug in CTE rendering where a :class:`.CTE` that was also turned into
an :class:`.Alias` would not render its "ctename AS aliasname" clause
appropriately if there were more than one reference to the CTE in a FROM
clause.

Change-Id: If8cff27a2f4faa5eceb59aa86398db6edb3b9e72
Fixes: #4204
(cherry picked from commit 5f60dc649cde2525f5eb1e7008a75304603b751c)

7 years agoFix enable_relationship_loading() works fine w/ one-to-many
Mike Bayer [Fri, 2 Mar 2018 15:45:42 +0000 (10:45 -0500)] 
Fix enable_relationship_loading() works fine w/ one-to-many

Change-Id: I6efb62afa02be4d42482cfdbec739a5c6ab32bd7
(cherry picked from commit fde2f77fd1978d4162ab01bc05bb5c793bc733b2)

7 years agoMerge remote-tracking branch 'origin/pr/421'
Mike Bayer [Tue, 27 Feb 2018 19:46:30 +0000 (14:46 -0500)] 
Merge remote-tracking branch 'origin/pr/421'

7 years agoMerge "Ensure we have states to load when doing poly post load"
mike bayer [Fri, 23 Feb 2018 20:14:46 +0000 (15:14 -0500)] 
Merge "Ensure we have states to load when doing poly post load"

7 years agoMerge "Allow bind processors to work with expanding IN"
mike bayer [Fri, 23 Feb 2018 19:21:44 +0000 (14:21 -0500)] 
Merge "Allow bind processors to work with expanding IN"

7 years agoEnsure we have states to load when doing poly post load
Mike Bayer [Fri, 23 Feb 2018 18:55:17 +0000 (13:55 -0500)] 
Ensure we have states to load when doing poly post load

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".

Change-Id: I721cf5fdf0b9fd2289067d5d2c6bc87fb2436f07
Fixes: #4199
7 years agoAllow bind processors to work with expanding IN
Mike Bayer [Fri, 23 Feb 2018 00:47:24 +0000 (19:47 -0500)] 
Allow bind processors to work with expanding IN

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.

Change-Id: I8e2420d7229a3e253e43b5227ebb98f9fe0bd14a
Fixes: #4198
7 years agocherry-pick changelog update for 1.1.18
Mike Bayer [Thu, 22 Feb 2018 21:16:11 +0000 (16:16 -0500)] 
cherry-pick changelog update for 1.1.18

7 years agocherry-pick changelog from 1.1.17
Mike Bayer [Thu, 22 Feb 2018 21:16:11 +0000 (16:16 -0500)] 
cherry-pick changelog from 1.1.17

7 years agoVersion 1.2.5 placeholder
Mike Bayer [Thu, 22 Feb 2018 21:05:34 +0000 (16:05 -0500)] 
Version 1.2.5 placeholder

7 years ago- 1.2.4 rel_1_2_4
Mike Bayer [Thu, 22 Feb 2018 20:57:22 +0000 (15:57 -0500)] 
- 1.2.4

7 years agoQuote cte alias if needed
Eric Atkin [Thu, 22 Feb 2018 19:16:14 +0000 (14:16 -0500)] 
Quote cte alias if needed

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.

Fixes: #4197
Change-Id: Ib8573e82b9a1ca94b50c7c5d73ee98b79465d689
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/426

7 years agoMerge "Ensure mapping has no version_id_generator when checking missing version_id"
mike bayer [Thu, 22 Feb 2018 18:41:14 +0000 (13:41 -0500)] 
Merge "Ensure mapping has no version_id_generator when checking missing version_id"

7 years agoEnsure mapping has no version_id_generator when checking missing version_id
Mike Bayer [Wed, 21 Feb 2018 16:16:09 +0000 (11:16 -0500)] 
Ensure mapping has no version_id_generator when checking missing version_id

Fixed 1.2 regression in ORM versioning feature where a mapping against a
:func:`.select` or :func:`.alias` that also used a versioning column
against the underlying table would fail due to the check added as part of
:ticket:`3673`.

See also #4194 and #4195 for related issues found regarding
mapped selects and versioning.

Change-Id: Ifabe9a5c8c1bfa72db5029faa7a5dbf71f0a7ca0
Fixes: #4193
7 years agoMerge "Default to using current mapped class as owner if none found"
mike bayer [Tue, 20 Feb 2018 22:52:11 +0000 (17:52 -0500)] 
Merge "Default to using current mapped class as owner if none found"

7 years agoDefault to using current mapped class as owner if none found
Mike Bayer [Tue, 20 Feb 2018 17:15:57 +0000 (12:15 -0500)] 
Default to using current mapped class as owner if none found

Repaired regression caused in 1.2.3 and 1.1.16 regarding association proxy
objects, revising the approach to :ticket:`4185` when calculating the
"owning class" of an association proxy to default to choosing the current
class if the proxy object is not directly associated with a mapped class,
such as a mixin.

Change-Id: I87d0ac09f695dc285bd4bbe0a547f1d5ce23e068
Fixes: #4185
7 years agoMerge "Implement remove() for _empty_collection"
mike bayer [Mon, 19 Feb 2018 23:19:01 +0000 (18:19 -0500)] 
Merge "Implement remove() for _empty_collection"

7 years agoRewrite the "deleting from collections" section
Mike Bayer [Mon, 19 Feb 2018 23:13:24 +0000 (18:13 -0500)] 
Rewrite the "deleting from collections" section

This section documents an aspect of the ORM that is
more generalized than just collections as well as more general
than just using session.delete(), even though session.delete()
with collections is the most common use case.   Try to expand
out the scope here to explain the situation from the perspective
of any kind of relationship, include example with delete cascade
with many-to-one as well.

Change-Id: Ifacb91f90951d1b0da6dbadc2d72273d79b756e2
Fixes: #4191
7 years agoImplement remove() for _empty_collection
Mike Bayer [Mon, 19 Feb 2018 21:59:42 +0000 (16:59 -0500)] 
Implement remove() for _empty_collection

Fixed regression caused in 1.2.3 due to fix from :ticket:`4181` where
the changes to the event system involving :class:`.Engine` and
:class:`.OptionEngine` did not accommodate for event removals, which
would raise an ``AttributeError`` when invoked at the class
level.

Change-Id: I1c9083829d74dd710716d28b0eaca4fa15e86313
Fixes: #4190
7 years agoVersion 1.2.4 placeholder
Mike Bayer [Fri, 16 Feb 2018 23:22:07 +0000 (18:22 -0500)] 
Version 1.2.4 placeholder

7 years ago- 1.2.3 rel_1_2_3
Mike Bayer [Fri, 16 Feb 2018 23:15:47 +0000 (18:15 -0500)] 
- 1.2.3

7 years agoRemove erroneous skip message
Mike Bayer [Fri, 16 Feb 2018 23:13:30 +0000 (18:13 -0500)] 
Remove erroneous skip message

The logic here seems to try to say something different when
__backend__ is True but it produces a nonsensical message,
since __only_on__ doesn't tell us about the implementation
we are actually running.

Change-Id: I14e20cadcba975f8efe8fdefa439c8b8c480b3ed

7 years ago- add missing forwards ports for bug fixes
Mike Bayer [Fri, 16 Feb 2018 22:52:23 +0000 (17:52 -0500)] 
- add missing forwards ports for bug fixes

Change-Id: If94964cb0294f7f082759ecce71771c35ea4a2bd

7 years agocherry-pick changelog update for 1.1.17
Mike Bayer [Fri, 16 Feb 2018 22:36:46 +0000 (17:36 -0500)] 
cherry-pick changelog update for 1.1.17

7 years agocherry-pick changelog from 1.1.16
Mike Bayer [Fri, 16 Feb 2018 22:36:45 +0000 (17:36 -0500)] 
cherry-pick changelog from 1.1.16

7 years agofix formatting
Mike Bayer [Fri, 16 Feb 2018 21:54:43 +0000 (16:54 -0500)] 
fix formatting

Change-Id: Ie4687c970508cf8bf183e342db6b89a8aca9d6f9
(cherry picked from commit 055821630bb43d6dccce36f814c55ba306eb9363)

7 years agoMerge "Test attributes for being non-mapped column properties more closely"
mike bayer [Fri, 16 Feb 2018 14:39:26 +0000 (09:39 -0500)] 
Merge "Test attributes for being non-mapped column properties more closely"

7 years agoTest attributes for being non-mapped column properties more closely
Mike Bayer [Thu, 15 Feb 2018 22:42:48 +0000 (17:42 -0500)] 
Test attributes for being non-mapped column properties more closely

Fixed bug in concrete inheritance mapping where user-defined
attributes such as hybrid properties that mirror the names
of mapped attributes from sibling classes would be overwritten by
the mapper as non-accessible at the instance level.  Also
ensured that user-bound descriptors are not implicitly invoked at the class
level during the mapper configuration stage.

Change-Id: I52b84a15c296b14efeaffb72941fc941d1d52c0d
Fixes: #4188
7 years agoAdd ssl "operation timed out" message for psycopg2
André Cruz [Thu, 15 Feb 2018 16:09:47 +0000 (11:09 -0500)] 
Add ssl "operation timed out" message for psycopg2

Added "SSL SYSCALL error: Operation timed out" to the list
of messages that trigger a "disconnect" scenario for the
psycopg2 driver.  Pull request courtesy André Cruz.

Change-Id: Ie1a8fc97e74b6906ccacf53dad70fed973c42b7f
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/3

7 years agoMerge remote-tracking branch 'origin/pr/416'
Mike Bayer [Wed, 14 Feb 2018 16:03:37 +0000 (11:03 -0500)] 
Merge remote-tracking branch 'origin/pr/416'

7 years agoFix typo in python example
Anton Vlasenko [Wed, 14 Feb 2018 10:31:36 +0000 (11:31 +0100)] 
Fix typo in python example

7 years agoAllow multiple plugin names
Mike Bayer [Tue, 13 Feb 2018 20:11:53 +0000 (15:11 -0500)] 
Allow multiple plugin names

The :class:`.URL` object now allows query keys to be specified multiple
times where their values will be joined into a list.  This is to support
the plugins feature documented at :class:`.CreateEnginePlugin` which
documents that "plugin" can be passed multiple times. Additionally, the
plugin names can be passed to :func:`.create_engine` outside of the URL
using the new :paramref:`.create_engine.plugins` parameter.

Change-Id: Ifc48ad120bd6c6204eda567492caf79832aeeaa5
Fixes: #4170
7 years agoMerge "Add dependency for parent_pre post updates to parent deletes"
mike bayer [Tue, 13 Feb 2018 03:22:44 +0000 (22:22 -0500)] 
Merge "Add dependency for parent_pre post updates to parent deletes"

7 years agoAdd dependency for parent_pre post updates to parent deletes
Mike Bayer [Mon, 12 Feb 2018 21:45:39 +0000 (16:45 -0500)] 
Add dependency for parent_pre post updates to parent deletes

Fixed issue in post_update feature where an UPDATE is emitted
when the parent object has been deleted but the dependent object
is not.   This issue has existed for a long time however
since 1.2 now asserts rows matched for post_update, this
was raising an error.

Change-Id: I31b1d22408e358962577435f0c4cb9a456ba0872
Fixes: #4187
7 years agoSearch through mapper superclass hierarchy for owner
Mike Bayer [Fri, 9 Feb 2018 21:12:31 +0000 (16:12 -0500)] 
Search through mapper superclass hierarchy for owner

Fixed regression caused by fix for issue :ticket:`4116` affecting versions
1.2.2 as well as 1.1.15, which had the effect of mis-calculation of the
"owning class" of an :class:`.AssociationProxy` as the ``NoneType`` class
in some declarative mixin/inheritance situations as well as if the
association proxy were accessed off of an un-mapped class.  The "figure out
the owner" logic has been replaced by an in-depth routine that searches
through the complete mapper hierarchy assigned to the class or subclass to
determine the correct (we hope) match; will not assign the owner if no
match is found.  An exception is now raised if the proxy is used
against an un-mapped instance.

Change-Id: I611b590df2babe077ce6c19bea89e84251d1a7f4
Fixes: #4185
7 years agoMerge "Add initiator argument to set_attribute"
mike bayer [Fri, 9 Feb 2018 13:41:33 +0000 (08:41 -0500)] 
Merge "Add initiator argument to set_attribute"

7 years agoAdd initiator argument to set_attribute
Mike Bayer [Thu, 8 Feb 2018 14:16:39 +0000 (09:16 -0500)] 
Add initiator argument to set_attribute

Added new argument :paramref:`.attributes.set_attribute.inititator`
to the :func:`.attributes.set_attribute` function, allowing an
event token received from a listener function to be propagated
to subsequent set events.

Change-Id: I6ede21e42153026ab46a1d2ec33aa3f999db98e2

7 years agoEnsure weakref finalize_fairy operates upon the current connection
Mike Bayer [Thu, 8 Feb 2018 19:52:29 +0000 (14:52 -0500)] 
Ensure weakref finalize_fairy operates upon the current connection

Fixed a fairly serious connection pool bug where a connection that is
acquired after being refreshed as a result of a user-defined
:class:`.DisconnectionError` or due to the 1.2-released "pre_ping" feature
would not be correctly reset if the connection were returned to the pool by
weakref cleanup (e.g. the front-facing object is garbage collected); the
weakref would still refer to the previously invalidated DBAPI connection
which would have the reset operation erroneously called upon it instead.
This would lead to stack traces in the logs and a connection being checked
into the pool without being reset, which can cause locking issues.

Change-Id: Iabd9f3a63a1d0207d0de0054a6ced3560818cf9c
Fixes: #4184
7 years ago- re-disable oracle tests here as we are getting lots
Mike Bayer [Thu, 8 Feb 2018 22:39:19 +0000 (17:39 -0500)] 
- re-disable oracle tests here as we are getting lots
of oracle timeouts on CI now

Change-Id: I021d304d6aaf6bfa223dd0e5bb6b0c20e9c8657f

7 years ago- fix formatting
Mike Bayer [Thu, 8 Feb 2018 21:46:56 +0000 (16:46 -0500)] 
- fix formatting

Change-Id: Ic919048462520de8de84174a5e366d6c85316e87

7 years agoAdd values_callable feature to Enum
Jon Snyder [Wed, 17 Jan 2018 21:37:59 +0000 (16:37 -0500)] 
Add values_callable feature to Enum

Added support for :class:`.Enum` to persist the values of the enumeration,
rather than the keys, when using a Python pep-435 style enumerated object.
The user supplies a callable function that will return the string values to
be persisted.  This allows enumerations against non-string values to be
value-persistable as well.  Pull request courtesy Jon Snyder.

Pull-request: https://github.com/zzzeek/sqlalchemy/pull/410
Fixes: #3906
Change-Id: Id385465d215d1e5baaad68368b168afdd846b82c

7 years agoMerge "Add flag for class-level disallow of events, apply to OptionEngine"
mike bayer [Thu, 8 Feb 2018 01:58:47 +0000 (20:58 -0500)] 
Merge "Add flag for class-level disallow of events, apply to OptionEngine"

7 years agoAdd flag for class-level disallow of events, apply to OptionEngine
Mike Bayer [Tue, 6 Feb 2018 23:13:27 +0000 (18:13 -0500)] 
Add flag for class-level disallow of events, apply to OptionEngine

Fixed bug where events associated with an :class:`Engine`
at the class level would be doubled when the
:meth:`.Engine.execution_options` method were used.  To
achieve this, the semi-private class :class:`.OptionEngine`
no longer accepts events directly at the class level
and will raise an error; the class only propagates class-level
events from its parent :class:`.Engine`.   Instance-level
events continue to work as before.

The comments present another way of doing this where we would
copy events from the parent engine at option time rather
than linking the event listeners, but this would be a behavioral
change that adding new events to the parent engine would not
take effect for an already-created OptionEngine.

Change-Id: Id128516f54103fbad9a2210d6571eceb59c8b0cb
Fixes: #4181
7 years agoMerge "Check cx_Oracle error code on all exception classes"
mike bayer [Thu, 8 Feb 2018 01:54:10 +0000 (20:54 -0500)] 
Merge "Check cx_Oracle error code on all exception classes"

7 years agoCheck cx_Oracle error code on all exception classes
Mike Bayer [Tue, 6 Feb 2018 20:47:43 +0000 (15:47 -0500)] 
Check cx_Oracle error code on all exception classes

Fixed bug in cx_Oracle disconnect detection, used by pre_ping and other
features, where an error could be raised as DatabaseError which includes a
numeric error code; previously we weren't checking in this case for a
disconnect code.

Change-Id: I359bb5ede25a4726ea632b81af83c6391f405ae1
Fixes: #4182