]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
5 years agoClarify isolation_level documentation
Mike Bayer [Tue, 15 Oct 2019 15:27:51 +0000 (11:27 -0400)] 
Clarify isolation_level documentation

Fixes: #4909
Change-Id: I32114a8349c1d2d0a837610ccc74f9e789ed20f5
(cherry picked from commit 2ef87804e9b7d3048dcbd70d526282f727b48eb0)

5 years ago- add py38 to tox list
Mike Bayer [Mon, 14 Oct 2019 23:24:26 +0000 (19:24 -0400)] 
- add py38 to tox list

Change-Id: I1488d7954b95d62e9ecd5e85747123eb7460d9cd

5 years agoMerge "Use separate label generator for column_label naming convention" into rel_1_3
mike bayer [Mon, 14 Oct 2019 19:25:52 +0000 (19:25 +0000)] 
Merge "Use separate label generator for column_label naming convention" into rel_1_3

5 years agolink to Google BigQuery dialect
Aidan Feldman [Sat, 12 Oct 2019 02:52:28 +0000 (22:52 -0400)] 
link to Google BigQuery dialect

(cherry picked from commit 0d93a7b8fb40b334a4a1ea67274aaa47f7598ad7)

5 years agoUse separate label generator for column_label naming convention
Mike Bayer [Mon, 14 Oct 2019 00:33:24 +0000 (20:33 -0400)] 
Use separate label generator for column_label naming convention

Fixed bug where a table that would have a column label overlap with a plain
column name, such as "foo.id AS foo_id" vs. "foo.foo_id", would prematurely
generate the ``._label`` attribute for a column before this overlap could
be detected due to the use of the ``index=True`` or ``unique=True`` flag on
the column in conjunction with the default naming convention of
``"column_0_label"``.  This would then lead to failures when ``._label``
were used later to generate a bound parameter name, in particular those
used by the ORM when generating the WHERE clause for an UPDATE statement.
The issue has been fixed by using an alternate ``._label`` accessor for DDL
generation that does not affect the state of the :class:`.Column`.   The
accessor also bypasses the key-deduplication step as it is not necessary
for DDL, the naming is now consistently ``"<tablename>_<columnname>"``
without any subsequent numeric symbols when used in DDL.

Fixes: #4911
Change-Id: Iabf5fd3250738d800d6e41a2a3a27a7ce2405e7d
(cherry picked from commit 41dc71ad2fc1963a44e5f308f53aed6b8d7d662a)

5 years ago- add flake8 as a pre commit hook
Mike Bayer [Sun, 13 Oct 2019 22:56:25 +0000 (18:56 -0400)] 
- add flake8 as a pre commit hook

Change-Id: Ie9187b9aac636b198df39428cdcb4bcf6f819879
(cherry picked from commit 6b2875eba531a0b879ec345ec85fae00f522ff03)

5 years agoMerge "added additional error message to is_disconnect() for Firebird dialects" into...
mike bayer [Fri, 11 Oct 2019 17:30:33 +0000 (17:30 +0000)] 
Merge "added additional error message to is_disconnect() for Firebird dialects" into rel_1_3

5 years agopass executemany context to _repr_params
Mike Bayer [Wed, 9 Oct 2019 17:55:19 +0000 (13:55 -0400)] 
pass executemany context to _repr_params

Fixed bug where parameter repr as used in logging and error reporting needs
additional context in order to distinguish between a list of parameters for
a single statement and a list of parameter lists, as the "list of lists"
structure could also indicate a single parameter list where the first
parameter itself is a list, such as for an array parameter.   The
engine/connection now passes in an additional boolean indicating how the
parameters should be considered.  The only SQLAlchemy backend that expects
arrays as parameters is that of  psycopg2 which uses pyformat parameters,
so this issue has not been too apparent, however as other drivers that use
positional gain more features it is important that this be supported. It
also eliminates the need for the parameter repr function to guess based on
the parameter structure passed.

Fixes: #4902
Change-Id: I086246ee0eb51484adbefd83e07295fa56576c5f
(cherry picked from commit 9488480abea15298ded6996aa13b42edf134e467)

5 years agoadded additional error message to is_disconnect() for Firebird dialects
lukens [Thu, 10 Oct 2019 16:06:15 +0000 (12:06 -0400)] 
added additional error message to is_disconnect() for Firebird dialects

Added additional "disconnect" message "Error writing data to the
connection" to Firebird disconnection detection.  Pull request courtesy
lukens.

Fixes: #4903
Closes: #4904
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4904
Pull-request-sha: c56d7c4abf6b6c8263efaf070b4e7a319e12a875

Change-Id: Ib70c20c616e7519b933fee587a3b3e8dbb4c2f81
(cherry picked from commit 31e3fc94ad268cf762f564209113d66221b04b42)

5 years agoVersion 1.3.11 placeholder
Mike Bayer [Thu, 10 Oct 2019 00:34:13 +0000 (20:34 -0400)] 
Version 1.3.11 placeholder

5 years ago- 1.3.10 rel_1_3_10
Mike Bayer [Wed, 9 Oct 2019 22:31:36 +0000 (18:31 -0400)] 
- 1.3.10

5 years agoRepair Oracle compat version check; dont warn if failed
Mike Bayer [Wed, 9 Oct 2019 20:05:34 +0000 (16:05 -0400)] 
Repair Oracle compat version check; dont warn if failed

Fixed regression in Oracle dialect that was inadvertently using max
identifier length of 128 characters on Oracle server 12.2 and greater even
though the stated contract for the remainder of the 1.3 series is  that
this value stays at 30 until version SQLAlchemy 1.4.  Also repaired issues
with the retrieval of the "compatibility" version, and removed the warning
emitted when the "v$parameter" view was not accessible as this was  causing
user confusion.

Fixes: #4898
Change-Id: Ieb7b3e093610896c5aa12d0789b63262e0ecf9d8

5 years agoBackport pysqlite dialect modernizations
Mike Bayer [Tue, 8 Oct 2019 19:53:38 +0000 (15:53 -0400)] 
Backport pysqlite dialect modernizations

Backporting the doc update, module import and the
removal of the old pysqlite version warning from
a0d94763f8369939ae6b731d6b599b5edb05d37e.

Change-Id: I989cc9c1128cc5f8c83ba57944d1ee3a733b3036
References: #4895

5 years agofix error in test_round_trip for TimeTest with mysql+pyodbc
Gord Thompson [Thu, 3 Oct 2019 22:18:54 +0000 (18:18 -0400)] 
fix error in test_round_trip for TimeTest with mysql+pyodbc

Fixes: #4879
### Description
create mysql+pyodbc-specific `_pyodbcTIME` class to avoid error thrown by `result_processor` in the (more) generic mysql/types.py.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #4880
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4880
Pull-request-sha: 2e4c468c3ad685d6573e0d9755ba97a28df50b6c

Change-Id: Ib5c5b0971969c2a9870b7f43d06703618cfc56f7
(cherry picked from commit f94940e4d88b4011fd089bed37cebb76acb1a385)

5 years agolist sqlalchemy-access as external dialect
Gord Thompson [Tue, 8 Oct 2019 12:27:05 +0000 (06:27 -0600)] 
list sqlalchemy-access as external dialect

(cherry picked from commit 0089d4e3f6cbc9131f481895c9f8feb22454fa83)

5 years agoFix max_identifier_length for SQL server
Mike Bayer [Mon, 7 Oct 2019 20:12:30 +0000 (16:12 -0400)] 
Fix max_identifier_length for SQL server

Fixed bug in SQL Server dialect with new "max_identifier_length" feature
where the mssql dialect already featured this flag, and the implementation
did not accommodate for the new initialization hook correctly.

Fixes: #4857
Change-Id: I96a9c6ca9549d8f6fb167c0333f684e8d922a3bf
(cherry picked from commit 2ba70aba90c69152641b2cce838b3afa35c8586c)

5 years agoVersion 1.3.10 placeholder
Mike Bayer [Fri, 4 Oct 2019 20:17:22 +0000 (16:17 -0400)] 
Version 1.3.10 placeholder

5 years ago- 1.3.9 rel_1_3_9
Mike Bayer [Fri, 4 Oct 2019 20:07:01 +0000 (16:07 -0400)] 
- 1.3.9

5 years ago- fix typo
Mike Bayer [Fri, 4 Oct 2019 20:06:28 +0000 (16:06 -0400)] 
- fix typo

Change-Id: I8275a9cbb9a664badbaf759ec62399ac0ead9b20
(cherry picked from commit 0e42cdced4d6ce45517192774545f7aeb061cb9d)

5 years agoWarn for object replaced in identity map during flush
Mike Bayer [Fri, 4 Oct 2019 15:12:27 +0000 (11:12 -0400)] 
Warn for object replaced in identity map during flush

A warning is emitted for a condition in which the :class:`.Session` may
implicitly swap an object out of the identity map for another one with the
same primary key, detaching the old one, which can be an observed result of
load operations which occur within the :meth:`.SessionEvents.after_flush`
hook.  The warning is intended to notify the user that some special
condition has caused this to happen and that the previous object may not be
in the expected state.

Fixes: #4890
Change-Id: Ide11c6b9f21ca67ff5a96266c521d0c56fd6af8d
(cherry picked from commit 4aa43ecbd78e5a7dd3d983ca46a377af4e01877e)

5 years agoimport StringIO => import io
Matt Kohl [Fri, 4 Oct 2019 05:56:50 +0000 (06:56 +0100)] 
import StringIO => import io

(cherry picked from commit edf8e782cf5011cd43a0ee281b9e0b1d1becef1f)

5 years agoMerge "call setinputsizes for cx_Oracle.DATETIME" into rel_1_3
mike bayer [Thu, 3 Oct 2019 21:41:51 +0000 (21:41 +0000)] 
Merge "call setinputsizes for cx_Oracle.DATETIME" into rel_1_3

5 years agocall setinputsizes for cx_Oracle.DATETIME
Mike Bayer [Thu, 3 Oct 2019 18:09:54 +0000 (14:09 -0400)] 
call setinputsizes for cx_Oracle.DATETIME

Restored adding cx_Oracle.DATETIME to the setinputsizes() call when a
SQLAlchemy :class:`.Date`, :class:`.DateTime` or :class:`.Time` datatype is
used, so that in the case where a bound parameter is passed as NULL
in some complex queries (in particular this happens with some lazy load
situations), the type is still present.  This was removed
in the 1.2 series for arbitrary reasons.

Also adds a suite test for this generic situation.

What's not clear is that do we really need setinputsizes() for all
datatypes if we are supporting NULL in bound parameters.

Fixes: #4886
Change-Id: If99215c31861f9ea6f60a30d47f2f320adc4797f
(cherry picked from commit e21afbcd8c78e4e3f9400da1a2565472682de825)

5 years agoApply quoting to SQL Server _switch_db
Mike Bayer [Thu, 3 Oct 2019 15:18:06 +0000 (11:18 -0400)] 
Apply quoting to SQL Server _switch_db

Added identifier quoting to the schema name applied to the "use" statement
which is invoked when a SQL Server multipart schema name is used within  a
:class:`.Table` that is being reflected, as well as for :class:`.Inspector`
methods such as :meth:`.Inspector.get_table_names`; this accommodates for
special characters or spaces in the database name.  Additionally, the "use"
statement is not emitted if the current database matches the target owner
database name being passed.

Fixes: #4883
Change-Id: I84419730e94aac3a88d331ad8c24d10aabbc34af
(cherry picked from commit 66a7befa0c549b92d42afbb5be2b45da13793250)

5 years agoAdd max_identifier_length parameter; warn for Oracle
Mike Bayer [Wed, 2 Oct 2019 15:20:58 +0000 (11:20 -0400)] 
Add max_identifier_length parameter; warn for Oracle

Added new :func:`.create_engine` parameter
:paramref:`.create_engine.max_identifier_length`. This overrides the
dialect-coded "max identifier length" in order to accommodate for databases
that have recently changed this length and the SQLAlchemy dialect has
not yet been adjusted to detect for that version.  This parameter interacts
with the existing :paramref:`.create_engine.label_length` parameter in that
it establishes the maximum (and default) value for anonymously generated
labels.

The Oracle dialect now emits a warning if Oracle version 12.2 or greater is
used, and the :paramref:`.create_engine.max_identifier_length` parameter is
not set.   The version in this specific case defaults to that of the
"compatibility" version set in the Oracle server configuration, not the
actual server version.   In version 1.4, the default max_identifier_length
for 12.2 or greater will move to 128 characters.  In order to maintain
forwards compatibility, applications should set
:paramref:`.create_engine.max_identifier_length` to 30 in order to maintain
the same length behavior, or to 128 in order to test the upcoming behavior.
This length determines among other things how generated constraint names
are truncated for statements like ``CREATE CONSTRAINT`` and ``DROP
CONSTRAINT``, which means a the new length may produce a name-mismatch
against a name that was generated with the old length, impacting database
migrations.

Fixes: #4857
Change-Id: Ib62efb00c6180c375869029b57353d90385d7950
(cherry picked from commit 88761b8b0b0cfa67cdd6a4913e3a0ea5cba93cbb)

5 years agoMerge "Deprecate plain string passed to session.query()" into rel_1_3
mike bayer [Mon, 30 Sep 2019 17:08:31 +0000 (17:08 +0000)] 
Merge "Deprecate plain string passed to session.query()" into rel_1_3

5 years agoDeprecate plain string passed to session.query()
Mike Bayer [Mon, 30 Sep 2019 14:54:50 +0000 (10:54 -0400)] 
Deprecate plain string passed to session.query()

Passing a plain string expression to :meth:`.Session.query` is deprecated,
as all string coercions were removed in :ticket:`4481` and this one should
have been included.   The :func:`.literal_column` function may be used to
produce a textual column expression.

Note this changeset is in the 1.3 branch only.  The 1.4 (currently master)
branch will already have removed this behavior.

Fixes: #4873
Change-Id: I20067a6707c7e2f028c67b1fbf0e8e4d9d136233

5 years agoEnsure states with null m2o FK value are still populated by selectinloader
Mike Bayer [Mon, 30 Sep 2019 13:55:40 +0000 (09:55 -0400)] 
Ensure states with null m2o FK value are still populated by selectinloader

Fixed regression in selectinload loader strategy caused by #4775 (released
in version 1.3.6) where a many-to-one attribute of None would no longer be
populated by the loader.  While this was usually not noticeable due to the
lazyloader populating None upon get, it would lead to a detached instance
error if the object were detached.

Fixes: #4872
Change-Id: I18466841683111643810ebc4331376df38c4767b
(cherry picked from commit 9f3539b1745cbb287a1338812872d27cde4ebf24)

5 years agoSupport SQLite URIs
Mike Bayer [Fri, 20 Sep 2019 13:25:40 +0000 (09:25 -0400)] 
Support SQLite URIs

Added support for sqlite "URI" connections, which allow for sqlite-specific
flags to be passed in the query string such as "read only" for Python
sqlite3 drivers that support this.

Fixes: #4863
Change-Id: I7740b55ee8f2ede72a5c49ee94a7540e4d0250f2
(cherry picked from commit adb495503dab660f014cad0200491c854d2f6a50)

5 years agoAdd req for nullable booleans
Mike Bayer [Wed, 18 Sep 2019 13:56:33 +0000 (09:56 -0400)] 
Add req for nullable booleans

Access doesn't allow for Yes/No columns to store null, so add
a rule for this.

Change-Id: If9316cd05733e39fbd59a6f54024f6740b563041
(cherry picked from commit 6cfbd5fefef51374d3c60fb58e094db00643faa0)

5 years agoAdd missing suite_level requirements "independent_connections"
Mike Bayer [Wed, 18 Sep 2019 12:47:46 +0000 (08:47 -0400)] 
Add missing suite_level requirements "independent_connections"

In 14b1e6fe8e18d139846c1aba6761d4eea3dc25c3 we added
suite-level requirements but did not add them to the
base, causing failures in third party dialect test suites.

Change-Id: I7edf0be86b814b508071c5c752fc2dd744a3d9ad
(cherry picked from commit f79967441fd092ba9cc81f53b6a71e8cf0223b35)

5 years agoFix typo in docs (errors.rst)
Mikhail Burshteyn [Wed, 18 Sep 2019 11:00:26 +0000 (14:00 +0300)] 
Fix typo in docs (errors.rst)

(cherry picked from commit af94e639ae7b0e2ee3d8caf92b0f7e128f4199ab)

5 years agoAdd missing suite level requirements from 2efd89d02941
Mike Bayer [Wed, 18 Sep 2019 01:04:21 +0000 (21:04 -0400)] 
Add missing suite level requirements from 2efd89d02941

In 2efd89d02941ab4267d6e2842963fd38b1539f6c we added
suite-level requirements but did not add them to the
base, causing failures in third party dialect test suites.

Change-Id: Ic5f1a053f5c47166e1b12c613595823106c8736e
(cherry picked from commit 33648643f227929f083b67d817701f930078f901)

5 years agoAdd missing suite level requirements from #4234
Mike Bayer [Tue, 17 Sep 2019 16:49:46 +0000 (12:49 -0400)] 
Add missing suite level requirements from #4234

In 9d5e117f6fcc38d8773bc943c615888dc8a3a819 we added
suite-level requirements but did not add them to the
base, causing failures in third party dialect test suites.

Change-Id: I030b5d0fd957814dfce77a71b59babd9b5e3b1bc
References: #4234
(cherry picked from commit f92fa1b5dfceb5c079a46db598294db133cb0cac)

5 years agoAdd note on the use of tuple_() for the IN operator in the docs
Stepland [Mon, 16 Sep 2019 15:40:29 +0000 (11:40 -0400)] 
Add note on the use of tuple_() for the IN operator in the docs

Closes: #4861
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4861
Pull-request-sha: c7379d390752d0c10d6488872b163b06ee30d952

Change-Id: I223008f720fe64951e2a0bf95aab955ece22516b
(cherry picked from commit 6a60d7305bafc311115543e0c2cb5136a254edf2)

5 years agoDocument visitors module
Mike Bayer [Thu, 12 Sep 2019 16:37:38 +0000 (12:37 -0400)] 
Document visitors module

As we are going to be adding a lot of new features to the visitors
module which may impact end-user custom constructs, start documenting
the package for now.

Change-Id: Ibae471c2cb861f6280f601b7b2382d61968825cd
(cherry picked from commit ed02d924dd0bd1bce56b40bea74e1d382c352833)

5 years agoUse compat.raise_from_cause() for re-raise of schema item error
Mike Bayer [Sun, 8 Sep 2019 01:34:14 +0000 (21:34 -0400)] 
Use compat.raise_from_cause() for re-raise of schema item error

Fixes: #4847
Change-Id: I5bc8a87ccae1b49ea507d344b7933c248e04ee89
(cherry picked from commit 17b7b3027f0e994cf47bf5fa3e536d3971076dcd)

5 years agoCatch set_parent_w_dispatch missing
Mike Bayer [Fri, 6 Sep 2019 22:40:46 +0000 (18:40 -0400)] 
Catch set_parent_w_dispatch missing

Added an explicit error message for the case when objects passed to
:class:`.Table` are not :class:`.SchemaItem` objects, rather than resolving
to an attribute error.

Fixes: #4847
Change-Id: I4dcdcee86b64c85ccf12e2ddc3d638563d307991
(cherry picked from commit 7afcb39a962d383e5ba04179c1b13131fb08a787)

5 years agoUpdate link to sqlalchemy-access
Gord Thompson [Thu, 5 Sep 2019 13:53:41 +0000 (07:53 -0600)] 
Update link to sqlalchemy-access

(cherry picked from commit 11c24cd2ed6ac746e9f94a22a6e16c13e608ef6e)

5 years agoMerge "Strip special chars in anonymized bind names" into rel_1_3
mike bayer [Thu, 5 Sep 2019 15:52:37 +0000 (15:52 +0000)] 
Merge "Strip special chars in anonymized bind names" into rel_1_3

5 years agoDocument Query deduplication
Mike Bayer [Thu, 5 Sep 2019 15:46:44 +0000 (11:46 -0400)] 
Document Query deduplication

Users are frequently confused why count() does not return the same
number as the number of objects returned by all().  While we continue
to want to find a better solution to this problem, in the meantime
this has never been clearly documented.  Add an FAQ section with
links from .count() , .all(), ORM tutorial.

Change-Id: I6eff36b686ff6cdd55489036fc48a981bc47d5ee
(cherry picked from commit 75c3950732a66ff7f4aca152653d6cb14eb9783c)

5 years agoStrip special chars in anonymized bind names
Mike Bayer [Wed, 4 Sep 2019 22:46:53 +0000 (18:46 -0400)] 
Strip special chars in anonymized bind names

Characters that interfere with "pyformat" or "named" formats in bound
parameters, namely ``%, (, )`` and the space character, as well as a few
other typically undesirable characters, are stripped early for a
:func:`.bindparam` that is using an anonymized name, which is typically
generated automatically from a named column which itself includes these
characters in its name and does not use a ``.key``, so that they do not
interfere either with the SQLAlchemy compiler's use of string formatting or
with the driver-level parsing of the parameter, both of which could be
demonstrated before the fix.  The change only applies to anonymized
parameter names that are generated and consumed internally, not end-user
defined names, so the change should have no impact on any existing code.
Applies in particular to the psycopg2 driver which does not otherwise quote
special parameter names, but also strips leading underscores to suit Oracle
(but not yet leading numbers, as some anon parameters are currently
entirely numeric/underscore based); Oracle in any case continues to quote
parameter names that include special characters.

Fixes: #4837
Change-Id: I21cb654c3e4ef786114160b8b4295242720bf3f9
(cherry picked from commit d7aa017d83b416187b54ad38400475fd86d80671)

5 years agoBackport refactor of bindparams tests
Mike Bayer [Wed, 4 Sep 2019 20:23:14 +0000 (16:23 -0400)] 
Backport refactor of bindparams tests

These move into their own class inside of test_compiler
which will help with upcoming patch for #4837

Change-Id: Iad828d4a0d01d82bfb33213cedfc5b79d1860507

5 years agoDon't create enum constraints in enum sortable tests
Mike Bayer [Fri, 30 Aug 2019 17:11:05 +0000 (13:11 -0400)] 
Don't create enum constraints in enum sortable tests

Fixed unit test regression released in 1.3.8 that would cause failure for
Oracle, SQL Server and other non-native ENUM platforms due to new
enumeration tests added as part of :ticket:`4285` enum sortability in the
unit of work; the enumerations created constraints that were duplicated on
name.

Fixes: #4285
Change-Id: I34f51e82be9b6bb43b0df8c54bb36822e6eeb73e
(cherry picked from commit 2df613243de33aaa202b3ac458304b8ab403e9e7)

5 years agoVersion 1.3.9 placeholder
Mike Bayer [Tue, 27 Aug 2019 23:30:04 +0000 (19:30 -0400)] 
Version 1.3.9 placeholder

5 years ago- 1.3.8 rel_1_3_8
Mike Bayer [Tue, 27 Aug 2019 23:18:35 +0000 (19:18 -0400)] 
- 1.3.8

5 years agoMerge "Implement type-level sorting for Enum; apply to ORM primary keys" into rel_1_3
mike bayer [Tue, 27 Aug 2019 19:29:33 +0000 (19:29 +0000)] 
Merge "Implement type-level sorting for Enum; apply to ORM primary keys" into rel_1_3

5 years agoImplement type-level sorting for Enum; apply to ORM primary keys
Nicolas CANIART [Thu, 22 Aug 2019 18:16:29 +0000 (14:16 -0400)] 
Implement type-level sorting for Enum; apply to ORM primary keys

Added support for the use of an :class:`.Enum` datatype using Python
pep-435 enumeration objects as values for use as a primary key column
mapped by the ORM.  As these values are not inherently sortable, as
required by the ORM for primary keys, a new
:attr:`.TypeEngine.sort_key_function` attribute is added to the typing
system which allows any SQL type to  implement a sorting for Python objects
of its type which is consulted by the unit of work.   The :class:`.Enum`
type then defines this using the  database value of a given enumeration.
The sorting scheme can be  also be redefined by passing a callable to the
:paramref:`.Enum.sort_key_function` parameter.  Pull request courtesy
Nicolas Caniart.

Fixes: #4285
Closes: #4816
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4816
Pull-request-sha: 42266b766c1e462d5b8a409cda05d33dea13bd34

Change-Id: Iadcc16173c1ba26ffac5830db57743a4cb987c55
(cherry picked from commit 75b2518b2659796c885396fd0893dd7f9b19a9ef)

5 years agoPGDialect.get_check_constraints: Handle "NOT VALID"
Bill Finn [Tue, 27 Aug 2019 16:21:57 +0000 (12:21 -0400)] 
PGDialect.get_check_constraints: Handle "NOT VALID"

Added support for reflection of CHECK constraints that include the special
PostgreSQL qualifier "NOT VALID", which can be present for CHECK
constraints that were added to an exsiting table with the directive that
they not be applied to existing data in the table. The PostgreSQL
dictionary for CHECK constraints as returned by
:meth:`.Inspector.get_check_constraints` may include an additional entry
``dialect_options`` which within will contain an entry ``"not_valid":
True`` if this symbol is detected.   Pull request courtesy Bill Finn.

Fixes: #4824
Closes: #4825
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4825
Pull-request-sha: a0e1ab133c2d46521a74e55423ac2ba866682dae

Change-Id: I78365f50055c95474c92124b85df66c5c80c00c8
(cherry picked from commit 3980a9a455d08c5073cabc3c2b77de46fa36d7b4)

5 years agoSerialize the context dictionary in Load objects
Mike Bayer [Mon, 26 Aug 2019 15:44:09 +0000 (11:44 -0400)] 
Serialize the context dictionary in Load objects

Fixed bug where :class:`.Load` objects were not pickleable due to
mapper/relationship state in the internal context dictionary.  These
objects are now converted to picklable using similar techniques as that of
other elements within the loader option system that have long been
serializable.

Fixes: #4823
Change-Id: Id2a0d8b640ac475c86d6416ad540671e66d410e5
(cherry picked from commit cd2ccee9d807eb601db2d242ce4cdfa8acb98111)

5 years agoRemove erroneous assertion from array._bind_param
Mike Bayer [Mon, 26 Aug 2019 13:45:06 +0000 (09:45 -0400)] 
Remove erroneous assertion from array._bind_param

Fixed bug where Postgresql operators such as
:meth:`.postgresql.ARRAY.Comparator.contains` and
:meth:`.postgresql.ARRAY.Comparator.contained_by` would fail to function
correctly for non-integer values when used against a
:class:`.postgresql.array` object, due to an erroneous assert statement.

Fixes: #4822
Change-Id: I886aca4c86dc7d64e9d0dfc1d910a0ae64d775a1
(cherry picked from commit 4b5d162ed028558ac38c687d69f26ce93741789d)

5 years agobump variance on test_merge_load 4820/head
Mike Bayer [Fri, 23 Aug 2019 14:55:33 +0000 (10:55 -0400)] 
bump variance on test_merge_load

This test is very sensitive and fluctuates a lot, failing builds,
bump the variance to try and resolve.

Change-Id: Ia19bb8871b432059cb3917ca0050a68f75c0a0f2
(cherry picked from commit e429ef1d31343b99e885f58a79800ae490155294)

5 years agoMerge "Add hide_parameters flag to create_engine" into rel_1_3
mike bayer [Thu, 22 Aug 2019 22:03:17 +0000 (22:03 +0000)] 
Merge "Add hide_parameters flag to create_engine" into rel_1_3

5 years agoRemove mock dependency
Mike Bayer [Thu, 22 Aug 2019 18:11:18 +0000 (14:11 -0400)] 
Remove mock dependency

Mock is not needed over python 3.3, we need this tox
requirement only for Python 2.7 right now.

Change-Id: I06ae31f9fe6eaece0ec508e9431e4f8166a59684
(cherry picked from commit 0396fb761ee3a5778d4a3414bc724f43d041ffe1)

5 years agoAdd hide_parameters flag to create_engine
Mike Bayer [Wed, 21 Aug 2019 21:29:55 +0000 (17:29 -0400)] 
Add hide_parameters flag to create_engine

Added new parameter :paramref:`.create_engine.hide_parameters` which when
set to True will cause SQL parameters to no longer be logged, nor rendered
in the string representation of a :class:`.StatementError` object.

Fixes: #4815
Change-Id: Ib87f868b6936cf6b42b192644e9d732ec24266c2
(cherry picked from commit 4b321e8a5e6b728a818a801c3ad90bb759c584bc)

5 years agoFix rst typo
Mike Bayer [Wed, 21 Aug 2019 20:55:32 +0000 (16:55 -0400)] 
Fix rst typo

The changelog for #4793 has a typo in the RST and didn't show up
in the changelog, causing confusion as seen in #4814

Change-Id: I5833097c1576120fbc2ea27c54bbca685ae89f88
References: #4793
References: #4814
(cherry picked from commit 94385b031c1dac004ee4181cb5783328d740d110)

5 years agoDocument how to work with reflection and custom datatypes
Mike Bayer [Tue, 20 Aug 2019 13:42:36 +0000 (09:42 -0400)] 
Document how to work with reflection and custom datatypes

Describe the link between table reflection, datatype lookups,
and what approaches are needed in the case where in-Python datatypes
are needed in the reflected table metadata.

Fixes: #4812
Change-Id: I68bef2bf472811797d4f5d9a625c6b9bca902f78
(cherry picked from commit a3df16995b45e14d4c572302b17bccfa9a7cbf57)

5 years agoMerge "Reflect PK of referred table if referred columns not present" into rel_1_3
mike bayer [Mon, 19 Aug 2019 04:41:39 +0000 (04:41 +0000)] 
Merge "Reflect PK of referred table if referred columns not present" into rel_1_3

5 years agoReflect PK of referred table if referred columns not present
Mike Bayer [Sun, 18 Aug 2019 17:03:49 +0000 (13:03 -0400)] 
Reflect PK of referred table if referred columns not present

Fixed bug where a FOREIGN KEY that was set up to refer to the parent table
by table name only without the column names would not correctly be
reflected as far as setting up the "referred columns", since SQLite's
PRAGMA does not report on these columns if they weren't given explicitly.
For some reason this was harcoded to assume the name of the local column,
which might work for some cases but is not correct. The new approach
reflects the primary key of the referred table and uses the constraint
columns list as the referred columns list, if the remote column(s) aren't
present in the reflected pragma directly.

Fixes: #4810
Change-Id: I7789f83d68845ae197a782080af8ec64a7bf48cc
(cherry picked from commit f06c6ba67303e5c75d8ad044494193d8f97b2e2e)

5 years agoRevise psycopg2 execute_values approach
Mike Bayer [Sat, 17 Aug 2019 02:38:51 +0000 (22:38 -0400)] 
Revise psycopg2 execute_values approach

Revised the approach for the just added support for the psycopg2
"execute_values()" feature added in 1.3.7 for :ticket:`4623`.  The approach
relied upon a regular expression that would fail to match for a more
complex INSERT statement such as one which had subqueries involved.   The
new approach matches exactly the string that was rendered as the VALUES
clause.

Fixes: #4623
Change-Id: Icaae0f7b6bcf87a2cf5c6290a839c8429dd5fac3
(cherry picked from commit 0a7ca00e04f7c1cfdbb8bdfe7da5f62fc9b40930)

5 years agoAdd new "exec_once_unless_exception" system; apply to dialect.initialize
Mike Bayer [Fri, 16 Aug 2019 22:07:06 +0000 (18:07 -0400)] 
Add new "exec_once_unless_exception" system; apply to dialect.initialize

Fixed an issue whereby if the dialect "initialize" process which occurs on
first connect would encounter an unexpected exception, the initialize
process would fail to complete and then no longer attempt on subsequent
connection attempts, leaving the dialect in an un-initialized, or partially
initialized state, within the scope of parameters that need to be
established based on inspection of a live connection.   The "invoke once"
logic in the event system has been reworked to accommodate for this
occurrence using new, private API features that establish an "exec once"
hook that will continue to allow the initializer to fire off on subsequent
connections, until it completes without raising an exception. This does not
impact the behavior of the existing ``once=True`` flag within the event
system.

Fixes: #4807
Change-Id: Iec32999b61b6af4b38b6719e0c2651454619078c
(cherry picked from commit 2051fa2ce9e724e6e77e19067d27d2660e7cd74a)

5 years agoVersion 1.3.8 placeholder
Mike Bayer [Wed, 14 Aug 2019 17:54:27 +0000 (13:54 -0400)] 
Version 1.3.8 placeholder

5 years ago- 1.3.7 rel_1_3_7
Mike Bayer [Wed, 14 Aug 2019 17:35:44 +0000 (13:35 -0400)] 
- 1.3.7

5 years agoTurn on backend for new tests added for #4803
Mike Bayer [Wed, 14 Aug 2019 14:34:38 +0000 (10:34 -0400)] 
Turn on backend for new tests added for #4803

New tests added are failing on SQL Server which doesn't support
expressions in LIMIT, need better gerrit coverage

Fixes: #4803
Change-Id: I56bc44474d448a1faa1dfccff0b55763329e712d
(cherry picked from commit a34664040a8727394dc62d7db4843baad2dce631)

5 years agoMerge "Add new executemany_mode, support for psycopg2.extras.execute_values()" into...
mike bayer [Wed, 14 Aug 2019 02:57:58 +0000 (02:57 +0000)] 
Merge "Add new executemany_mode, support for psycopg2.extras.execute_values()" into rel_1_3

5 years agoAdd support for try_cast function on sqlalchemy.dialects.mssql
Leonel Atencio [Fri, 9 Aug 2019 21:16:13 +0000 (17:16 -0400)] 
Add support for try_cast  function on sqlalchemy.dialects.mssql

Added new :func:`.mssql.try_cast` construct for SQL Server which emits
"TRY_CAST" syntax.  Pull request courtesy Leonel Atencio.

Fixes: #4782
Closes: #4785
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4785
Pull-request-sha: cf13303a9d1c0cc0233a82a5d2ca01f438b6fb9b

Change-Id: I74a71ff5e587353f67472534aabe0d54ae8039ae
(cherry picked from commit 7e0dfd2ad4141289a992adc65d2a6641f46dc82d)

5 years agoAdd new executemany_mode, support for psycopg2.extras.execute_values()
Yuval Dinari [Mon, 12 Aug 2019 14:44:59 +0000 (10:44 -0400)] 
Add new executemany_mode, support for psycopg2.extras.execute_values()

Added new dialect flag for the psycopg2 dialect, ``executemany_mode`` which
supersedes the previous experimental ``use_batch_mode`` flag.
``executemany_mode`` supports both the "execute batch" and "execute values"
functions provided by psycopg2, the latter which is used for compiled
:func:`.insert` constructs.   Pull request courtesy Yuval Dinari.

.. seealso::

    :ref:`executemany_mode`

Fixes: #4623
Closes: #4764
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4764
Pull-request-sha: c3d3a36f7eb66c86d14ed9c1c31b4b48bd204855

Change-Id: I77e26ca729f9317af1488a6c054c23fa1a6b622b
(cherry picked from commit 65f8edd45816f91688220b68cc0563797c3dc4ba)

5 years agoMerge "Use compat.string_types to check for visit name string" into rel_1_3
mike bayer [Mon, 12 Aug 2019 14:43:01 +0000 (14:43 +0000)] 
Merge "Use compat.string_types to check for visit name string" into rel_1_3

5 years agoRewrite pool reset_on_return parsing using a util function
Mike Bayer [Sun, 11 Aug 2019 19:24:13 +0000 (15:24 -0400)] 
Rewrite pool reset_on_return parsing using a util function

Choosing a util.symbol() based on a user parameter is about to have
another use case added as part of #4623, so add a generalized solution
ahead of it.

Change-Id: I420631f81af2ffc655995b9cce9ff2ac618c16d7
(cherry picked from commit 2a079cdc76b3a0f5b4f37299d280d328586e2f7e)

5 years agoUse compat.string_types to check for visit name string
Mike Bayer [Mon, 12 Aug 2019 00:44:42 +0000 (20:44 -0400)] 
Use compat.string_types to check for visit name string

Th visitor optimization looking for plain string needs to
accommodate for u"" in Python 2 due to the unicode_literals
future.

Fixes: #4800
Change-Id: I5e3136f2f2cbd5f24d89186b599f59ea2e7f1550
(cherry picked from commit 3a542005a5f38556dc45c5bc8f256a154ee72c8a)

5 years agoUse ternary when running conditional with Query._offset
Mike Bayer [Sun, 11 Aug 2019 14:54:49 +0000 (10:54 -0400)] 
Use ternary when running conditional with Query._offset

Fixed bug where using :meth:`.Query.first` or a slice expression in
conjunction with a query that has an expression based "offset" applied
would raise TypeError, due to an "or" conditional against "offset" that did
not expect it to be a SQL expression as opposed to an integer or None.

Fixes: #4803
Change-Id: I56b97a5d23cb45427a27a90ab557fa1ac5c6739e
(cherry picked from commit 97d2a2091ed4caee1e19168d0db39e4d94a6d12f)

5 years agoEmit SET NAMES for all MySQL connections w charset
Mike Bayer [Sun, 11 Aug 2019 21:42:59 +0000 (17:42 -0400)] 
Emit SET NAMES for all MySQL connections w charset

The MySQL dialects will emit "SET NAMES" at the start of a connection when
charset is given to the MySQL driver, to appease an apparent behavior
observed in MySQL 8.0 that raises a collation error when a UNION includes
string columns unioned against columns of the form CAST(NULL AS CHAR(..)),
which is what SQLAlchemy's polymorphic_union function does.   The issue
seems to have affected PyMySQL for at least a year, however has recently
appeared as of mysqlclient 1.4.4 based on changes in how this DBAPI creates
a connection.  As the presence of this directive impacts three separate
MySQL charset settings which each have intricate effects based on their
presense,  SQLAlchemy will now emit the directive on new connections to
ensure correct behavior.

Fixes: #4804
Change-Id: If9d7ee00d0ccaf773972b564fe455e8e9edf6627
(cherry picked from commit f5e57f7c311288d892894edcc44d901b5bfbb3d1)

5 years ago- shore up TypeDecorator docs a bit to not render tons of
Mike Bayer [Sun, 11 Aug 2019 02:20:31 +0000 (22:20 -0400)] 
- shore up TypeDecorator docs a bit to not render tons of
comparator methods

Change-Id: I8f434b18b2bd632a0db0db1376262944272d2198
(cherry picked from commit 731a20049b372ee2e0c7408519623363e22a4db4)

5 years agoClarify INSERT/UPDATE defaults vs. data marshalling
Mike Bayer [Sat, 10 Aug 2019 22:17:59 +0000 (18:17 -0400)] 
Clarify INSERT/UPDATE defaults vs. data marshalling

- Add a full introductory paragraph to INSERT/UPDATE defaults
stating what we mean when we talk about this concept.  Add a note
differentiating what a default does, vs. a rule that intercepts
data as it moves into the database, providing links

- Add a quick section referring to TypeDecorator in the ORM
section on modifying attribute behavior

- Add an "ORM tip", a new thing that we can use in Core to link
to ORM concepts when useful, in the TypeDecorator section which
mentions that for more open ended conversion of arbitrary user
data based on business rules, @validates might be useful
(although this still does not suit the case of full blown form
validation).

- add glossary entries for DML, data marshalling since we already
use these terms and I'd like to refer to them more often.

Fixes: #4796
Change-Id: Ic4cd5c1595fd51c00a9bf24c021d2e56d457d346
(cherry picked from commit cda0b4a2b909be55cef7a844a04689ec527041c0)

5 years agoCorrect name for json_serializer / json_deserializer, document and test
Mike Bayer [Fri, 9 Aug 2019 03:34:20 +0000 (23:34 -0400)] 
Correct name for json_serializer / json_deserializer, document and test

The dialects that support json are supposed to take arguments
``json_serializer`` and ``json_deserializer`` at the create_engine() level,
however the SQLite dialect calls them ``_json_serilizer`` and
``_json_deserilalizer``.  The names have been corrected, the old names are
accepted with a change warning, and these parameters are now documented as
:paramref:`.create_engine.json_serializer` and
:paramref:`.create_engine.json_deserializer`.

Fixes: #4798
Change-Id: I1dbfe439b421fe9bb7ff3594ef455af8156f8851
(cherry picked from commit 104e6907284e602a8485f32fc67fd6af0c00e4d0)

5 years agoFix typo
Nils Philippsen [Sat, 27 Jul 2019 21:13:03 +0000 (23:13 +0200)] 
Fix typo

(cherry picked from commit 867b119061759d283b9695bbf2f3e960979a96f8)

5 years agoStrong reference listen function wrapped by "once"
Mike Bayer [Sat, 3 Aug 2019 03:20:06 +0000 (23:20 -0400)] 
Strong reference listen function wrapped by "once"

Fixed issue in event system where using the ``once=True`` flag with
dynamically generated listener functions would cause event registration of
future events to fail if those listener functions were garbage collected
after they were used, due to an assumption that a listened function is
strongly referenced.  The "once" wrapped is now modified to strongly
reference the inner function persistently, and documentation is updated
that using "once" does not imply automatic de-registration of listener
functions.

Fixes: #4794
Change-Id: I06388083d1633dcc89e8919eb1e51270f966df38
(cherry picked from commit e22d2b089fad1f79d53bc6238626f32f0e796ad0)

5 years agoAlways include a schema name in SQLite PRAGMA
Mike Bayer [Fri, 2 Aug 2019 17:03:29 +0000 (13:03 -0400)] 
Always include a schema name in SQLite PRAGMA

Fixed bug where usage of "PRAGMA table_info" in SQLite dialect meant that
reflection features to detect for table existence, list of table columns,
and list of foreign keys, would default to any table in any attached
database, when no schema name was given and the table did not exist in the
base schema.  The fix explicitly runs PRAGMA for the 'main' schema and then
the 'temp' schema if the 'main' returned no rows, to maintain the behavior
of tables + temp tables in the "no schema" namespace, attached tables only
in the "schema" namespace.

Fixes: #4793
Change-Id: I75bc03ef42581c46b98987510d2d2e701df07412
(cherry picked from commit e091775f1c4c817093e9a936a3abc79b5e311f93)

5 years agoDon't assume key when matching cloned columns in _make_proxy
Mike Bayer [Thu, 1 Aug 2019 15:45:34 +0000 (11:45 -0400)] 
Don't assume key when matching cloned columns in _make_proxy

Fixed issue where internal cloning of SELECT constructs could lead to a key
error if the copy of the SELECT changed its state such that its list of
columns changed.  This was observed to be occurring in some ORM scenarios
which may be unique to 1.3 and above, so is partially a regression fix.

For 1.4, the _is_clone_of key will be removed entirely as it seems to
have no purpose.  This commit is the initial backport to 1.3 which
includes tests.

Fixes: #4780
Change-Id: I0c64962a2eba3763bea3107fc7c7d7aed8244430
(cherry picked from commit 896d47f318c5c27620fd6da805f98811941b88c5)

5 years agoMerge "Invoke column_expression() for subsequent SELECTs in CompoundSelect" into...
mike bayer [Tue, 30 Jul 2019 01:57:01 +0000 (01:57 +0000)] 
Merge "Invoke column_expression() for subsequent SELECTs in CompoundSelect" into rel_1_3

6 years agoInvoke column_expression() for subsequent SELECTs in CompoundSelect
Mike Bayer [Mon, 29 Jul 2019 18:49:22 +0000 (14:49 -0400)] 
Invoke column_expression() for subsequent SELECTs in CompoundSelect

Fixed bug where :meth:`.TypeEngine.column_expression` method would not be
applied to subsequent SELECT statements inside of a UNION or other
:class:`.CompoundSelect`, even though the SELECT statements are rendered at
the topmost level of the statement.   New logic now differentiates between
rendering the column expression, which is needed for all SELECTs in the
list, vs. gathering the returned data type for the result row, which is
needed only for the first SELECT.

Fixes: #4787
Change-Id: Iceb63e430e76d2365649aa25ead09c4e2a062e10
(cherry picked from commit 2ce8a04e726daecbf060684dcee7559634506700)

6 years agoCorrect for MySQL 8.0 table and schema names in FK reflection
Mike Bayer [Mon, 29 Jul 2019 18:07:21 +0000 (14:07 -0400)] 
Correct for MySQL 8.0 table and schema names in FK reflection

Added another fix for an upstream MySQL 8 issue where a case sensitive
table name is reported incorrectly in foreign key constraint reflection,
this is an extension of the fix first added for :ticket:`4344` which
affects a case sensitive column name.  The new issue occurs through MySQL
8.0.17, so the general logic of the 88718 fix remains in place.

.. seealso::

    https://bugs.mysql.com/bug.php?id=96365 - upstream bug

Fixes: #4751
Change-Id: I391903565db919b85b6b3c62c28f4b90ee596135
(cherry picked from commit 9a6654e3af74710b55feb6b5b0218dc767d7013b)

6 years agoMerge "Add ARRAY and MEMBER to MySQL reserved words" into rel_1_3
mike bayer [Sat, 27 Jul 2019 17:56:48 +0000 (17:56 +0000)] 
Merge "Add ARRAY and MEMBER to MySQL reserved words" into rel_1_3

6 years agoAdd ARRAY and MEMBER to MySQL reserved words
Mike Bayer [Sat, 27 Jul 2019 14:43:59 +0000 (10:43 -0400)] 
Add ARRAY and MEMBER to MySQL reserved words

Also sort the listing of reserved words.

Fixes: #4783
Change-Id: I8a7370a424d7c78efb4916d3307600b8e85f98ac
(cherry picked from commit d08d27b897569ff8f18ca869b00a058652111c24)

6 years agoEnsure all Index arguments are counted when matching expr/columns
Mike Bayer [Tue, 23 Jul 2019 22:38:48 +0000 (18:38 -0400)] 
Ensure all Index arguments are counted when matching expr/columns

Fixed issue where :class:`.Index` object which contained a mixture of
functional expressions which were not resolvable to a particular column,
in combination with string-based column names, would fail to initialize
its internal state correctly leading to failures during DDL compilation.

Fixes: #4778
Change-Id: I0fa9c627a1fde92ba8b9ed10af167c156012bd5d
(cherry picked from commit 33616a85c7c35ec1b1756a43e44a621b744e75fa)

6 years agoDon't assume m2o key is present in the dictionary
Mike Bayer [Tue, 23 Jul 2019 13:24:32 +0000 (09:24 -0400)] 
Don't assume m2o key is present in the dictionary

Fixed regression caused by new selectinload for many-to-one logic where
a primaryjoin condition not based on real foreign keys would cause
KeyError if a related object did not exist for a given key value on the
parent object.

Fixes: #4777
Change-Id: I4ba96318302be68abe0e8c3611684087a04a2322
(cherry picked from commit 8f5b65f4316e21d19b00266cdd9eded3d4ec51b2)

6 years agoVersion 1.3.7 placeholder
Mike Bayer [Sun, 21 Jul 2019 21:10:02 +0000 (17:10 -0400)] 
Version 1.3.7 placeholder

6 years ago- 1.3.6 rel_1_3_6
Mike Bayer [Sun, 21 Jul 2019 20:37:07 +0000 (16:37 -0400)] 
- 1.3.6

6 years agoFix typos
Min ho Kim [Sun, 21 Jul 2019 00:51:29 +0000 (10:51 +1000)] 
Fix typos

(cherry picked from commit 7e588aadaab27a53b226a4637be9b4022ab46956)

Change-Id: Ibd2fbf365ed2b8f0d1765ef7271d28ab3a2d073a

6 years agoOptimize out JOIN for selectinload with many to one
Mike Bayer [Fri, 19 Jul 2019 17:05:06 +0000 (13:05 -0400)] 
Optimize out JOIN for selectinload with many to one

The optimzation applied to selectin loading in :ticket:`4340` where a JOIN
is not needed to eagerly load related items is now applied to many-to-one
relationships as well, so that only the related table is queried for a
simple join condition.   In this case, the related items are queried
based on the value of a foreign key column on the parent; if these columns
are deferred or otherwise not loaded on any of the parent objects in
the collection, the loader falls back to the JOIN method.

Fixes: #4775
Change-Id: I398e0d276789ce6e0019d213a37bdf99d24ec290
(cherry picked from commit a5a66f1e580150a55a729e7b6dc804adb55b2f5c)

6 years agoMerge "Include 'p' for get_indexes() query" into rel_1_3
mike bayer [Fri, 19 Jul 2019 20:24:36 +0000 (20:24 +0000)] 
Merge "Include 'p' for get_indexes() query" into rel_1_3

6 years agoInclude 'p' for get_indexes() query
Mike Bayer [Fri, 19 Jul 2019 14:40:27 +0000 (10:40 -0400)] 
Include 'p' for get_indexes() query

Added support for reflection of indexes on PostgreSQL partitioned tables,
which was added to PostgreSQL as of version 11.

Fixes: #4771
Change-Id: I9e8e75c4d8a667b4d52d12afbd384e0a8db00466
(cherry picked from commit a739a3449ff20ba90f92305ed4bbdd36e05bc862)

6 years agoSupport tuple IN VALUES for SQLite, others
Mike Bayer [Tue, 16 Jul 2019 16:41:09 +0000 (12:41 -0400)] 
Support tuple IN VALUES for SQLite, others

Added support for composite (tuple) IN operators with SQLite, by rendering
the VALUES keyword for this backend.  As other backends such as DB2 are
known to use the same syntax, the syntax is enabled in the base compiler
using a dialect-level flag ``tuple_in_values``.   The change also includes
support for "empty IN tuple" expressions for SQLite when using "in_()"
between a tuple value and an empty set.

Fixes: #4766
Change-Id: I416e1af29b31d78f9ae06ec3c3a48ef6d6e813f5
(cherry picked from commit 88168db8e9a51ce438e06bfe792e758ed9297ab8)

6 years agoMerge "Fixes for uselist=True with m2o relationships" into rel_1_3
mike bayer [Thu, 18 Jul 2019 16:55:33 +0000 (16:55 +0000)] 
Merge "Fixes for uselist=True with m2o relationships" into rel_1_3

6 years agoFix regression for self-ref join to self error message
Mike Bayer [Thu, 18 Jul 2019 15:12:49 +0000 (11:12 -0400)] 
Fix regression for self-ref join to self error message

Fixed regression caused by :ticket:`4365` where a join from an entity to
itself without using aliases no longer raises an informative error message,
instead failing on an assertion.  The informative error condition has been
restored.

Fixes: #4773
Change-Id: Iabeb56f3f0c2a40e350fd7c69f07c02dc9804c2c
(cherry picked from commit 736186f840646773217d3f7ba3f6a5d0bbfe1fdb)

6 years agoFixes for uselist=True with m2o relationships
Mike Bayer [Thu, 18 Jul 2019 14:58:24 +0000 (10:58 -0400)] 
Fixes for uselist=True with m2o relationships

Fixed bug where a many-to-one relationship that specified ``uselist=True``
would fail to update correctly during a primary key change where a related
column needs to change.

Fixed bug where the detection for many-to-one or one-to-one use with a
"dynamic" relationship, which is an invalid configuration, would fail to
raise if the relationship were configured with ``uselist=True``.  The
current fix is that it warns, instead of raises, as this would otherwise be
backwards incompatible, however in a future release it will be a raise.

Fixes: #4772
Change-Id: Ibd5d2f7329ff245c88118e2533fc8ef42a09fef3
(cherry picked from commit 5e8c7c88de2d9bac58e82bc1e5af7fcad5405855)

6 years agoSmall text error in json field doc
Denis Kataev [Mon, 8 Jul 2019 16:32:20 +0000 (21:32 +0500)] 
Small text error in json field doc

Small fix json field doc

(cherry picked from commit 7b8ff3c335938532b70e6ffff212bd8f67c56add)

6 years agoFix doc for #4765
Denis Kataev [Wed, 17 Jul 2019 16:02:53 +0000 (21:02 +0500)] 
Fix doc for #4765

(cherry picked from commit 86d8b12a6b3f3d5481614dd79aa1977e93d91d8b)

6 years agoIntercept unresolveable comparator attrbute error for attr access
Mike Bayer [Tue, 16 Jul 2019 17:02:16 +0000 (13:02 -0400)] 
Intercept unresolveable comparator attrbute error for attr access

Fixed bug where a synonym created against a mapped attribute that does not
exist yet, as is the case when it refers to backref before mappers are
configured, would raise recursion errors when trying to test for attributes
on it which ultimately don't exist (as occurs when the classes are run
through Sphinx autodoc), as the unconfigured state of the synonym would put
it into an attribute not found loop.

Fixes: #4767
Change-Id: I9aade8628349fbf538181a0049416cec0a17179c
(cherry picked from commit 234723fa296c9fa7ac63f1c4d877edc7ba120edd)

6 years agoPin pycodestyle
Mike Bayer [Wed, 17 Jul 2019 14:40:03 +0000 (10:40 -0400)] 
Pin pycodestyle

PyCQA/pydocstyle#375

Change-Id: Ifc7ead440010e89474300407fea5770956ff1aaf
(cherry picked from commit 1a9f5754e088ff521bf41bddc42b32ec989a8877)