]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
6 years agoAdd .pre-commit-config.yaml
Mike Bayer [Sat, 18 May 2019 14:47:39 +0000 (10:47 -0400)] 
Add .pre-commit-config.yaml

See https://pre-commit.com/ for documentation on how to use
this file.

SQLAlchemy and related projects make use of Black and zimports
for code formatting, this hook allows for automated pre-commit
runs.

Change-Id: I4bbb49747e9f7fb52251dc61ecda98361cd036fd
(cherry picked from commit 69ebf2cc365baf82016c9d1672fe89e39594b523)

6 years agoMutex the declarative scan/map process against configure_mappers()
Mike Bayer [Thu, 16 May 2019 15:26:04 +0000 (11:26 -0400)] 
Mutex the declarative scan/map process against configure_mappers()

Applied the mapper "configure mutex" against the declarative class mapping
process, to guard against the race which can occur if mappers are used
while dynamic module import schemes are still in the process of configuring
mappers for related classes.  This does not guard against all possible race
conditions, such as if the concurrent import has not yet encountered the
dependent classes as of yet, however it guards against as much as possible
within the SQLAlchemy declarative process.

Fixes: #4686
Change-Id: I0349036b8078bd42265ab40862cfbfe5bf9d5b44
(cherry picked from commit 5039c6f01d0bd1f58f950e80cddf7472444a70a4)

6 years agoDocument and test modification of .values in before_compile_update
Mike Bayer [Thu, 16 May 2019 00:27:30 +0000 (20:27 -0400)] 
Document and test modification of .values in before_compile_update

Change-Id: I2a694bcf24b06806dc98651015e7c7a8b090ff65
(cherry picked from commit 89e6beaf46ebdd626e292eb20f7b6ae0c3a9ae5c)

6 years agoRecognize message 20047 as disconnect event in MSDialect_pymssql
Jon Schuff [Tue, 14 May 2019 20:45:10 +0000 (16:45 -0400)] 
Recognize message 20047 as disconnect event in MSDialect_pymssql

Added error code 20047 to "is_disconnect" for pymssql.  Pull request
courtesy Jon Schuff.

Fixes: #4680
Closes: #4681
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4681
Pull-request-sha: bc81c935ec0e352734d9ad1b322caf6d08079c3d

Change-Id: Ifc7ffc4c933b08a34fad537dc48e05d2cfa66d42
(cherry picked from commit 02c18e753b26aa038ce47d0b46b8f0281093d88b)

6 years agoMerge "Resolve RST306 issues" into rel_1_3
mike bayer [Tue, 14 May 2019 14:49:58 +0000 (14:49 +0000)] 
Merge "Resolve RST306 issues" into rel_1_3

6 years agoContinue to assume None for un-accessed attribute on persistent
Mike Bayer [Mon, 13 May 2019 18:56:12 +0000 (14:56 -0400)] 
Continue to assume None for un-accessed attribute on persistent
object during m2o fetch

Fixed regression in new relationship m2o comparison logic first introduced
at :ref:`change_4359` when comparing to an attribute that is persisted as
NULL and is in an un-fetched state in the mapped instance.  Since the
attribute has no explicit default, it needs to default to NULL when
accessed in a persistent setting.

Fixes: #4676
Change-Id: I17160c30131187c735f025a785ff0276a246f6bb
(cherry picked from commit b6619f267ba6a327d6bff1aa650dd3ab9b718b29)

6 years agoResolve RST306 issues
Mike Bayer [Mon, 13 May 2019 15:52:17 +0000 (11:52 -0400)] 
Resolve RST306 issues

The latest flake8 seems to look for these and they are in fact
correctable with a backslash.  Also need to add r to the strings
to avoid W605.

Change-Id: I8045309aa2ad29978ba7e99c45f75bc1457dff3d
(cherry picked from commit 663ed1a0772f6c6d53b1f4f9a2f652d0e5ce0b8a)

6 years agoFixes typo in core/connections.rst
Michael J Ward [Tue, 23 Apr 2019 20:44:06 +0000 (15:44 -0500)] 
Fixes typo in core/connections.rst

The generated sql was using the incorrect `user_schema` instead
of the correct `user_schema_one` translated table name.

(cherry picked from commit 9bba68a5a70d9e58bbc7490f7313c3b9dc2bb9ba)

6 years agoAdd autoincrement to test_orm AnnotatedOverheadTest for Oracle
Mike Bayer [Sat, 11 May 2019 15:40:56 +0000 (11:40 -0400)] 
Add autoincrement to test_orm AnnotatedOverheadTest for Oracle

Fixes: #4675
Change-Id: I593c3a891462818e7095a30bf6cd7795ca143ad1
(cherry picked from commit b26642e2364836fe9a8ee25c1cf4551901ce0c37)

6 years agoCorrect fix and tests for #4661
Mike Bayer [Sat, 11 May 2019 02:36:40 +0000 (22:36 -0400)] 
Correct fix and tests for #4661

For #4661 we need to still warn if we are only deleting one row,
even if sane multi rowcount is false.   Tests were failing for
pyodbc since the warning was removed for the single-row case.
the UPDATE logic raises if a single row doesn't match even
if sane multi rowcount is false, so this is now more consistent
with that.  Add tests for the UPDATE case also.  It is possible
there are already tests for this but as the DELETE case wasn't
well covered it's not clear.

Fixes: #4661
Change-Id: Ie57f765ff31bf806206837c5fbfe449b02ebf4be
(cherry picked from commit bdafff8982d9e7fbf9a39182f1fb8e65d475bbb9)

6 years agoMove initialize do_rollback() outside of the dialect
Matthew Wilkes [Thu, 9 May 2019 22:04:35 +0000 (18:04 -0400)] 
Move initialize do_rollback() outside of the dialect

Moved the "rollback" which occurs during dialect initialization so that it
occurs after additional dialect-specific initialize steps, in particular
those of the psycopg2 dialect which would inadvertently leave transactional
state on the first new connection, which could interfere with some
psycopg2-specific APIs which require that no transaction is started.  Pull
request courtesy Matthew Wilkes.

Fixes: #4663
Closes: #4664
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4664
Pull-request-sha: e544fe671d443ed06b210ba1cd1d7ba9c5653831

Change-Id: If40a15a1679b4eec0b8b8222f678697728009c30
(cherry picked from commit f601791a914d3181252493800871c458ad6c46d1)

6 years ago- fix long line
Mike Bayer [Fri, 10 May 2019 00:32:04 +0000 (20:32 -0400)] 
- fix long line

Change-Id: If44d364ae02da447169a3dc51b6514225578cf82
(cherry picked from commit 3abced7bd2842d41e17f438a65efc15aa71d4bb4)

6 years ago- remove references to nose
Mike Bayer [Thu, 9 May 2019 15:57:12 +0000 (11:57 -0400)] 
- remove references to nose

Change-Id: I970cc257dfb1c69413fa1c5593ba523ffc5070d4
(cherry picked from commit 1a3792c3b3af9b945862686b6d54a855342a5331)

6 years agoAdd documentation for MySQL optimizer hints using prefix_with
Mike Bayer [Wed, 8 May 2019 15:40:12 +0000 (11:40 -0400)] 
Add documentation for MySQL optimizer hints using prefix_with

Fixes: #4667
Change-Id: Iac3345319dc7c5a20bc7a6520492d2f341b64807
(cherry picked from commit c608c3f2f8af0e4cd9e2ffbd3b6f7f487e785282)

6 years agoMerge "Don't warn on multi delete rowcount if supports_sane_multi is False" into...
mike bayer [Tue, 7 May 2019 13:59:27 +0000 (13:59 +0000)] 
Merge "Don't warn on multi delete rowcount if supports_sane_multi is False" into rel_1_3

6 years agoMerge "Do not register the GenericFunction in sql.functions._registry" into rel_1_3
mike bayer [Tue, 7 May 2019 13:58:31 +0000 (13:58 +0000)] 
Merge "Do not register the GenericFunction in sql.functions._registry" into rel_1_3

6 years agoAdd support for filtered indexes for mssql dialect
mollardthomas [Fri, 3 May 2019 15:31:57 +0000 (11:31 -0400)] 
Add support for filtered indexes for mssql dialect

Added support for SQL Server filtered indexes, via the ``mssql_where``
parameter which works similarly to that of the ``postgresql_where`` index
function in the PostgreSQL dialect.

Fixes: #4657
Closes: #4658
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4658
Pull-request-sha: cf609c19bccc74c0dba38d2fc4976df3a205f3f6

Change-Id: I9c61b97d0b0cb6f6d417da7b1875b40f8f918a3c
(cherry picked from commit 174f2ae33b5235d709b17f3371946a173defaa0d)

6 years agoDo not register the GenericFunction in sql.functions._registry
Adrien Berchet [Fri, 3 May 2019 16:02:17 +0000 (12:02 -0400)] 
Do not register the GenericFunction in sql.functions._registry

Fixed that the :class:`.GenericFunction` class was inadvertently
registering itself as one of the named functions.  Pull request courtesy
Adrien Berchet.

Fixes: #4653
Closes: #4654
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4654
Pull-request-sha: 1112b89f0d5af8cd5ba88cef744698a79dbdb963

Change-Id: Ia0d366d3bff44a763aa496287814278dff732a19
(cherry picked from commit 61c47cbdc6058c040b301caa0864710a8d85d3a4)

6 years agoDon't warn on multi delete rowcount if supports_sane_multi is False
Mike Bayer [Fri, 3 May 2019 22:07:06 +0000 (18:07 -0400)] 
Don't warn on multi delete rowcount if supports_sane_multi is False

Fixed an issue where the "number of rows matched" warning would emit even if
the dialect reported "supports_sane_multi_rowcount=False", as is the case
for psycogp2 with ``use_batch_mode=True`` and others.

Fixes: #4661
Change-Id: I93aaf7f597b6083e860ab3cbcd620ba5621c57a8
(cherry picked from commit aa94afcdaf4faeacf13836de2475954e06a7fb67)

6 years agoOpen up mysql CHECK constraint detection to include new versions
Mike Bayer [Sat, 4 May 2019 17:19:10 +0000 (13:19 -0400)] 
Open up mysql CHECK constraint detection to include new versions

MySQL 8.0.16 introduces real CHECK constraints and MariaDB has also
added them into the 10.2 series sometime before 10.2.22.

Change-Id: Ia0f1be69f99df935aae069f63381bcc994f73cc7
(cherry picked from commit 1c3e92627362604472ca483055fc827a97942e6b)

6 years agoInclude GenericTypeCompiler in docs
Bjørnar Myrheim [Wed, 1 May 2019 07:39:26 +0000 (09:39 +0200)] 
Include GenericTypeCompiler in docs

Fixes: #4411
Change-Id: Ic60e78555651d05ff0492650bd7647685b867671
Closes: #4651
(cherry picked from commit cdd01a06f7cf5e9ce35544a02c182eca4015992c)

6 years agoAdd case insensitivity feature to GenericFunction.
Adrien Berchet [Mon, 15 Apr 2019 17:59:18 +0000 (13:59 -0400)] 
Add case insensitivity feature to GenericFunction.

The :class:`.GenericFunction` namespace is being migrated so that function
names are looked up in a case-insensitive manner, as SQL  functions do not
collide on case sensitive differences nor is this something which would
occur with user-defined functions or stored procedures.   Lookups for
functions declared with :class:`.GenericFunction` now use a case
insensitive scheme,  however a deprecation case is supported which allows
two or more :class:`.GenericFunction` objects with the same name of
different cases to exist, which will cause case sensitive lookups to occur
for that particular name, while emitting a warning at function registration
time.  Thanks to Adrien Berchet for a lot of work on this complicated
feature.

Fixes: #4569
Closes: #4570
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4570
Pull-request-sha: 37d4f3322b6bace88c99b959cb1916dbbc57610e

Change-Id: Ief07c6eb55bf398f6aad85b60ef13ee6d1173109
(cherry picked from commit ede0f2282fc44a6831abfcc562e1ae04661b5739)

6 years agoWarn on merge of already-pending object
Mike Bayer [Sun, 28 Apr 2019 16:40:31 +0000 (12:40 -0400)] 
Warn on merge of already-pending object

A warning is now emitted for the case where a transient object is being
merged into the session with :meth:`.Session.merge` when that object is
already transient in the :class:`.Session`.   This warns for the case where
the object would normally be double-inserted.

Fixes: #4647
Change-Id: Ie5223a59a2856664bf283017e962caf8c4230536
(cherry picked from commit 23a1c60982dc4799c76f0cec276a3bae8a24395b)

6 years ago- use correct rel_1_3 for gitreview branch
Mike Bayer [Sat, 27 Apr 2019 21:20:35 +0000 (17:20 -0400)] 
- use correct rel_1_3 for gitreview branch

Change-Id: Id649053727e62c9d18940e28abcc3df8ff2ea092

6 years agofix RST link format
Mike Bayer [Thu, 25 Apr 2019 22:26:57 +0000 (17:26 -0500)] 
fix RST link format

Change-Id: I52122759a92d2fa4bab93ac75c21a77f79eace5a

6 years agoremote_attr and local_attr refer to class bound attributes, not
Mike Bayer [Thu, 25 Apr 2019 22:23:12 +0000 (17:23 -0500)] 
remote_attr and local_attr refer to class bound attributes, not
MapperProperty

Change-Id: If5fee69474f295e8c4bef891f5360f6b54080bbf

6 years ago- formatting typo
Mike Bayer [Thu, 25 Apr 2019 22:16:43 +0000 (17:16 -0500)] 
- formatting typo

Change-Id: Ia34c2f9a6c3db83bbe0f0a06f82aa04c603cb521

6 years agoAdd ORM documentation for as_comparison()
Mike Bayer [Thu, 25 Apr 2019 15:46:31 +0000 (10:46 -0500)] 
Add ORM documentation for as_comparison()

In #3831 we added the ability for SQL functions to be used in
primaryjoin conditions as the source of comparison, however we
didn't add documentation from the main relationship docs so
nobody could find it unless they read the migration notes.
Since the two use cases that have come up for this are
materialized path with string functions, and geometry functions,
add the example based on the use case requested in
https://github.com/geoalchemy/geoalchemy2/issues/220#issuecomment-486709055

This example hasn't been tested yet and is subject to
revision.

Change-Id: I410d8ffade3f17cf616fc5056f27d7d32092207b

6 years agoMerge "negate True/False separately from other elements"
mike bayer [Tue, 23 Apr 2019 22:37:19 +0000 (22:37 +0000)] 
Merge "negate True/False separately from other elements"

6 years agoRemove sqla_nose.py from MANIFEST.in
Mike Bayer [Tue, 23 Apr 2019 19:47:40 +0000 (14:47 -0500)] 
Remove sqla_nose.py from MANIFEST.in

Removed errant "sqla_nose.py" symbol from MANIFEST.in which created an
undesirable warning message.

Fixes: #4625
Change-Id: I3784e82847d2ebfdd967dd9e2ab628d0ae5f415f

6 years ago- black -l79 update
Mike Bayer [Sun, 21 Apr 2019 01:23:55 +0000 (21:23 -0400)] 
- black -l79 update

Change-Id: I8e6211af91a322b3c212f16e77a0c0f6e9a5e019

6 years agonegate True/False separately from other elements
Mike Bayer [Thu, 18 Apr 2019 13:40:03 +0000 (09:40 -0400)] 
negate True/False separately from other elements

Fixed issue where double negation of a boolean column wouldn't reset
the "NOT" operator.

Fixes: #4618
Change-Id: Ica280a0d6b5b0870aa2d05c4d059a1e559e6b12a
(cherry picked from commit 18f25f50353d9736e6638266585b2cb3ef7b0ea4)

6 years agoUse "parent object" instead of "primary object" 4619/head
vpsx [Wed, 17 Apr 2019 23:48:40 +0000 (18:48 -0500)] 
Use "parent object" instead of "primary object"

6 years agocherry-pick changelog update for 1.2.20
Mike Bayer [Mon, 15 Apr 2019 16:29:31 +0000 (12:29 -0400)] 
cherry-pick changelog update for 1.2.20

6 years ago- 1.2.19
Mike Bayer [Mon, 15 Apr 2019 16:23:29 +0000 (12:23 -0400)] 
- 1.2.19

(cherry picked from commit f178bac2fdfa819c27d6b163e51582f6e75f0029)

6 years agoVersion 1.3.4 placeholder
Mike Bayer [Mon, 15 Apr 2019 16:08:01 +0000 (12:08 -0400)] 
Version 1.3.4 placeholder

6 years ago- 1.3.3 rel_1_3_3
Mike Bayer [Mon, 15 Apr 2019 15:46:47 +0000 (11:46 -0400)] 
- 1.3.3

6 years agoAdd 1.3.x versions to still unreleased 1.2 backport fixes
Mike Bayer [Mon, 15 Apr 2019 15:44:14 +0000 (11:44 -0400)] 
Add 1.3.x versions to still unreleased 1.2 backport fixes

Change-Id: Iee2a447c032575ff845eb4ba9d01de0be98065a2

6 years agoUse pytest items in custom collection
Mike Bayer [Sat, 13 Apr 2019 03:44:42 +0000 (23:44 -0400)] 
Use pytest items in custom collection

We have a custom test collection hook that did not take
node of the actual list of functions in items.  By looking
in this list we now support the class/function arguments
passed to the py.test command line.

Change-Id: I1238c7c5796a296037ab9ef3bedf0f619a730481

6 years agoBlack updates
Mike Bayer [Thu, 11 Apr 2019 18:23:29 +0000 (14:23 -0400)] 
Black updates

Updating for a few black adjustments

Change-Id: I9c8abadd1ccd6173e6d68dd62f14cec208cc304a

6 years agoMerge "Don't use and_() inside of Query.filter_by"
mike bayer [Thu, 11 Apr 2019 01:00:19 +0000 (01:00 +0000)] 
Merge "Don't use and_() inside of Query.filter_by"

6 years agoDon't use and_() inside of Query.filter_by
Mike Bayer [Wed, 10 Apr 2019 15:51:27 +0000 (11:51 -0400)] 
Don't use and_() inside of Query.filter_by

Adjusted the :meth:`.Query.filter_by` method to not call :func:`.and()`
internally against multiple criteria, instead passing it off to
:meth:`.Query.filter` as a series of criteria, instead of a single criteria.
This allows :meth:`.Query.filter_by` to defer to :meth:`.Query.filter`'s
treatment of variable numbers of clauses, including the case where the list
is empty.  In this case, the :class:`.Query` object will not have a
``.whereclause``, which allows subsequent "no whereclause" methods like
:meth:`.Query.select_from` to behave consistently.

Fixes: #4606
Change-Id: Ifc8cdbf13accca2236068ef70114a7c35ab159ff

6 years agoMerge "Add __reduce_ex__ to MutableList; add compat for older pickles"
mike bayer [Wed, 10 Apr 2019 01:14:57 +0000 (01:14 +0000)] 
Merge "Add __reduce_ex__ to MutableList; add compat for older pickles"

6 years agoAdd __reduce_ex__ to MutableList; add compat for older pickles
Mike Bayer [Tue, 9 Apr 2019 21:38:53 +0000 (17:38 -0400)] 
Add __reduce_ex__ to MutableList; add compat for older pickles

Fixed bug where using ``copy.copy()`` or ``copy.deepcopy()`` on
:class:`.MutableList` would cause the items within the list to be
duplicated, due to an inconsistency in how Python pickle and copy both make
use of ``__getstate__()`` and ``__setstate__()`` regarding lists.  In order
to resolve, a ``__reduce_ex__`` method had to be added to
:class:`.MutableList`.  In order to maintain backwards compatibility with
existing pickles based on ``__getstate__()``, the ``__setstate__()`` method
remains as well; the test suite asserts that pickles made against the old
version of the class can still be deserialized by the pickle module.

Also modified sqlalchemy.testing.util.picklers to return picklers all the way through
pickle.HIGHEST_PROTOCOL.

Fixes: #4603
Change-Id: I7f78b9cfb89d59a706248536c553dc5e1d987b88

6 years agoPropagate query-arg-only URL to psycopg2; don't send blank host
Mike Bayer [Tue, 9 Apr 2019 13:16:16 +0000 (09:16 -0400)] 
Propagate query-arg-only URL to psycopg2; don't send blank host

Fixed regression from release 1.3.2 caused by :ticket:`4562` where a URL
that contained only a query string and no hostname, such as for the
purposes of specifying a service file with connection information, would no
longer be propagated to psycopg2 properly.   The change in :ticket:`4562`
has been adjusted to further suit psycopg2's exact requirements, which is
that if there are any connection parameters whatsoever, the "dsn" parameter
is no longer required, so in this case the query string parameters are
passed alone.

Fixes: #4601
Change-Id: Ic29a8b77bcf50ee996968bab25aaac7ae4bfc26f

6 years agoUpdate link for cx_Oracle
Mike Bayer [Fri, 5 Apr 2019 14:20:08 +0000 (10:20 -0400)] 
Update link for cx_Oracle

Fixes: #4596
Change-Id: I80205d51fe500520030f2c94c06363e1fb6f9c65

6 years agoImprove documentation for connection pool logging
jaskiratsingh [Fri, 5 Apr 2019 13:51:12 +0000 (09:51 -0400)] 
Improve documentation for connection pool logging

Also do a general pass for logging + doc formatting,
add more cross-linking and remove obsolete information such
as "echo_uow"/

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #4571
Closes: #4583
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4583
Pull-request-sha: e98ad34eca7e9f59fb07cd8b7ec317c1cb989848

Change-Id: I03f7354a4ef55fd8b6a51d03a280579f36e8a06c

6 years agoEnhance documentation for string compilation use cases
Mike Bayer [Fri, 5 Apr 2019 01:43:12 +0000 (21:43 -0400)] 
Enhance documentation for string compilation use cases

- Add a web link for UnsupportedCompilationError
- Add new section to errors.rst
- add more detail and cross-linking to the FAQ
- include security caveats for parameter rendering

Fixes: #4595
Change-Id: I31ea57c18d65770cd2a51276bbe2847a9eb72bba

6 years agoMSSQL: only compile ORDER BY if it will be rendered
Matt Lewellyn [Wed, 3 Apr 2019 22:39:15 +0000 (18:39 -0400)] 
MSSQL: only compile ORDER BY if it will be rendered

Fixed issue in SQL Server dialect where if a bound parameter were present in
an ORDER BY expression that would ultimately not be rendered in the SQL
Server version of the statement, the parameters would still be part of the
execution parameters, leading to DBAPI-level errors.  Pull request courtesy
Matt Lewellyn.

Fixes: #4587
Closes: #4588
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4588
Pull-request-sha: 2992a473e0f6d4fc27794cfd949ba20a81fad2ca

Change-Id: Ie709aefdb1babf810bb81526289448f8cc7a4cb1

6 years agoMerge "Restore use_threadlocal equivalent behavior to SingletonThreadPool"
mike bayer [Wed, 3 Apr 2019 21:15:07 +0000 (21:15 +0000)] 
Merge "Restore use_threadlocal equivalent behavior to SingletonThreadPool"

6 years agoMerge "Fold entities into existing joins when resolving FROM ambiguity"
mike bayer [Wed, 3 Apr 2019 14:37:09 +0000 (14:37 +0000)] 
Merge "Fold entities into existing joins when resolving FROM ambiguity"

6 years agoRestore use_threadlocal equivalent behavior to SingletonThreadPool
Mike Bayer [Wed, 3 Apr 2019 14:03:17 +0000 (10:03 -0400)] 
Restore use_threadlocal equivalent behavior to SingletonThreadPool

Fixed behavioral regression as a result of deprecating the "use_threadlocal"
flag for :class:`.Pool`, where the :class:`.SingletonThreadPool` no longer
makes use of this option which causes the "rollback on return" logic to take
place when the same :class:`.Engine` is used multiple times in the context
of a transaction to connect or implicitly execute, thereby cancelling the
transaction.   While this is not the recommended way to work with engines
and connections, it is nonetheless a confusing behavioral change as when
using :class:`.SingletonThreadPool`, the transaction should stay open
regardless of what else is done with the same engine in the same thread.
The ``use_threadlocal`` flag remains deprecated however the
:class:`.SingletonThreadPool` now implements its own version of the same
logic.

Fixes: #4585
Change-Id: I906293f2d0a5d14ed46cd9e64305a6481505a5a3

6 years agoFold entities into existing joins when resolving FROM ambiguity
Mike Bayer [Wed, 3 Apr 2019 02:12:09 +0000 (22:12 -0400)] 
Fold entities into existing joins when resolving FROM ambiguity

Fixed 1.3 regression in new "ambiguous FROMs" query logic introduced in
:ref:`change_4365` where a :class:`.Query` that explicitly places an entity
in the FROM clause with :meth:`.Query.select_from` and also joins to it
using :meth:`.Query.join` would later cause an "ambiguous FROM" error if
that entity were used in additional joins, as the entity appears twice in
the "from" list of the :class:`.Query`.  The fix resolves this ambiguity by
folding the standalone entity into the join that it's already a part of in
the same way that ultimately happens when the SELECT statement is rendered.

Fixes: #4584
Change-Id: Ic62ca09c6d329695b21ed4f1be8621edcbb18e19

6 years agoVersion 1.3.3 placeholder
Mike Bayer [Tue, 2 Apr 2019 17:31:54 +0000 (13:31 -0400)] 
Version 1.3.3 placeholder

6 years ago- 1.3.2 rel_1_3_2
Mike Bayer [Tue, 2 Apr 2019 17:11:51 +0000 (13:11 -0400)] 
- 1.3.2

6 years agoRemove "subclass existing types" use case
Mike Bayer [Fri, 29 Mar 2019 13:42:43 +0000 (09:42 -0400)] 
Remove "subclass existing types" use case

Thanks to :ref:`change_3981`, we no longer need to rely on recipes that
subclass dialect-specific types directly, :class:`.TypeDecorator` can now
handle all cases.   Additionally, the above change made it slightly less
likely that a direct subclass of a base SQLAlchemy type would work as
expected, which could be misleading.  Documentation has been updated to use
:class:`.TypeDecorator` for these examples including the PostgreSQL
"ArrayOfEnum" example datatype and direct support for the "subclass a type
directly" has been removed.

Fixes: #4580
Change-Id: I866f246cccc736ea618dc965ab3604762f7a52fe

6 years agoMerge "Refine ambiguous access for unknown attribute types"
mike bayer [Wed, 27 Mar 2019 17:38:02 +0000 (17:38 +0000)] 
Merge "Refine ambiguous access for unknown attribute types"

6 years agoMerge "Test double colons without escaping in text()"
mike bayer [Tue, 26 Mar 2019 19:34:23 +0000 (19:34 +0000)] 
Merge "Test double colons without escaping in text()"

6 years agoRefine ambiguous access for unknown attribute types
Mike Bayer [Tue, 26 Mar 2019 16:58:42 +0000 (12:58 -0400)] 
Refine ambiguous access for unknown attribute types

Restored instance-level support for plain Python descriptors, e.g.
``@property`` objects, in conjunction with association proxies, in that if
the proxied object is not within ORM scope at all, it gets classified as
"ambiguous" but is proxed directly.  For class level access, a basic class
level``__get__()`` now returns the
:class:`.AmbiguousAssociationProxyInstance` directly, rather than raising
its exception, which is the closest approximation to the previous behavior
that returned the :class:`.AssociationProxy` itself that's possible.  Also
improved the stringification of these objects to be more descriptive of
current state.

Fixes: #4574
Change-Id: I787a22806b5530c146ae6ee66b588e5b191ae689

6 years agoTest double colons without escaping in text()
Mike Bayer [Tue, 26 Mar 2019 17:29:57 +0000 (13:29 -0400)] 
Test double colons without escaping in text()

Apparently the BIND_PARAMS regex passes over double colons,
it just doesn't accommodate for a bound parameter in that case.
add this use case to current tests as people can be relying upon it.

Change-Id: I6555621b1bb05d09b17428f4b4094ff7b219b460

6 years agoMerge "Fix boolean check in new path comparison logic"
mike bayer [Mon, 25 Mar 2019 19:09:58 +0000 (19:09 +0000)] 
Merge "Fix boolean check in new path comparison logic"

6 years agoFix boolean check in new path comparison logic
Mike Bayer [Sun, 24 Mar 2019 02:05:22 +0000 (22:05 -0400)] 
Fix boolean check in new path comparison logic

Fixed regression where a new error message that was supposed to raise when
attempting to link a relationship option to an AliasedClass without using
:meth:`.PropComparator.of_type` would instead raise an ``AttributeError``.
Note that in 1.3, it is no longer valid to create an option path from a
plain mapper relationship to an :class:`.AliasedClass` without using
:meth:`.PropComparator.of_type`.

Fixes: #4566
Change-Id: Ic547a1c8408e41aec66ef9644aac7f76f50dd064

6 years agoSupport DNS-less connections for psycopg2
Julian Mehnle [Thu, 21 Mar 2019 21:54:22 +0000 (17:54 -0400)] 
Support DNS-less connections for psycopg2

Added support for parameter-less connection URLs for the psycopg2 dialect,
meaning, the URL can be passed to :func:`.create_engine` as
``"postgresql+psycopg2://"`` with no additional arguments to indicate an
empty DSN passed to libpq, which indicates to connect to "localhost" with
no username, password, or database given. Pull request courtesy Julian
Mehnle.

Fixes: #4562
Closes: #4563
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4563
Pull-request-sha: 8a05c96944a0523b06e9772cfe1832e500a43641

Change-Id: Ib6fca3c3c9eebeaf590d7f7fb0bc8cd4b6e4a55a

6 years agoExpand joins when calculating PostgreSQL "WITH FOR UPDATE OF"
raylu [Wed, 20 Mar 2019 21:22:19 +0000 (17:22 -0400)] 
Expand joins when calculating PostgreSQL "WITH FOR UPDATE OF"

Modified the :paramref:`.Select.with_for_update.of` parameter so that if a
join or other composed selectable is passed, the individual :class:`.Table`
objects will be filtered from it, allowing one to pass a join() object to
the parameter, as occurs normally when using joined table inheritance with
the ORM.  Pull request courtesy Raymond Lu.

Fixes: #4550
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Closes: #4551
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4551
Pull-request-sha: 452da77d154a4087d530456db1c9af207d65cef4

Change-Id: If4b7c231f7b71190d7245543959fb5c3351125a1

6 years agoChanged urllib.quote_plus to urllib.parse.quote_plus (Python 3 versio…
ericdeansanchez [Mon, 18 Mar 2019 14:51:26 +0000 (10:51 -0400)] 
Changed urllib.quote_plus to urllib.parse.quote_plus (Python 3 versio…

Fixes: #4542
Closes: #4546
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4546
Pull-request-sha: 95d905cdcc33f44ff21d13e411e4a17843e6b54a

Change-Id: Ibaf0852822e281e79770763e7e3550270d26cf66

6 years agoClarify that declarative string resolution does not imply imports are implicit
Antony Gelberg [Sat, 16 Mar 2019 21:34:12 +0000 (17:34 -0400)] 
Clarify that declarative string resolution does not imply imports are implicit

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Closes: #4545
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4545
Pull-request-sha: c25221838d726f316dc04102b6b2002cec6b3a6c

Change-Id: Ic38621f7deb3cb25e250aab61c5b2b02d633b187

6 years agoMerge "Clone internals for Select._correlate_except collection as well as _correlate"
mike bayer [Mon, 11 Mar 2019 14:49:23 +0000 (14:49 +0000)] 
Merge "Clone internals for Select._correlate_except collection as well as _correlate"

6 years agoClone internals for Select._correlate_except collection as well as _correlate
Mike Bayer [Mon, 11 Mar 2019 03:34:33 +0000 (23:34 -0400)] 
Clone internals for Select._correlate_except collection as well as _correlate

Fixed bug where use of :func:`.with_polymorphic` or other aliased construct
would not properly adapt when the aliased target were used as the
:meth:`.Select.correlate_except` target of a subquery used inside of a
:func:`.column_property`.  This required a fix to the clause adaption
mechanics to properly handle a selectable that shows up in the "correlate
except" list, in a similar manner as which occurs for selectables that show
up in the "correlate" list.  This is ultimately a fairly fundamental bug
that has lasted for a long time but it is hard to come across it.

Fixes: #4537
Change-Id: Ibb97d4eea18b3c452aad519dd14919bfb84d422f

6 years agoVersion 1.3.2 placeholder
Mike Bayer [Sat, 9 Mar 2019 19:38:14 +0000 (14:38 -0500)] 
Version 1.3.2 placeholder

6 years ago- 1.3.1 rel_1_3_1
Mike Bayer [Sat, 9 Mar 2019 19:32:32 +0000 (14:32 -0500)] 
- 1.3.1

6 years agoCommit transaction after SNAPSHOT isolation change
Mike Bayer [Fri, 8 Mar 2019 23:36:33 +0000 (18:36 -0500)] 
Commit transaction after SNAPSHOT isolation change

A commit() is emitted after an isolation level change to SNAPSHOT, as both
pyodbc and pymssql open an implicit transaction which blocks subsequent SQL
from being emitted in the current transaction.

Fixes: #4536
Change-Id: If3ba70f495bce2a35a873a3a72d1b30406e678c8

6 years agoblack reformatting
Mike Bayer [Sat, 9 Mar 2019 04:45:02 +0000 (23:45 -0500)] 
black reformatting

Change-Id: Idc48f1c80867cd953f9d611719d1d5b5d244ae38

6 years agoRemove convert_unicode nodes and add version for deprecation
Mike Bayer [Fri, 8 Mar 2019 19:42:24 +0000 (14:42 -0500)] 
Remove convert_unicode nodes and add version for deprecation

Fixes: #4535
Change-Id: Ic5b1991ecef3b258573e1c59f5106a534f92a813

6 years agoUpdate the mysql-connector-python docs for now
Mike Bayer [Fri, 8 Mar 2019 14:54:58 +0000 (09:54 -0500)] 
Update the mysql-connector-python docs for now

mysql-connector-python still seems to have issues with binary datatypes
but the other issues here, with the possible exception of the deadlock
still being investigated, seem to have been resolved in the recent
8.x series of mysql-connector-python.   The driver is still not
recommended due to these issues however we don't need a special
class of warnings at this point.

Change-Id: I2d59e76df5e84b34e318a24b468626900c39da46
References: #4531

6 years agoAdd documentation section for cascade_scalar_deletes
Mike Bayer [Thu, 7 Mar 2019 14:54:45 +0000 (09:54 -0500)] 
Add documentation section for cascade_scalar_deletes

Change-Id: I56825652e0608862472bc594fc6c2b12ed5cc16f
References: #4534

6 years agoMerge "Ensure association proxy works over synonym"
mike bayer [Wed, 6 Mar 2019 16:38:49 +0000 (16:38 +0000)] 
Merge "Ensure association proxy works over synonym"

6 years agoMerge "Fix large_resultsets performance example field name"
mike bayer [Wed, 6 Mar 2019 16:11:36 +0000 (16:11 +0000)] 
Merge "Fix large_resultsets performance example field name"

6 years agoMerge "Ensure scale param not sent to float types"
mike bayer [Wed, 6 Mar 2019 15:47:01 +0000 (15:47 +0000)] 
Merge "Ensure scale param not sent to float types"

6 years agoFix large_resultsets performance example field name
Matt Schuchhardt [Wed, 6 Mar 2019 15:28:48 +0000 (10:28 -0500)] 
Fix large_resultsets performance example field name

Fixed bug in large_resultsets example case where a re-named "id" variable
due to code reformatting caused the test to fail.  Pull request courtesy
Matt Schuchhardt.

Fixes: #4528
Closes: #4529
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4529
Pull-request-sha: 8f52f10422114c397254db9e6f940d042708e0bd

Change-Id: Iaca6fd06ec0ede8ff1745d627708ba492a2114c8

6 years agoEnsure association proxy works over synonym
Mike Bayer [Tue, 5 Mar 2019 18:28:54 +0000 (13:28 -0500)] 
Ensure association proxy works over synonym

Fixed regression where an association proxy linked to a synonym would no
longer work, both at instance level and at class level.

Fixes: #4522
Change-Id: I949079229ef87c12736c362df35444f6e30c8038

6 years agoLoosen SingletonThreadPoolTest
Mike Bayer [Wed, 6 Mar 2019 13:18:26 +0000 (08:18 -0500)] 
Loosen SingletonThreadPoolTest

This test is non-critical as the SingletonThreadPool is
not production-level robust under multithreaded scenarios in
any case.

Fixes: #4527
Change-Id: Ie19ebd69438c97b2d8adb571f8f1b2c56894f7fb

6 years agoEnsure scale param not sent to float types
Mike Bayer [Wed, 6 Mar 2019 14:05:23 +0000 (09:05 -0500)] 
Ensure scale param not sent to float types

Fixed regression in SQL Server reflection due to :ticket:`4393` where the
removal of open-ended ``**kw`` from the :class:`.Float` datatype caused
reflection of this type to fail due to a "scale" argument being passed.

Fixes: #4525
Change-Id: Ief8bb535778055eff2ab0d71660f81e3676390a1

6 years agorun a black run
Mike Bayer [Wed, 6 Mar 2019 01:29:05 +0000 (20:29 -0500)] 
run a black run

fix some pep8s that snuck in

Change-Id: Ied282007df30a52d232b1ba88659f2a123ff380f

6 years agoFix pooling typo
Mike Bayer [Wed, 6 Mar 2019 00:42:41 +0000 (19:42 -0500)] 
Fix pooling typo

eng -> engine

Fixes: #4526
Change-Id: If117099b8521e15887ae916a5dbfcfa0b7cd594b

6 years agoMerge remote-tracking branch 'origin/pr/4520'
Mike Bayer [Tue, 5 Mar 2019 17:39:07 +0000 (12:39 -0500)] 
Merge remote-tracking branch 'origin/pr/4520'

Change-Id: I3ca8e33c361ea088323e83437d6817ba02737de7

6 years agoAdd a note that the truncation logic also raises an exception for
Mike Bayer [Tue, 5 Mar 2019 17:08:16 +0000 (12:08 -0500)] 
Add a note that the truncation logic also raises an exception for
too-long names.

Change-Id: I8291a56235171827f5c41361b74118ba9c28c4c5

6 years ago- repair param inject to work around code examples to some degree
Mike Bayer [Tue, 5 Mar 2019 16:34:03 +0000 (11:34 -0500)] 
- repair param inject to work around code examples to some degree
- link to correct text() construct for CheckConstraint

Change-Id: Ic46d1f79670a532f33bd9feb7f568dc3d1d6e38a

6 years agoVersion 1.3.1 placeholder
Mike Bayer [Mon, 4 Mar 2019 21:50:17 +0000 (16:50 -0500)] 
Version 1.3.1 placeholder

6 years agoAdd missing attribute in hybrid.py docs 4520/head
Daniel Demmel [Mon, 4 Mar 2019 18:10:22 +0000 (18:10 +0000)] 
Add missing attribute in hybrid.py docs

6 years ago- 1.3.0 rel_1_3_0
Mike Bayer [Mon, 4 Mar 2019 18:05:44 +0000 (13:05 -0500)] 
- 1.3.0

6 years agoMerge "Use basepython 3.7 for flake8 tests"
mike bayer [Mon, 4 Mar 2019 17:40:31 +0000 (17:40 +0000)] 
Merge "Use basepython 3.7 for flake8 tests"

6 years agoUse basepython 3.7 for flake8 tests
Mike Bayer [Mon, 4 Mar 2019 17:22:07 +0000 (12:22 -0500)] 
Use basepython 3.7 for flake8 tests

this to prevent flake8 from running with python 2 as we have
py3k-specific checks

Change-Id: I456c4b64c5bc04a81cd43de7dac1e803346f1245

6 years agoMerge "Add port comparison in __eq__() and __ne__() method to URL"
mike bayer [Mon, 4 Mar 2019 15:45:53 +0000 (15:45 +0000)] 
Merge "Add port comparison in __eq__() and __ne__() method to URL"

6 years agoAdd port comparison in __eq__() and __ne__() method to URL
Sanjana [Thu, 28 Feb 2019 15:16:13 +0000 (10:16 -0500)] 
Add port comparison in __eq__() and __ne__() method to URL

Comparing two objects of :class:`.URL` using ``__eq__()`` did not take port
number into consideration, two objects differing only by port number were
considered equal. Port comparison is now added in ``__eq__()`` method of
:class:`.URL`, objects differing by port number are now not equal.
Additionally, ``__ne__()`` was not implemented for :class:`.URL` which
caused unexpected result when ``!=`` was used in Python2, since there are no
implied relationships among the comparison operators in Python2.

Fixes: #4406
Closes: #4515
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4515
Pull-request-sha: 0f15b805f07e7fca1f82ca6c3aad98d50ea705b8

Change-Id: Iba7d224f1282dc3f4b884d1a746f2d46669f551e

6 years agoAdd resolve_fks=False option for reflection
Mike Bayer [Thu, 28 Feb 2019 15:59:41 +0000 (10:59 -0500)] 
Add resolve_fks=False option for reflection

Added new parameters :paramref:`.Table.resolve_fks` and
:paramref:`.MetaData.reflect.resolve_fks` which when set to False will
disable the automatic reflection of related tables encountered in
:class:`.ForeignKey` objects, which can both reduce SQL overhead for omitted
tables as well as avoid tables that can't be reflected for database-specific
reasons.  Two :class:`.Table` objects present in the same :class:`.MetaData`
collection can still refer to each other even if the reflection of the two
tables occurred separately.

Fixes: #4517
Change-Id: I623baed42042a16c5109e4c8af6b2f64d2d00f95

6 years agolink to PyHive as a dialect 4516/head
Aidan Feldman [Wed, 27 Feb 2019 21:01:04 +0000 (16:01 -0500)] 
link to PyHive as a dialect

6 years agoIgnore Pipenv* and .idea 4514/head
Ville Brofeldt [Sat, 23 Feb 2019 16:02:42 +0000 (18:02 +0200)] 
Ignore Pipenv* and .idea

6 years agoMerge "Add test to as_interface when no cls or methods"
mike bayer [Fri, 22 Feb 2019 00:33:55 +0000 (00:33 +0000)] 
Merge "Add test to as_interface when no cls or methods"

6 years agoMerge "Prevent __init__ from being called for Alias, subclasses"
mike bayer [Fri, 22 Feb 2019 00:33:31 +0000 (00:33 +0000)] 
Merge "Prevent __init__ from being called for Alias, subclasses"

6 years agoAdd test to as_interface when no cls or methods
Toni Karppi [Thu, 21 Feb 2019 19:22:48 +0000 (14:22 -0500)] 
Add test to as_interface when no cls or methods

Fixes #4511

### Description
The `as_interface` function requires that an argument be provided for at least one of the parameters `cls` or `methods`. There was no test that tested the case when neither of these arguments were provided.

### 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: #4512
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4512
Pull-request-sha: 156f6af95ede730d2e1a9d2c935c830cf3cfc96e

Change-Id: Ifa23dbe1dbe9a824fe680e4947b81c96a50c133f