]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
7 years ago- fix linking for the query.rst page
Mike Bayer [Wed, 4 Jul 2018 21:48:31 +0000 (17:48 -0400)] 
- fix linking for the query.rst page

Change-Id: I269fdd72e372e1bf4f0f85e9fc8e6938adc4f686

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

7 years agocherry-pick changelog update for 1.2.10
Mike Bayer [Fri, 29 Jun 2018 17:45:17 +0000 (13:45 -0400)] 
cherry-pick changelog update for 1.2.10

7 years agocherry-pick changelog from 1.2.9
Mike Bayer [Fri, 29 Jun 2018 17:45:16 +0000 (13:45 -0400)] 
cherry-pick changelog from 1.2.9

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

7 years agoMerge remote-tracking branch 'origin/pr/456'
Mike Bayer [Fri, 29 Jun 2018 15:08:23 +0000 (11:08 -0400)] 
Merge remote-tracking branch 'origin/pr/456'

Change-Id: Id1d26d756f26e8cece921f476bc3f49689a3b782

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

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

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
7 years agoMerge "Vendor python3 formatargspec"
mike bayer [Thu, 28 Jun 2018 17:41:18 +0000 (13:41 -0400)] 
Merge "Vendor python3 formatargspec"

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
7 years agoMerge "Add do_setinputsizes event for cx_Oracle"
mike bayer [Thu, 28 Jun 2018 14:43:00 +0000 (10:43 -0400)] 
Merge "Add do_setinputsizes event for cx_Oracle"

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

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
7 years agoMerge "Ensure BakedQuery is cloned before we add options to it"
mike bayer [Tue, 26 Jun 2018 22:00:47 +0000 (18:00 -0400)] 
Merge "Ensure BakedQuery is cloned before we add options to it"

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
7 years agoMerge "fix TypeReflectionTest for sqlite 3.24"
mike bayer [Tue, 26 Jun 2018 03:51:07 +0000 (23:51 -0400)] 
Merge "fix TypeReflectionTest for sqlite 3.24"

7 years agoMerge "Look up adapter info for previous left side in chained query.join()"
mike bayer [Tue, 26 Jun 2018 03:48:52 +0000 (23:48 -0400)] 
Merge "Look up adapter info for previous left side in chained query.join()"

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
7 years agoMerge "Fix UnboundLocalError in mssql during isolation level grab"
mike bayer [Tue, 26 Jun 2018 02:42:40 +0000 (22:42 -0400)] 
Merge "Fix UnboundLocalError in mssql during isolation level grab"

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

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

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

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

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
7 years agoMerge "render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL"
mike bayer [Sun, 24 Jun 2018 15:57:21 +0000 (11:57 -0400)] 
Merge "render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL"

7 years agoMerge remote-tracking branch 'origin/pr/454'
Mike Bayer [Wed, 20 Jun 2018 02:39:03 +0000 (22:39 -0400)] 
Merge remote-tracking branch 'origin/pr/454'

Change-Id: I88ef3f7b3151d213285b9d9164f14a1fe0582fcc

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.

7 years agoMerge "Add oracle, mssql to profiling"
mike bayer [Mon, 18 Jun 2018 22:42:07 +0000 (18:42 -0400)] 
Merge "Add oracle, mssql to profiling"

7 years agoAdd oracle, mssql to profiling
Mike Bayer [Mon, 18 Jun 2018 21:42:29 +0000 (17:42 -0400)] 
Add oracle, mssql to profiling

As we are changing Oracle typing *again*, we should start tracking
if we trip over a big performance hit on the unicode stuff.

Change-Id: I72719cca4b9424171b32e1f2e58d655426e3bbba

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
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
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
7 years agoUse INITERROR macro in utils.c
Andru1999 [Wed, 13 Jun 2018 18:53:59 +0000 (14:53 -0400)] 
Use INITERROR macro in utils.c

Remove py3k check where we initialize the module and
instead make this look like the same init sequence
as resultproxy.c, processors.c

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: Ia6352e50eaf760d95ab2bbf66d90c023c37f1193
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/429

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

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)

7 years agoMerge "Iterate options per path for baked cache key"
mike bayer [Thu, 7 Jun 2018 14:18:22 +0000 (10:18 -0400)] 
Merge "Iterate options per path for baked cache key"

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
7 years agoMerge "Support undocumented non-entity sequence Query argument"
mike bayer [Wed, 6 Jun 2018 13:31:20 +0000 (09:31 -0400)] 
Merge "Support undocumented non-entity sequence Query argument"

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

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

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

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
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
7 years agocherry-pick changelog update for 1.2.9
Mike Bayer [Mon, 28 May 2018 19:23:41 +0000 (15:23 -0400)] 
cherry-pick changelog update for 1.2.9

7 years agocherry-pick changelog from 1.2.8
Mike Bayer [Mon, 28 May 2018 19:23:41 +0000 (15:23 -0400)] 
cherry-pick changelog from 1.2.8

7 years agoMerge "Mutex on _CONFIGURE_MUTEX in automap.prepare()"
mike bayer [Mon, 28 May 2018 16:41:08 +0000 (12:41 -0400)] 
Merge "Mutex on _CONFIGURE_MUTEX in automap.prepare()"

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

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

7 years agoMerge "Fix string formatting TypeError if tuple is passed"
mike bayer [Thu, 17 May 2018 21:24:55 +0000 (17:24 -0400)] 
Merge "Fix string formatting TypeError if tuple is passed"

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

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

7 years agoMerge "Change query._identity_lookup into a normal instance method"
mike bayer [Thu, 17 May 2018 03:19:06 +0000 (23:19 -0400)] 
Merge "Change query._identity_lookup into a normal instance method"

7 years agoClarify dogpile.cache differences which occur via #4128.
Mike Bayer [Wed, 16 May 2018 19:47:50 +0000 (15:47 -0400)] 
Clarify dogpile.cache differences which occur via #4128.

The fix for :ticket:`4128` which failed to be included
in the 1.2.5 release also works around an issue in the dogpile.cache
"advanced" example, which will also be fixed independently.

Change-Id: I5eb0da9b93f13f05a8cbe4559e2ed177b1f91a52

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
7 years agoCorrect from version 1.2.5 to 1.2.8 for #4128
Mike Bayer [Wed, 16 May 2018 19:16:25 +0000 (15:16 -0400)] 
Correct from version 1.2.5 to 1.2.8 for #4128

Change-Id: I3c9ec52a15e7cd083725d40f19078a783f1a4e23

7 years agoRestore missing changelog files for #4128
Mike Bayer [Mon, 26 Feb 2018 00:54:37 +0000 (19:54 -0500)] 
Restore missing changelog files for #4128

The fix merged in 4a31c30fa5ebd6af0e72937b21b2e5ee79e12631
failed to get backported to 1.2 and the changelog files
got blown away in the release process.  Restore the
changelog files to master before cherry-picking
the whole thing to 1.2.

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
7 years agoMerge "Use identity_token for refresh(), unexpire, undefer"
mike bayer [Sun, 13 May 2018 15:25:40 +0000 (11:25 -0400)] 
Merge "Use identity_token for refresh(), unexpire, undefer"

7 years agoMerge "Default server_version_info to (0, )"
mike bayer [Fri, 11 May 2018 17:33:24 +0000 (13:33 -0400)] 
Merge "Default server_version_info to (0, )"

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

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

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
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 agoRender FOR UPDATE on the inner subquery as well as the outer
Mike Bayer [Mon, 30 Apr 2018 15:31:48 +0000 (11:31 -0400)] 
Render FOR UPDATE on the inner subquery as well as the outer

The ORM now doubles the "FOR UPDATE" clause within the subquery that
renders in conjunction with joined eager loading in some cases, as it has
been observed that MySQL does not lock the rows from a subquery.   This
means the query renders with two FOR UPDATE clauses; note that on some
backends such as Oracle, FOR UPDATE clauses on subqueries are silently
ignored since they are unnecessary.  Additionally, in the case of the "OF"
clause used primarily with Postgresql, the FOR UPDATE is rendered only on
the inner subquery when this is used so that the selectable can be targeted
to the table within the SELECT statement.

Change-Id: Ie5520d08d82bf0afd9e1bd2d43a0b2a0db0de16d
Fixes: #4246
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

7 years ago- add space invaders example
Mike Bayer [Fri, 27 Apr 2018 19:05:21 +0000 (15:05 -0400)] 
- add space invaders example

Change-Id: I439b6012af8c2bd8f555744657b8091ac168242b

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

7 years agocherry-pick changelog update for 1.2.8
Mike Bayer [Fri, 20 Apr 2018 20:35:53 +0000 (16:35 -0400)] 
cherry-pick changelog update for 1.2.8

7 years agocherry-pick changelog from 1.2.7
Mike Bayer [Fri, 20 Apr 2018 20:35:53 +0000 (16:35 -0400)] 
cherry-pick changelog from 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
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

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

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

7 years ago- add version 1.3.0b1
Mike Bayer [Thu, 19 Apr 2018 22:21:13 +0000 (18:21 -0400)] 
- add version 1.3.0b1

Change-Id: If993c37ead1497b246816663bb65038630822676

7 years agoMerge "Ensure select_from_entity adapter is used in adjust_for_single_inheritance"
mike bayer [Thu, 19 Apr 2018 22:20:22 +0000 (18:20 -0400)] 
Merge "Ensure select_from_entity adapter is used in adjust_for_single_inheritance"

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
7 years agoMerge "Render and reflect MySQL WITH PARSER index options"
mike bayer [Tue, 17 Apr 2018 23:46:28 +0000 (19:46 -0400)] 
Merge "Render and reflect MySQL WITH PARSER index options"

7 years agoRender and reflect MySQL WITH PARSER index options
Mike Bayer [Tue, 17 Apr 2018 17:22:13 +0000 (13:22 -0400)] 
Render and reflect MySQL WITH PARSER index options

Support added for the "WITH PARSER" syntax of CREATE FULLTEXT INDEX
in MySQL, using the ``mysql_with_parser`` keyword argument.  Reflection
is also supported, which accommodates MySQL's special comment format
for reporting on this option as well.  Additionally, the "FULLTEXT" and
"SPATIAL" index prefixes are now reflected back into the ``mysql_prefix``
index option.

Change-Id: I0209291978125d8cee1bb5ed386d4f66578697a0
Fixes: #4219
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

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

7 years agoMerge "Correct join for FKs with schema in SQL Server"
mike bayer [Wed, 11 Apr 2018 19:28:13 +0000 (15:28 -0400)] 
Merge "Correct join for FKs with schema in SQL Server"

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

7 years agoUpdate argument name for distinct() to match docs
Michael Williamson [Wed, 11 Apr 2018 15:21:20 +0000 (11:21 -0400)] 
Update argument name for distinct() to match docs

A tiny change so that the docs are more consistent. At the moment, the same argument is given two different names.

Change-Id: Ic487006887d048700f260b2ae4a05d9a380412c1
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/439

7 years agoRaise informative exception for non-sortable PK
Mike Bayer [Fri, 6 Apr 2018 15:39:15 +0000 (11:39 -0400)] 
Raise informative exception for non-sortable PK

An informative exception is re-raised when a primary key value is not
sortable in Python during an ORM flush under Python 3, such as an ``Enum``
that has no ``__lt__()`` method; normally Python 3 raises a ``TypeError``
in this case.   The flush process sorts persistent objects by primary key
in Python so the values must be sortable.

Change-Id: Ia186968982dcd1234b82f2e701fefa2a1668a7e4
Fixes: #4232
7 years agoMerge "Ensure all visit_sequence accepts **kw args"
mike bayer [Thu, 5 Apr 2018 01:06:35 +0000 (21:06 -0400)] 
Merge "Ensure all visit_sequence accepts **kw args"

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

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

7 years agocherry-pick changelog update for 1.2.7
Mike Bayer [Fri, 30 Mar 2018 20:29:53 +0000 (16:29 -0400)] 
cherry-pick changelog update for 1.2.7

7 years agocherry-pick changelog from 1.2.6
Mike Bayer [Fri, 30 Mar 2018 20:29:53 +0000 (16:29 -0400)] 
cherry-pick changelog from 1.2.6