]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
6 years agohappy new year
Mike Bayer [Fri, 11 Jan 2019 15:06:10 +0000 (10:06 -0500)] 
happy new year

Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
(cherry picked from commit 6f270fb0e344016ce526e0a1ecb3e3de9ffd1e3b)

6 years agoLeave bytestring exception messages as bytestrings
Mike Bayer [Thu, 10 Jan 2019 17:03:40 +0000 (12:03 -0500)] 
Leave bytestring exception messages as bytestrings

Fixed a regression introduced in version 1.2 where a refactor
of the :class:`.SQLAlchemyError` base exception class introduced an
inappropriate coercion of a plain string message into Unicode under
python 2k, which is not handled by the Python interpreter for characters
outside of the platform's encoding (typically ascii).  The
:class:`.SQLAlchemyError` class now passes a bytestring through under
Py2K for ``__str__()`` as is the behavior of exception objects in general
under Py2K, does a safe coercion to unicode utf-8 with
backslash fallback for ``__unicode__()``.  For Py3K the message is
typically unicode already, but if not is again safe-coerced with utf-8
with backslash fallback for the ``__str__()`` method.

Fixes: #4429
Change-Id: I2289da3f2c45c7d0041fa43d838958f7614defc3
(cherry picked from commit 2db54ee92ebd0970f52b271e152a6df9b563693f)

6 years agoSkip expression-based index reflection for SQLite
Mike Bayer [Wed, 9 Jan 2019 16:42:02 +0000 (11:42 -0500)] 
Skip expression-based index reflection for SQLite

Reflection of an index based on SQL expressions are now skipped with a
warning, in the same way as that of the Postgresql dialect, where we currently
do not support reflecting indexes that have SQL expressions within them.
Previously, an index with columns of None were produced which would break
tools like Alembic.

Fixes: #4431
Change-Id: I1363ade912d206b42669331e2be2bb6f444b65a2
(cherry picked from commit 08994cb97c501a3cf984fd827eba9aa9614b9dd3)

6 years agoRender correct DDL for unsetting table comments
Mike Bayer [Wed, 9 Jan 2019 16:18:02 +0000 (11:18 -0500)] 
Render correct DDL for unsetting table comments

Fixed issue where the DDL emitted for :class:`.DropTableComment`, which
will be used by an upcoming version of Alembic, was incorrect for the MySQL
and Oracle databases.

Fixes: #4436
Change-Id: I196de09495a37adface4caa9dcbc29a6d0ad159a
(cherry picked from commit 2a840c147e49d833f8a11de3964a0a8588d72508)

6 years agoUpdate index.rst - Added link to Drill dialect.
Charles S. Givre [Tue, 8 Jan 2019 19:45:19 +0000 (14:45 -0500)] 
Update index.rst - Added link to Drill dialect.

Added link to Apache Drill dialect.

(cherry picked from commit 86f243a8747c28f87dce5d34fb42501ddfb5d387)

6 years agoPost black reformatting
Mike Bayer [Sun, 6 Jan 2019 06:32:41 +0000 (01:32 -0500)] 
Post black reformatting

Applied on top of a pure run of black -l 79 in
I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9,  this set of changes
resolves all remaining flake8 conditions for those codes
we have enabled in setup.cfg.

Included are resolutions for all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.

Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe

6 years ago Run black -l 79 against all source files
Mike Bayer [Sun, 6 Jan 2019 06:31:01 +0000 (01:31 -0500)] 
 Run black -l 79 against all source files

This is a straight reformat run using black as is, with no edits
applied at all.

The black run will format code consistently, however in
some cases that are prevalent in SQLAlchemy code it produces
too-long lines.   The too-long lines will be resolved in the
following commit that will resolve all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.

Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9

6 years agoAssorted pre-Black fixes
Mike Bayer [Sun, 6 Jan 2019 03:42:08 +0000 (22:42 -0500)] 
Assorted pre-Black fixes

Fixes to the test suite, a few errant imports, and setup.py:

- mysql and postgresql have unused 'json' imports; remove
- postgresql is exporting the 'json' symbol, remove
- make sure setup.py can find __version__ using " or '
- retry logic in provision create database for postgresql fixed
- refactor test_magazine to use cls.tables rather than globals
- remove unused class in test_scoping
- add a comment to test_deprecations that this test suite itself
  is deprecated
- don't use mapper() and orm_mapper() in test_unitofwork, just
  use mapper()
- remove dupe test_scalar_set_None test in test_attributes
- Python 2.7 and above includes unittest.SkipTest, remove pre-2.7
  fallback
- use imported SkipTest in profiling
- declarative test_reflection tests with "reflectable_autoincrement"
  already don't run on oracle or firebird; remove conditional logic
  for these, which also removes an "id" symbol
- clean up test in test_functions, remove print statement
- remove dupe test_literal_processor_coercion_native_int_out_of_range
  in test/sql/test_types.py
- fix psycopg2_hstore ref

Change-Id: I7b3444f8546aac82be81cd1e7b6d8b2ad6834fe6
(cherry picked from commit 404e69426b05a82d905cbb3ad33adafccddb00dd)

6 years agoPrep for flake8 refactoring
Mike Bayer [Fri, 4 Jan 2019 03:28:09 +0000 (22:28 -0500)] 
Prep for flake8 refactoring

a few code changes ahead of time to handle some __all__
issues better.  also include new flake8 rules, since the
existing flake8 doesn't pass in any case.

Change-Id: I1efdf75124ae7bcac719c22e505bb5b13db06c04
(cherry picked from commit d229360a8d4071c2f150558897f37e13eb09f430)

6 years agorework the exclusions spec expression
Mike Bayer [Mon, 31 Dec 2018 03:02:12 +0000 (22:02 -0500)] 
rework the exclusions spec expression

The expression was expecting spaces which means we were skipping
Postgresql window function tests and possibly other things.

Change-Id: I57c4aed558f4011f2f7b882a2d9b1fee210f9eaf
(cherry picked from commit 1eaf9dc7776b9833a9fb62fe630b4b9ac63a31f4)

6 years agocommit 1b774808c926665047bf353222ecd191679a95d1
Lele Gaifax [Mon, 31 Dec 2018 02:16:11 +0000 (21:16 -0500)] 
commit 1b774808c926665047bf353222ecd191679a95d1
Author: Lele Gaifax <lele@metapensiero.it>
Date:   Tue Dec 25 12:35:41 2018 +0100

    Consistently use "PostgreSQL", fixing also a few doc glitches

commit 0e382aaee4427193926f0dc10ad29056bc12c85e
Author: Lele Gaifax <lele@metapensiero.it>
Date:   Tue Dec 25 12:08:49 2018 +0100

    Remove duplicated words

Change-Id: Iaa586b9412f46a50fe6ff3bbb92e07d6cb1905c8
(cherry picked from commit c0f9708fde39175c8695fdd87873464f516fdf98)

6 years agoAdd missing disambiguation to non-primary mapper example
Mike Bayer [Fri, 28 Dec 2018 14:33:07 +0000 (09:33 -0500)] 
Add missing disambiguation to non-primary mapper example

The mapping to B over a join defines an alternate primary key
based on all the primary key columns in the join unless we
re-define it explicitly.   Similarly, people expect that
``.id`` looks the same.  make sure these line up with the
old mapping.

Change-Id: I1ab064c57019e79c34293f6588d1e033f7083974
(cherry picked from commit 16f08cbed5ff4f0f0b08dbd0dbd6e49aaee79163)

6 years ago- remove non-working dialects some of which are 404's
Mike Bayer [Mon, 24 Dec 2018 05:07:22 +0000 (00:07 -0500)] 
- remove non-working dialects some of which are 404's
- put the five major dialect names on the front page
- remove old change messages

Change-Id: Ibf1dc2c499f10f98efb6c97d6c53e442e7746200
(cherry picked from commit eae62d00049a24c028ba95e13b5199cfa59a1180)

6 years agoMaintain compiled_params / replacement_expressions within expanding IN
Mike Bayer [Fri, 21 Dec 2018 22:35:12 +0000 (17:35 -0500)] 
Maintain compiled_params / replacement_expressions within expanding IN

Fixed issue in "expanding IN" feature where using the same bound parameter
name more than once in a query would lead to a KeyError within the process
of rewriting the parameters in the query.

Fixes: #4394
Change-Id: Ibcadce9fefbcb060266d9447c2044ee6efeccf5a
(cherry picked from commit c495769751e8b19d54fb92388ced587b5d13b85d)

6 years agoHandle PostgreSQL enums in remote schemas
Mike Bayer [Fri, 21 Dec 2018 16:04:14 +0000 (11:04 -0500)] 
Handle PostgreSQL enums in remote schemas

Fixed issue where a :class:`.postgresql.ENUM` or a custom domain present
in a remote schema would not be recognized within column reflection if
the name of the enum/domain or the name of the schema required quoting.
A new parsing scheme now fully parses out quoted or non-quoted tokens
including support for SQL-escaped quotes.

Fixed issue where multiple :class:`.postgresql.ENUM` objects referred to
by the same :class:`.MetaData` object would fail to be created if
multiple objects had the same name under different schema names.  The
internal memoization the Postgresql dialect uses to track if it has
created a particular :class:`.postgresql.ENUM` in the database during
a DDL creation sequence now takes schema name into account.

Fixes: #4416
Change-Id: I8cf03069e10b12f409e9b6796e24fc5850979955
(cherry picked from commit 0b0a4c8ba2465fce5fa1954a0d31b44840f1b4b8)

6 years agoRewrite the convert_unicode docs and add tons of dragons
Mike Bayer [Fri, 21 Dec 2018 17:13:13 +0000 (12:13 -0500)] 
Rewrite the convert_unicode docs and add tons of dragons

These flags will all be going away as Python 3 has solved
all of this.

Change-Id: I4f581d8dd7826dd823b671d0d8e72250284236c8
(cherry picked from commit 7f12f63c3a8c77715135126aac88ac6055b279c0)

6 years agoAdd missing parameter to docstring
Agam Rafaeli [Mon, 17 Dec 2018 17:58:19 +0000 (12:58 -0500)] 
Add missing parameter to docstring

Closes: #4410
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4410
Pull-request-sha: 070a0f44f3a6ce651e6b8e9dcc84d2d507d00845

Change-Id: I7a026bf6a2041e7686d90d5f155b88d8001f2ba8
(cherry picked from commit b1e4b597811768378d964e16bd142e8ee8c448d8)

6 years agoDocument and support nested composites
Mike Bayer [Wed, 12 Dec 2018 17:51:20 +0000 (12:51 -0500)] 
Document and support nested composites

Composites can behave in a "nested" fashion by defining the
class in that way.   To make the constructor more convenient,
a callable can be passed to :func:`.composite` instead of the
class itself.  This works now, so add a test to ensure this
pattern remains available.

Change-Id: Ia009f274fca7269f41d6d824e0f70b6fb0ada081
(cherry picked from commit d4a130bb1b92869efe33675262c7b1fde364e477)

6 years agoVersion 1.2.16 placeholder
Mike Bayer [Tue, 11 Dec 2018 21:56:37 +0000 (16:56 -0500)] 
Version 1.2.16 placeholder

6 years ago- 1.2.15 rel_1_2_15
Mike Bayer [Tue, 11 Dec 2018 21:49:28 +0000 (16:49 -0500)] 
- 1.2.15

6 years agoRefer to existing of_type when resolving string attribute name
Mike Bayer [Fri, 7 Dec 2018 21:01:04 +0000 (16:01 -0500)] 
Refer to existing of_type when resolving string attribute name

Fixed bug where chaining of mapper options using
:meth:`.RelationshipProperty.of_type` in conjunction with a chained option
that refers to an attribute name by string only would fail to locate the
attribute.

Fixes: #4400
Change-Id: I01bf449ec4d8f56bb8c34e25153c1c9b31ff8012
(cherry picked from commit 099f3fd812ff4424f90f3c2b41ddce7049a54022)

6 years agoAdd versioned_update_old_row example
Mike Bayer [Fri, 7 Dec 2018 19:01:23 +0000 (14:01 -0500)] 
Add versioned_update_old_row example

A modification to the "turn UPDATE into INSERT" recipe that
also UPDATEs the previous row.  The example is using timestamps
to maintain a relationship between two objects.

Change-Id: Ifdb8ee73616190384263bbe88c71d9278d616f6b
(cherry picked from commit 5851bf113821af6ce2e61484f103a44f4fabe430)

6 years ago- fix formatting on examples to list the description first, some flake8
Mike Bayer [Fri, 7 Dec 2018 17:17:59 +0000 (12:17 -0500)] 
- fix formatting on examples to list the description first, some flake8

Change-Id: I57144a559f20abab02e745d052be5ff84edec7f8
(cherry picked from commit c89729cf67f441359da8289104050b01eb53160b)

6 years agoFixed typo in docs
adriennefranke [Thu, 6 Dec 2018 00:57:50 +0000 (18:57 -0600)] 
Fixed typo in docs

Fixes: #4166
Fixes: #4399
Change-Id: I49494209463089114e77dfc737c811837d49ea20
(cherry picked from commit 09856b911ba52befc330676ad831d7829f88ef20)

6 years agoMerge "Move CRUDTest, InlineDefaultTest from test_compiler" into rel_1_2
mike bayer [Tue, 4 Dec 2018 14:28:18 +0000 (14:28 +0000)] 
Merge "Move CRUDTest, InlineDefaultTest from test_compiler" into rel_1_2

6 years agoAll sphinx dependencies move under the github sqlalchemy organization
Mike Bayer [Mon, 3 Dec 2018 22:02:23 +0000 (17:02 -0500)] 
All sphinx dependencies move under the github sqlalchemy organization

Change-Id: I7a0dc1ef320b6abad0eeac8b24c20f821e5b8c81
(cherry picked from commit 89f95e9badb260b78a7f1f7487feb6f9811ae06b)

6 years agoMerge "Fix PostgreSQL reflection of domains expressed as arrays" into rel_1_2
mike bayer [Mon, 3 Dec 2018 02:35:20 +0000 (02:35 +0000)] 
Merge "Fix PostgreSQL reflection of domains expressed as arrays" into rel_1_2

6 years ago"left" -> "accidentally placed at"
Mike Bayer [Sun, 2 Dec 2018 23:54:40 +0000 (18:54 -0500)] 
"left" -> "accidentally placed at"

since "left" is kind of ambiguous, use more explicit terminology
here.

Also update the test to use a positive assertion that the
warning is emitted; quote the attribute name.

Change-Id: Ic2284c200a26b32b2da063cfaf6d59547309d587
References: https://github.com/zzzeek/sqlalchemy/pull/488
(cherry picked from commit eacb31a89fe883edd0ada7f2724239c1f8c5b685)

6 years agoMove CRUDTest, InlineDefaultTest from test_compiler
Mike Bayer [Sat, 1 Dec 2018 19:28:57 +0000 (14:28 -0500)] 
Move CRUDTest, InlineDefaultTest from test_compiler

test_compiler is mostly related to SELECT statements as well
as smaller SQL elements.  While it still has some DDL related
tests, move out all the remaining insert/update tests into
the already present test_insert.py, test_update.py

Fixes: #2630
Change-Id: I4167618543fd1235d12d1717c8c629d2374b325a
(cherry picked from commit 87cdda008673e01e2c32049f103e9cdebd2a5d77)

6 years agoFix PostgreSQL reflection of domains expressed as arrays
Jakub Synowiec [Sat, 1 Dec 2018 18:26:43 +0000 (13:26 -0500)] 
Fix PostgreSQL reflection of domains expressed as arrays

Fixed issue where reflection of a PostgreSQL domain that is expressed as an
array would fail to be recognized.  Pull request courtesy Jakub Synowiec.

Fixes: #4377
Change-Id: I252c79ca435b87d4d9172b1c84e0e74e789ef676
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4380
(cherry picked from commit 46f9c3c7d4d2c31f3f1627dcf777bd3215e13e3d)

6 years agoMerge "Add the write_timeout option for mysql." into rel_1_2
mike bayer [Fri, 30 Nov 2018 18:11:14 +0000 (18:11 +0000)] 
Merge "Add the write_timeout option for mysql." into rel_1_2

6 years agotypo
Raphael [Fri, 30 Nov 2018 00:11:24 +0000 (19:11 -0500)] 
typo

typo

(cherry picked from commit 0a0b36686d5da0e7d04974c8df0ece574b71f3cb)

6 years agoAdd the write_timeout option for mysql.
jun923.gu [Fri, 30 Nov 2018 05:21:29 +0000 (00:21 -0500)] 
Add the write_timeout option for mysql.

As MySQLdb support read_timeout and write_timeout option, and
sqlalchemy just support read_timeout option. So sqlalchemy need to add
write_timeout option.

Fixes: #4381
Change-Id: I2bea80bdd6f20fafc72b48fa0e5d795626d9d9b9
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4385
(cherry picked from commit 6a8454ded311010927af04db30a57d683cf67dd4)

6 years agoAdd a test harness for MySQL connect args
Mike Bayer [Wed, 28 Nov 2018 16:27:46 +0000 (11:27 -0500)] 
Add a test harness for MySQL connect args

This is to assist with #4381.

Change-Id: I5ebfc0da906a13edc4fb3f0ca7ab2d843d43bb00
(cherry picked from commit 6837e875a3367b466e2ce04ca16c7bff8fa5c575)

6 years agoMerge "Warn for lower-case column attribute on declarative" into rel_1_2
mike bayer [Tue, 27 Nov 2018 07:55:07 +0000 (07:55 +0000)] 
Merge "Warn for lower-case column attribute on declarative" into rel_1_2

6 years agoMove links etc. to github, new alembic links
Mike Bayer [Tue, 27 Nov 2018 03:58:50 +0000 (22:58 -0500)] 
Move links etc. to github, new alembic links

Change-Id: I59392d355a216ae59552a04c5508f548b901aa7b
(cherry picked from commit 50417cf758508e970f3fccc99af6a501ceac8eb2)

6 years agoWarn for lower-case column attribute on declarative
Mike Bayer [Mon, 26 Nov 2018 05:59:01 +0000 (00:59 -0500)] 
Warn for lower-case column attribute on declarative

A warning is emitted in the case that a :func:`.column` object is applied to
a declarative class, as it seems likely this intended to be a
:class:`.Column` object.

Fixes: #4374
Change-Id: I2e617ef65547162e3ba6587c168548ad0cf6203d
(cherry picked from commit 6ec40eca1a03a9156ee82f3ce75850778220b39e)

6 years ago- remove @HEAD indicator from docs requirements, fixes #4375
Mike Bayer [Mon, 26 Nov 2018 04:54:44 +0000 (23:54 -0500)] 
- remove @HEAD indicator from docs requirements, fixes #4375

Change-Id: I50b1622c2c2236bf9e436f61c7eea31faaeaa3e1
(cherry picked from commit b5cb68ac432bb7477642305504ddcfdb3edaf87f)

6 years ago- fix spacing
Mike Bayer [Fri, 16 Nov 2018 00:51:03 +0000 (19:51 -0500)] 
- fix spacing

Change-Id: I460d873b4c6a250594e291b5f47fff5a06280817
(cherry picked from commit 60a8648776a9f24f8d812c2b80fee4b06c4b13e9)

6 years agoRepair tutorial code example to be deterministic
Mike Bayer [Fri, 16 Nov 2018 00:48:45 +0000 (19:48 -0500)] 
Repair tutorial code example to be deterministic

A few queries featured an aggregate without a GROUP BY
or a complete ordering, causing the doctests to fail
with recent versions of SQLite.  The queries are now made
to include a GROUP BY as well as ORDER BY both columns.

Fixes: #4370
Change-Id: I904bddb4372224158fcecff9f0dbbbe7c1bf36b3
(cherry picked from commit 477a64e2b26a84cbf6d91f0ee292c7adc50d7a88)

6 years agoModernize cx_oracle connect documentation
Mike Bayer [Thu, 15 Nov 2018 17:52:33 +0000 (12:52 -0500)] 
Modernize cx_oracle connect documentation

in preparation for #4369, however the documentation was
also inaccurate in that it did not mention connect_args.

Change-Id: I992e5f53ce16cc9c72d2c893a3ca798a9c2b4d07
(cherry picked from commit 996727ed89cd2403e75e3ab924f01754d408075d)

6 years agoAdd secondary selectable to FROM clauses for correlated exists
Mike Bayer [Wed, 14 Nov 2018 16:02:40 +0000 (11:02 -0500)] 
Add secondary selectable to FROM clauses for correlated exists

In continuing with a similar theme as that of very recent :ticket:`4349`,
repaired issue with :meth:`.RelationshipProperty.Comparator.any` and
:meth:`.RelationshipProperty.Comparator.has` where the "secondary"
selectable needs to be explicitly part of the FROM clause in the
EXISTS subquery to suit the case where this "secondary" is a :class:`.Join`
object.

Fixes: #4366
Change-Id: Icd0d0c3871bbd0059f0c9256e2b980edc2c90551
(cherry picked from commit fdfd1680603f6663182ba4766ae2f5abdd3ced45)

6 years agoMerge "Deannotate "parententity" in primaryjoin/secondaryjoin" into rel_1_2
mike bayer [Wed, 14 Nov 2018 19:22:36 +0000 (19:22 +0000)] 
Merge "Deannotate "parententity" in primaryjoin/secondaryjoin" into rel_1_2

6 years agoDeannotate "parententity" in primaryjoin/secondaryjoin
Mike Bayer [Wed, 14 Nov 2018 16:31:22 +0000 (11:31 -0500)] 
Deannotate "parententity" in primaryjoin/secondaryjoin

Fixed bug where the ORM annotations could be incorrect for the
primaryjoin/secondaryjoin a relationship if one used the pattern
``ForeignKey(SomeClass.id)`` in the declarative mappings.   This pattern
would leak undesired annotations into the join conditions which can break
aliasing operations done within :class:`.Query` that are not supposed to
impact elements in that join condition.  These annotations are now removed
up front if present.

Also add a test suite for has/any into test_query which will
form the basis for new tests to be added in :ticket:`4366`.

Fixes: #4367
Change-Id: I929ef983981bb49bf975f346950ebb0e19c986b8
(cherry picked from commit 4ee5b2c4a9e7ad9f3df75940b9837d5c65cba6fd)

6 years agoInsert primary entity in dynamic "secondary"
Mike Bayer [Mon, 12 Nov 2018 20:09:37 +0000 (15:09 -0500)] 
Insert primary entity in dynamic "secondary"

Fixed regression caused by :ticket:`4349` where adding the "secondary"
table to the FROM clause for a dynamic loader would affect the ability of
the :class:`.Query` to make a subsequent join to another entity.   The fix
adds the primary entity as the first element of the FROM list since
:meth:`.Query.join` wants to jump from that.   Version 1.3 will have
a more comprehensive solution to this problem as well (:ticket:`4365`).

Fixes: #4363
Change-Id: I1abbb6207722619dc5369e1fd96de43d60a1ee62
(cherry picked from commit 40c1a46e993b5c5ff917ce41c3dca66c139bde94)

6 years agoVersion 1.2.15 placeholder
Mike Bayer [Sat, 10 Nov 2018 20:59:12 +0000 (15:59 -0500)] 
Version 1.2.15 placeholder

6 years ago- 1.2.14 rel_1_2_14
Mike Bayer [Sat, 10 Nov 2018 20:50:34 +0000 (15:50 -0500)] 
- 1.2.14

6 years agoRevert "- 1.2.14"
Mike Bayer [Sat, 10 Nov 2018 16:43:55 +0000 (11:43 -0500)] 
Revert "- 1.2.14"

Pypi is down for maintenance right now, so leave the branch open
for further changes in case we aren't able to release soon.

This reverts commit 7fcadf64fb75658d32e454636903810471596644.

6 years ago- 1.2.14
Mike Bayer [Sat, 10 Nov 2018 16:27:18 +0000 (11:27 -0500)] 
- 1.2.14

6 years agoFix typo
Mike Bayer [Sat, 10 Nov 2018 16:26:31 +0000 (11:26 -0500)] 
Fix typo

Change-Id: I411466dc1952cf57f73d1453c73b0ca449842c35
(cherry picked from commit ab1e6fb08f7cfbba94f0115368f08f6130bf0018)

6 years agoUse case insensitive matching on lower_case_table_names=1,2
Mike Bayer [Sat, 10 Nov 2018 04:18:55 +0000 (23:18 -0500)] 
Use case insensitive matching on lower_case_table_names=1,2

Fixed regression caused by :ticket:`4344` released in 1.2.13, where the fix
for MySQL 8.0's case sensitivity problem with referenced column names when
reflecting foreign key referents is worked around using the
``information_schema.columns`` view.  The workaround was failing on OSX /
``lower_case_table_names=2`` which produces non-matching casing for the
``information_schema.columns`` vs. that of ``SHOW CREATE TABLE``, so in
case-insensitive SQL modes case-insensitive matching is now used.

Fixes: #4361
Change-Id: I748549bc4c27fad6394593f8ec93fc22bfd01f6c
(cherry picked from commit af159c56957b26c523e7fe324edf7d17882f88be)

6 years agoImprove documentation re: Session.binds and partitioning strategies
Mike Bayer [Tue, 6 Nov 2018 20:13:03 +0000 (15:13 -0500)] 
Improve documentation re: Session.binds and partitioning strategies

Update documentation to include background on arbitrary superclass
usage, add full cross-linking between all related methods and parameters.
De-emphasize "twophase" and document that it is not well-supported
in drivers.

Change-Id: Id99894bb62cc506e896c9aa7c256e9f6e602243e
(cherry picked from commit 1f13c8c833ebd96c09d1499b2504aa4950dca709)

6 years agoMinor cosmetic tweaks to reST markup
Lele Gaifax [Fri, 15 Jun 2018 16:06:44 +0000 (18:06 +0200)] 
Minor cosmetic tweaks to reST markup

(cherry picked from commit e0dd82f26703f56e5fda7fb6deb579d1f96ecab9)

6 years agoDeannotate ORM columns in ColumnEntity
Mike Bayer [Fri, 2 Nov 2018 20:40:59 +0000 (16:40 -0400)] 
Deannotate ORM columns in ColumnEntity

Fixed a minor performance issue which could in some cases add unnecessary
overhead to result fetching, involving the use of ORM columns and entities
that include those same columns at the same time within a query.  The issue
has to do with hash / eq overhead when referring to the column in different
ways.

Fixes: #4347
Change-Id: I191d4d1b1623898060a9accdfd186de16f89a6b7
(cherry picked from commit 88bfa1b89c5b3b2290fa266c53322f003833af40)

6 years ago- block py.test 3.9.1 and 3.9.2, 3.9.3 is OK
Mike Bayer [Fri, 2 Nov 2018 20:54:21 +0000 (16:54 -0400)] 
- block py.test 3.9.1 and 3.9.2, 3.9.3 is OK

Change-Id: I35ecd78b92ea420ef7909de65f82e005b92bf986
(cherry picked from commit 664290ab54b654e13a116ed4534e77663267a0e7)

6 years agoUse attr keys when testing bulk update params for primary key
Mike Bayer [Fri, 2 Nov 2018 01:53:18 +0000 (21:53 -0400)] 
Use attr keys when testing bulk update params for primary key

Fixed bug in :meth:`.Session.bulk_update_mappings` where alternate mapped
attribute names would result in the primary key column of the UPDATE
statement being included in the SET clause, as well as the WHERE clause;
while usually harmless, for SQL Server this can raise an error due to the
IDENTITY column.  This is a continuation of the same bug that was fixed in
:ticket:`.3849`, where testing was insufficient to catch this additional
flaw.

Fixes: #4357
Change-Id: Iead058c0465dfa31c5b8a8780769278b7000acc8
(cherry picked from commit e991684a39fa9fae2628ce583e141b9aea99d856)

6 years agoVersion 1.2.14 placeholder
Mike Bayer [Wed, 31 Oct 2018 20:49:14 +0000 (16:49 -0400)] 
Version 1.2.14 placeholder

6 years ago- 1.2.13 rel_1_2_13
Mike Bayer [Wed, 31 Oct 2018 20:34:35 +0000 (16:34 -0400)] 
- 1.2.13

6 years agoAdd missing index method to _AssociationList.
Chris Macklin [Wed, 31 Oct 2018 13:03:50 +0000 (09:03 -0400)] 
Add missing index method to _AssociationList.

Added missing ``.index()`` method to list-based association collections
in the association proxy extension.

Change-Id: Ice81dc4bcccd520638c5bc9a0f8bb2027946c846
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/485
(cherry picked from commit 1c3b2d71863f6aefbc060798c2f50d1e029feef1)

6 years agoMerge "Move pk on single-inh subclass check below conflict resolution check" into...
mike bayer [Wed, 31 Oct 2018 15:25:06 +0000 (15:25 +0000)] 
Merge "Move pk on single-inh subclass check below conflict resolution check" into rel_1_2

6 years agoMove pk on single-inh subclass check below conflict resolution check
Tom Manderson [Tue, 30 Oct 2018 17:05:43 +0000 (13:05 -0400)] 
Move pk on single-inh subclass check below conflict resolution check

The column conflict resolution technique discussed at
:ref:`declarative_column_conflicts` is now functional for a :class:`.Column`
that is also a primary key column.  Previously, a check for primary key
columns declared on a single-inheritance subclass would occur before the
column copy were allowed to pass.

Fixes: #4352
Change-Id: Id4c025da53c28e58db6b549fe398f25f8a90d355
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/483
(cherry picked from commit 3ed79a5c18c14d842280805d1dae8a9c99ec8f18)

6 years agoAdd reserved word 'function' for MySQL
Alex Hall [Tue, 30 Oct 2018 17:00:49 +0000 (13:00 -0400)] 
Add reserved word 'function' for MySQL

Added word ``function`` to the list of reserved words for MySQL, which is
now a keyword in MySQL 8.0

Fixes: #4348
Change-Id: Idd30acda7e99076810f65d0ee860055a18dc9193
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/481
(cherry picked from commit 38c81328e91884f71af175a115dfdb423d8f4910)

6 years agoAdd missing space
wodim [Thu, 25 Oct 2018 12:11:23 +0000 (14:11 +0200)] 
Add missing space

6 years agore-word recycle parameter documentation
David Poggi [Tue, 23 Oct 2018 14:17:09 +0000 (10:17 -0400)] 
re-word recycle parameter documentation

Change-Id: I80cabcd9fa3f3b45e5355bf6c774a8eee02e7f1b
(cherry picked from commit 83864ffe634bb1e3e9e530fbe51c03a186799110)

6 years agoAdd warning to hybrid property expression and fixup crosslinks
James Owen [Thu, 4 Oct 2018 15:12:41 +0000 (17:12 +0200)] 
Add warning to hybrid property expression and fixup crosslinks

(cherry picked from commit 681bd7eb8876c8b83912b8307b2fc7500a11e6f0)

6 years agoUse the same "current_timestamp" function for both sides of round trip
Mike Bayer [Sun, 21 Oct 2018 02:20:06 +0000 (22:20 -0400)] 
Use the same "current_timestamp" function for both sides of round trip

this test was using sysdate() and current_timestamp() together
in conjunction with a truncation to DAY, however for four hours
on saturday night (see commit time :) ) these two values will
have a different value if one side is EDT and the other is UTC.

tox does not transmit environment variables including TZ by
default, so even if the server is set up for EDT, running tox
will not set TZ and at least Oracle client seems to use this
value, producing UTC for session time but the database on CI
was configured for EDT, producing EDT for sysdate.

Change-Id: I56602d2402a475a0c4fdf61c1c5fc2618c82f915
(cherry picked from commit ac358a04a7b077602ac668c19c3c40389d9e77e4)

6 years agoCheck more specifically for hybrid attr and not mapped property
Mike Bayer [Fri, 19 Oct 2018 21:10:42 +0000 (17:10 -0400)] 
Check more specifically for hybrid attr and not mapped property

Fixed regression caused by :ticket:`4326` in version 1.2.12 where using
:class:`.declared_attr` with a mixin in conjunction with
:func:`.orm.synonym` would fail to map the synonym properly to an inherited
subclass.

Fixes: #4350
Change-Id: Ib2a9b6a125a2ac7c7ff80201746b7f10e5596226
(cherry picked from commit 9335c24d6c98033f4aa1ceafd23a70b88c8ae811)

6 years agoAdd prop.secondary to FROM for dynamic loader
Mike Bayer [Wed, 17 Oct 2018 14:42:50 +0000 (10:42 -0400)] 
Add prop.secondary to FROM for dynamic loader

Fixed bug where "dynamic" loader needs to explicitly set the "secondary"
table in the FROM clause of the query, to suit the case where the secondary
is a join object that is otherwise not pulled into the query from its
columns alone.

Fixes: #4349
Change-Id: I397f62abd5603efa4fb273586d0f772bf8c8fbbf
(cherry picked from commit d080aae128b081e6870dae325cb90202329784b4)

6 years agoblock py.test 3.9.1
Mike Bayer [Wed, 17 Oct 2018 15:49:47 +0000 (11:49 -0400)] 
block py.test 3.9.1

references:

https://github.com/pytest-dev/pytest/issues/4181

Change-Id: I216fde19dd0f5c4910d76c08400f2329b09ad584
(cherry picked from commit b4d42a84e22652c16b914a2f76421718be913027)

6 years agoDon't use "is" to compare exceptions
Mike Bayer [Mon, 15 Oct 2018 05:44:13 +0000 (01:44 -0400)] 
Don't use "is" to compare exceptions

psycopg2 is introducing a fine grained exception model where
most exceptions will be specialized subclasses, so don't use
"is" to compare an expression type

Change-Id: I2eac7503e38136f0dcc0da6f77b0b1d83ea1c6dc
(cherry picked from commit c5e888a3ddb5019cdbc537f9706de537aa7b92e0)

6 years agoDon't call rollback on DBAPI connection that's "closed"
Mike Bayer [Sun, 14 Oct 2018 19:55:46 +0000 (15:55 -0400)] 
Don't call rollback on DBAPI connection that's "closed"

Use the existence of ConnectionRecord.connection to estimate
that this connection is likely closed, and if so, don't
try to call "rollback" on it.  This rollback is normally harmless
but is causing segfaults in mysqlclient due to
https://github.com/PyMySQL/mysqlclient-python/issues/270.

Change-Id: I1d7c5f5a520527d8268b6334795c2051f7ceeea6
(cherry picked from commit a8781b51b4039eee56791b9dbfdee183f7a5b797)

6 years ago- get the "now" date for this test in terms of the database to accommodate
Mike Bayer [Sat, 13 Oct 2018 03:02:12 +0000 (23:02 -0400)] 
- get the "now" date for this test in terms of the database to accommodate
for local timezone doesn't match that of the DB

Change-Id: I0899d9294e8a2bd8f7f2c3e66cf396e2e8bd4bcc
(cherry picked from commit 7405392299492c83e6fa1546d3b36f52042e3c5e)

6 years agoPerform additional retrieval of correct column names
Mike Bayer [Tue, 2 Oct 2018 21:49:44 +0000 (17:49 -0400)] 
Perform additional retrieval of correct column names

Added a workaround for a MySQL bug #88718 introduced in the 8.0 series,
where the reflection of a foreign key constraint is not reporting the
correct case sensitivity for the referred column, leading to errors during
use of the reflected constraint such as when using the automap extension.
The workaround emits an additional query to the information_schema tables in
order to retrieve the correct case sensitive name.

Fixes: #4344
Change-Id: I08020d6eec43cbe8a56316660380d3739a0b45f7
(cherry picked from commit 56fb68ca8620a211ca29b3d47d649dfa332d354a)

6 years agoAdd additional documentation for ORM fetched defaults
Mike Bayer [Tue, 2 Oct 2018 17:54:00 +0000 (13:54 -0400)] 
Add additional documentation for ORM fetched defaults

Add additional examples to the section first added as part
of #4317 to cover the use cases requested in #3921.

Fixes: #3921
Change-Id: I6ec283aa0a6fbabedef40bb4320751ab4cd990ea
(cherry picked from commit ffd27cef48241e39725c4e9cd13fd744a2806bdd)

6 years agoFix dependency_for final argument
Joe Urciuoli [Wed, 19 Sep 2018 17:40:23 +0000 (13:40 -0400)] 
Fix dependency_for final argument

Fixed issue where part of the utility language helper internals was passing
the wrong kind of argument to the Python ``__import__`` builtin as the list
of modules to be imported.  The issue produced no symptoms within the core
library but could cause issues with external applications that redefine the
``__import__`` builtin or otherwise instrument it. Pull request courtesy Joe
Urciuoli.

Per the submitter: "The fourth argument provided to `__import__`  (which
`import_` feeds in to) is supposed to be a a list of strings, but this code is
passing a single string. This was causing the sqlalchemy `import_` function to
break the string (for example 'interfaces') into an array of single characters
['i', 'n', ...], which causes the actual `__import__` to not find the module
`sqlalchemy.orm.i` (since it's trying to import `sqlalchemy.orm.i` and
`sqlalchemy.orm.n` .. etc)"

No issue could be reproduced locally as it seems you can put anything non-
empty/None into that last argument, even a list like ``['X']``, and  all the
sub-modules seem to appear.  Omit it, and then the sub-modules aren't present.
Perhaps it just runs the module or not if this attribute is present.

Change-Id: Ia15c74620f24d24f0df4882f9b36a04e2c3725b8
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/473
(cherry picked from commit cacc3c2057ab14faaf6c5b679bb2dbb6f8b98f8e)

6 years agoAdd test and retroactive changelog for issue 4040
Mike Bayer [Mon, 1 Oct 2018 18:00:39 +0000 (14:00 -0400)] 
Add test and retroactive changelog for issue 4040

Fixes: #4040
Change-Id: I707c1cd2708a37102ad8184bec21be35cb6242d7
(cherry picked from commit 313879d6adedd4fd2a07a4ec30530766f3016885)

6 years agoAdd link to Code of Conduct
Mike Bayer [Sat, 29 Sep 2018 23:12:40 +0000 (19:12 -0400)] 
Add link to Code of Conduct

Change-Id: Ib07db7c2fc97739a172e541a0681176a67f89a2f
(cherry picked from commit 29d54ab69b689c2bc4b9be8273f4c0a96e37153f)

6 years agoRemove unnecessary unicode and raw string prefix
Denis Kataev [Fri, 28 Sep 2018 07:40:30 +0000 (12:40 +0500)] 
Remove unnecessary unicode and raw string prefix

(cherry picked from commit fc5dbc30168710ef20c467a54610979cd06a58c7)

6 years agoMerge "Import from collections.abc" into rel_1_2
mike bayer [Fri, 28 Sep 2018 01:55:12 +0000 (21:55 -0400)] 
Merge "Import from collections.abc" into rel_1_2

6 years agoAdd non-primary mapper example illustrating a row-limited relationship
Mike Bayer [Fri, 28 Sep 2018 01:27:59 +0000 (21:27 -0400)] 
Add non-primary mapper example illustrating a row-limited relationship

Change-Id: Ifcb3baa6b220e375dc029794dd10c111660eac94
(cherry picked from commit 888d122dcf5881ad1bca07df2ba444e293538d99)

6 years agoImport from collections.abc
xtreak [Mon, 24 Sep 2018 16:23:54 +0000 (12:23 -0400)] 
Import from collections.abc

Fixed additional warnings generated by Python 3.7 due to changes in the
organization of the Python ``collections`` and ``collections.abc`` packages.
Previous ``collections`` warnings were fixed in version 1.2.11. Pull request
courtesy xtreak.

See I2d1c0ef97c8ecac7af152cc56263422a40faa6bb for the original collections.abc
fixes.

Fixes: #4339
Change-Id: Ia92d2461f20309fb33ea6c6f592f7d4e7e32ae7a
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/475
(cherry picked from commit 2d2fa49130249f757f6f1100dad879e1071ad385)

6 years agoMerge "Copy create_constraint flag for Enum" into rel_1_2
mike bayer [Wed, 26 Sep 2018 00:16:41 +0000 (20:16 -0400)] 
Merge "Copy create_constraint flag for Enum" into rel_1_2

6 years agoAccept multiple expressions for aggregate_order_by order_by
Mike Bayer [Tue, 25 Sep 2018 15:11:41 +0000 (11:11 -0400)] 
Accept multiple expressions for aggregate_order_by order_by

Added support for the :class:`.aggregate_order_by` function to receive
multiple ORDER BY elements, previously only a single element was accepted.

Fixes: #4337
Change-Id: I411ac31697a0d65b568ad65ce5b5181717afbd65
(cherry picked from commit b7ba3f0d9395236cbf05f830d82f6494163d1dfb)

6 years agoCopy create_constraint flag for Enum
Mike Bayer [Tue, 25 Sep 2018 14:38:40 +0000 (10:38 -0400)] 
Copy create_constraint flag for Enum

Fixed bug where the :paramref:`.Enum.create_constraint` flag on  the
:class:`.Enum` datatype would not be propagated to copies of the type, which
affects use cases such as declarative mixins and abstract bases.

Fixes: #4341
Change-Id: I978be65f33a616fe4d5f5de03fb3eaab6f6a2272
(cherry picked from commit 0737f45d4ff8fdb2e12972cc58c18345e4d6dde2)

6 years agoAllow dialects to customize group by clause compilation
Samuel Chou [Wed, 19 Sep 2018 17:30:24 +0000 (13:30 -0400)] 
Allow dialects to customize group by clause compilation

Refactored :class:`.SQLCompiler` to expose a
:meth:`.SQLCompiler.group_by_clause` method similar to the
:meth:`.SQLCompiler.order_by_clause` and :meth:`.SQLCompiler.limit_clause`
methods, which can be overridden by dialects to customize how GROUP BY
renders.  Pull request courtesy Samuel Chou.

Change-Id: I0a7238e55032558c27a0c56a72907c7b883456f1
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/474
(cherry picked from commit 33fccc486111fc6b41eab651cc7325c83099ad45)

6 years agoVersion 1.2.13 placeholder
Mike Bayer [Wed, 19 Sep 2018 18:15:18 +0000 (14:15 -0400)] 
Version 1.2.13 placeholder

6 years ago- 1.2.12 rel_1_2_12
Mike Bayer [Wed, 19 Sep 2018 18:00:00 +0000 (14:00 -0400)] 
- 1.2.12

6 years agoMerge "Adapt right side in join if lateral detected" into rel_1_2
mike bayer [Wed, 19 Sep 2018 13:30:44 +0000 (09:30 -0400)] 
Merge "Adapt right side in join if lateral detected" into rel_1_2

6 years agoAdapt right side in join if lateral detected
Mike Bayer [Mon, 17 Sep 2018 15:38:52 +0000 (11:38 -0400)] 
Adapt right side in join if lateral detected

Fixed bug where use of :class:`.Lateral` construct in conjunction with
:meth:`.Query.join` as well as :meth:`.Query.select_entity_from` would not
apply clause adaption to the right side of the join.   "lateral" introduces
the use case of the right side of a join being correlatable.  Previously,
adaptation of this clause wasn't considered.

Fixes: #4334
Change-Id: I3631e562092769d30069a2aa5e50a580f4661a23
(cherry picked from commit 43f2c66ea7413cc0aaf6ca040ad33fb65ca4412d)

6 years agoLook for dict builtin in InstanceState cleanup
Romuald Brunet [Mon, 17 Sep 2018 15:44:50 +0000 (11:44 -0400)] 
Look for dict builtin in InstanceState cleanup

Added a check within the weakref cleanup for the :class:`.InstanceState`
object to check for the presence of the ``dict`` builtin, in an effort to
reduce error messages generated when these cleanups occur during interpreter
shutdown.  Pull request courtesy Romuald Brunet.

Change-Id: If27b94d50a32767de8b4147c09fa423f71596004
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/472
(cherry picked from commit 505941259e4e7181a176e74b3de0b7d96c444e29)

6 years agoUse cx_Oracle dml_ret_array_val
Mike Bayer [Mon, 17 Sep 2018 18:05:46 +0000 (14:05 -0400)] 
Use cx_Oracle dml_ret_array_val

Fixed issue for cx_Oracle 7.0 where the behavior of Oracle param.getvalue()
now returns a list, rather than a single scalar value, breaking
autoincrement logic throughout the Core and ORM. The dml_ret_array_val
compatibility flag is used for cx_Oracle 6.3 and 6.4 to establish compatible
behavior with 7.0 and forward, for cx_Oracle 6.2.1 and prior a version
number check falls back to the old logic.

Fixes: #4335
Change-Id: Ia60f5514803a505898c1ac9252355990c6203dda
(cherry picked from commit 67a2cd92295bef55d914a5c560b4cead5d456837)

6 years agoFix doc type
Wouter Overmeire [Tue, 11 Sep 2018 12:17:02 +0000 (14:17 +0200)] 
Fix doc type

(cherry picked from commit 82006fcc937eaea99c767f35fcb642bc35da0a15)

6 years agoDon't list 1.2.x bugfixes as 1.3.0b1 bugfixes
Mike Bayer [Thu, 13 Sep 2018 23:43:12 +0000 (17:43 -0600)] 
Don't list 1.2.x bugfixes as 1.3.0b1 bugfixes

We will still list features in 1.3 as backported but
it is too verbose to have all of 1.2.x's bugfixes listed as part
of 1.3.0b1 also.

Change-Id: Icb09050734af86a66a72b3f92a6bd60ee3e2f6ee
(cherry picked from commit 5abaaaf7ebde4643130afd709c381c6a04a4ba04)

6 years agoAdd explicit note about @hybrid_property mutators re: method name
Mike Bayer [Wed, 12 Sep 2018 15:44:57 +0000 (09:44 -0600)] 
Add explicit note about @hybrid_property mutators re: method name

Fixes: #4332
Change-Id: I7c52140d3a3055a71b192fea020c795a57356d90
(cherry picked from commit 92bccc796beaa47a537a2399fd67791045f810d2)

6 years agominor spelling correction
Glyph [Thu, 6 Sep 2018 22:58:12 +0000 (15:58 -0700)] 
minor spelling correction

(cherry picked from commit 35a458c7822a8071a61da84fce021fb42cd9b086)

6 years agoClarify init_scalar event use case
Mike Bayer [Thu, 6 Sep 2018 14:44:09 +0000 (10:44 -0400)] 
Clarify init_scalar event use case

Since I didn't even realize what this was for when reading the docs,
make it clearer that this is to mirror a Column default and remove
the extra verbiage about the mechanics of INSERTs.

Change-Id: Id2c6a29800f7b723573610e4707aec7e6ea38f5f
(cherry picked from commit 71b01adc7b31baab7bbcf40123633b87ee53bf64)

6 years agoMariaDB 10.3 updates
Mike Bayer [Thu, 30 Aug 2018 21:12:58 +0000 (17:12 -0400)] 
MariaDB 10.3 updates

MariaDB seems to handle some additional UPDATE/DELETE FROM
syntaxes as well as some forms of INTERSECT and EXCEPT. Open
up tests that expect failure for MySQL to allow success for
MariaDB 10.3.

Change-Id: Ia9341a82485ef7201bb8130d8dbf4a9b6976035a
(cherry picked from commit 081d4275cf5c3e6842c8e0198542ff89617eaa96)

6 years agoFix links and update verbiage for reset_on_return
Mike Bayer [Tue, 28 Aug 2018 18:58:05 +0000 (14:58 -0400)] 
Fix links and update verbiage for reset_on_return

Change-Id: I642056b78570b44fdefe7f0874a8e4c720389f14
(cherry picked from commit d8bb208a85f6366c58426a85b3d4ec1d6e43ac6c)

6 years agodocument expanding bound parameters, in_(), and baked query use cases
Mike Bayer [Mon, 27 Aug 2018 18:53:36 +0000 (14:53 -0400)] 
document expanding bound parameters, in_(), and baked query use cases

cherry-picked from 90a772b19339b97517bc46f016122341528e440a with modifications

Change-Id: I09ccd73ebabbea4b5098ba5b170786ac065444c8

6 years ago- pep8 cleanup
Mike Bayer [Mon, 27 Aug 2018 15:11:04 +0000 (11:11 -0400)] 
- pep8 cleanup

Change-Id: I1d6eaf91c069bd5dd55a40ddd38e2f440b259fea
(cherry picked from commit d3dee71c24eabf60e67ecbc6b42d31a38d493105)