]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
5 years agoMerge "Clean up (engine|db).execute for sqlite"
mike bayer [Tue, 31 Mar 2020 16:30:41 +0000 (16:30 +0000)] 
Merge "Clean up (engine|db).execute for sqlite"

5 years agoMerge "Clean up (engine|db).execute for mysql"
mike bayer [Tue, 31 Mar 2020 16:29:00 +0000 (16:29 +0000)] 
Merge "Clean up (engine|db).execute for mysql"

5 years agoMerge "Clean up .execute calls in PostgreSQL tests"
mike bayer [Tue, 31 Mar 2020 16:28:23 +0000 (16:28 +0000)] 
Merge "Clean up .execute calls in PostgreSQL tests"

5 years agoClean up .execute calls in PostgreSQL tests
Gord Thompson [Sat, 28 Mar 2020 23:34:05 +0000 (17:34 -0600)] 
Clean up .execute calls in PostgreSQL tests

Fixes: #5220
Change-Id: I789e45dffc2b177ebb15ea3268bb965be8b06397

5 years agoClean up (engine|db).execute for sqlite
Gord Thompson [Tue, 31 Mar 2020 13:19:13 +0000 (07:19 -0600)] 
Clean up (engine|db).execute for sqlite

Change-Id: Ie43e5b3a34ecc64ab77410e42f3e8de8bbc1e2d8

5 years agoClean up (engine|db).execute for mysql
Gord Thompson [Tue, 31 Mar 2020 12:33:55 +0000 (06:33 -0600)] 
Clean up (engine|db).execute for mysql

Change-Id: Ibc3509630a7c418b500ec7c6587f311326b75c93

5 years agoFix one more db.execute in mssql test
Gord Thompson [Tue, 31 Mar 2020 12:04:59 +0000 (06:04 -0600)] 
Fix one more db.execute in mssql test

Change-Id: Ia34da0d3bbaaa3e98a5318191a38a5c3354061c9

5 years agoFix sqlite memory req
Mike Bayer [Mon, 30 Mar 2020 19:04:53 +0000 (15:04 -0400)] 
Fix sqlite memory req

this is only used by test/requirements.py right now for the
profiling tests but it was not returning the correct answer
during a regenerate operation.

Change-Id: Id9747b4fe562b8bea9b21c465b626b1b19e6956b

5 years agoupdates to 2.0 migration notes
Mike Bayer [Mon, 30 Mar 2020 18:06:28 +0000 (14:06 -0400)] 
updates to 2.0 migration notes

- make sure when we refer to 2.0 code we use the future.select()
pattern, not session.query()

- add more imports to examples

- note code examples that are "new" vs. "old"

Change-Id: I001e180231783cc77192013bf0a1501c7540e90f

5 years agoRemove ORDER BY pk from subqueryload, selectinload
Mike Bayer [Mon, 30 Mar 2020 15:04:24 +0000 (11:04 -0400)] 
Remove ORDER BY pk from subqueryload, selectinload

Modified the queries used by subqueryload and selectinload to no longer
ORDER BY the primary key of the parent entity;  this ordering was there to
allow the rows as they come in to be copied into lists directly with a
minimal level of Python-side collation.   However, these ORDER BY clauses
can negatively impact the performance of the query as in many scenarios
these columns are derived from a subquery or are otherwise not actual
primary key columns such that SQL planners cannot make use of indexes. The
Python-side collation uses the native itertools.group_by() to collate the
incoming rows, and has been modified to allow multiple
row-groups-per-parent to be assembled together using list.extend(), which
should still allow for relatively fast Python-side performance.  There will
still be an ORDER BY present for a relationship that includes an explicit
order_by parameter, however this is the only ORDER BY that will be added to
the query for both kinds of loading.

Fixes: #5162
Change-Id: I8befd1303c1af7cc24cbf005f39bc01c8b2745f3

5 years agoMerge "String compiler can now literal compile datetime objects"
mike bayer [Mon, 30 Mar 2020 13:57:08 +0000 (13:57 +0000)] 
Merge "String compiler can now literal compile datetime objects"

5 years agoMerge "Add a third labeling mode for SELECT statements"
mike bayer [Mon, 30 Mar 2020 13:06:04 +0000 (13:06 +0000)] 
Merge "Add a third labeling mode for SELECT statements"

5 years agoAdd a third labeling mode for SELECT statements
Mike Bayer [Sun, 29 Mar 2020 18:24:39 +0000 (14:24 -0400)] 
Add a third labeling mode for SELECT statements

Enhanced the disambiguating labels feature of the
:func:`~.sql.expression.select` construct such that when a select statement
is used in a subquery, repeated column names from different tables are now
automatically labeled with a unique label name, without the need to use the
full "apply_labels()" feature that conbines tablename plus column name.
The disambigated labels are available as plain string keys in the .c
collection of the subquery, and most importantly the feature allows an ORM
:func:`.orm.aliased` construct against the combination of an entity and an
arbitrary subquery to work correctly, targeting the correct columns despite
same-named columns in the source tables, without the need for an "apply
labels" warning.

The existing labeling style is now called
LABEL_STYLE_TABLENAME_PLUS_COL.  This labeling style will remain used
throughout the ORM as has been the case for over a decade, however,
the new disambiguation scheme could theoretically replace this scheme
entirely.  The new scheme would dramatically alter how SQL looks
when rendered from the ORM to be more succinct but arguably harder
to read.

The tablename_columnname scheme used by Join.c is unaffected here,
as that's still hardcoded to that scheme.

Fixes: #5221
Change-Id: Ib47d9e0f35046b3afc77bef6e65709b93d0c3026

5 years agoMerge "Remove support for python 3.4"
mike bayer [Mon, 30 Mar 2020 01:47:50 +0000 (01:47 +0000)] 
Merge "Remove support for python 3.4"

5 years agoRemove support for python 3.4
Federico Caselli [Sun, 29 Mar 2020 18:57:08 +0000 (20:57 +0200)] 
Remove support for python 3.4

Also remove no longer used compat code

Change-Id: Ifda239fd84b425e43f4028cb55a5b3b8efa4dfc6

5 years agoString compiler can now literal compile datetime objects
Federico Caselli [Tue, 24 Mar 2020 21:55:46 +0000 (22:55 +0100)] 
String compiler can now literal compile datetime objects

Add ability to literal compile a :class:`DateTime`, :class:`Date`
or :class:"Time" when using the string dialect for debugging purposes.
This change does not impact real dialect implementation that retain
their current behavior.

Fixes: #5052
Change-Id: Ia3fad2be905c6d35b0106b9a2388c7508f067e90

5 years agoMerge "Repair queries from #5134 to ORDER BY outside the subquery"
mike bayer [Sun, 29 Mar 2020 18:41:55 +0000 (18:41 +0000)] 
Merge "Repair queries from #5134 to ORDER BY outside the subquery"

5 years agoRepair queries from #5134 to ORDER BY outside the subquery
Mike Bayer [Sun, 29 Mar 2020 16:06:29 +0000 (12:06 -0400)] 
Repair queries from #5134 to ORDER BY outside the subquery

ORDER BY has to be on the outermost query to guarantee ordering
as these tests were failing for SQL Server.   Also add
new tests that don't use from_self() as this is also going to
be removed in 2.0.

Also propose some from_self() alternatives.  References #5221

Change-Id: Ia2a669f45fcaada607e73d9225849fd74d25f6e5

5 years agoFix typo in resultproxy.c and test compatibility with python 3.5
Federico Caselli [Sat, 28 Mar 2020 10:04:44 +0000 (11:04 +0100)] 
Fix typo in resultproxy.c and test compatibility with python 3.5

- Fix typo in resultproxy.c that would error on windows.
- add -Wundef to C flags when linux is detected so that undefined
symbols emit a warning
- a few adjustments for tests to succeed on python 3.5
- note minimum version still documented here as 3.4 but this should
move to at least 3.5 if not 3.6 for SQLAlchemy 1.4

Change-Id: Ia93ee1cb5c52e51e72eb0a24c100421c5157d04b

5 years agointroduce "autobegin" concept for Connection
Mike Bayer [Thu, 26 Mar 2020 21:26:57 +0000 (17:26 -0400)] 
introduce "autobegin" concept for Connection

because engine.connect() and engine.begin() should feature
identical internal behavior, with the sole exception that
one rolls back and the end and the other commits at the end,
while also supporting execution options like transaction isolation level
at the connection level, include that engine.connect() will
return a connection that uses autobegin in the same way as the
session will.   This is solely to support the "begin" event
noting that a transaction is begun which is tracked on the
connection.    Behavior and design should be very similar to that
of the ORM session and "Transaction" should no longer be a very
explicit object.

Change-Id: I9c317d242ca7a435de0f17b1618355e29a10d1bc

5 years agotypo: missing comma 5215/head
michitaro.koike [Thu, 26 Mar 2020 07:09:42 +0000 (16:09 +0900)] 
typo: missing comma

5 years agoFix typos in migration_20 documentation
Federico Caselli [Wed, 25 Mar 2020 19:47:25 +0000 (20:47 +0100)] 
Fix typos in migration_20 documentation

Change-Id: I9ea9fc5bffe8615de432e2bb113e0a14bdf05e54

5 years agoMerge "Correct ambiguous func / class links"
mike bayer [Wed, 25 Mar 2020 17:28:29 +0000 (17:28 +0000)] 
Merge "Correct ambiguous func / class links"

5 years agoMerge "Deprecate add of columns in order by with distinct"
mike bayer [Wed, 25 Mar 2020 15:37:26 +0000 (15:37 +0000)] 
Merge "Deprecate add of columns in order by with distinct"

5 years agoCorrect ambiguous func / class links
Mike Bayer [Wed, 25 Mar 2020 15:34:19 +0000 (11:34 -0400)] 
Correct ambiguous func / class links

:func:`.sql.expression.select`, :func:`.sql.expression.insert`
and :class:`.sql.expression.Insert` were hitting many ambiguous
symbol errors, due to future.select, as well as the PG/MySQL
variants of Insert.

Change-Id: Iac862bfc172a7f7f0cbba5353a83dc203bed376c

5 years agoDeprecate add of columns in order by with distinct
Federico Caselli [Sat, 15 Feb 2020 11:34:37 +0000 (12:34 +0100)] 
Deprecate add of columns in order by with distinct

Deprecate automatic addition of order by column in a query with a distinct

Fixes: #5134
Change-Id: I467a39379c496be7e84a05f11ba9f8ca2bcc6e32

5 years agoMerge "Implement autocommit isolation level for pysqlite"
mike bayer [Tue, 24 Mar 2020 21:11:26 +0000 (21:11 +0000)] 
Merge "Implement autocommit isolation level for pysqlite"

5 years agoMerge "Implement SQL VALUES in core."
mike bayer [Tue, 24 Mar 2020 19:55:44 +0000 (19:55 +0000)] 
Merge "Implement SQL VALUES in core."

5 years agoMerge "Convert schema_translate to a post compile"
mike bayer [Tue, 24 Mar 2020 19:53:14 +0000 (19:53 +0000)] 
Merge "Convert schema_translate to a post compile"

5 years agoMerge "Improve the method ``__str__`` of :class:`ColumnCollection`"
mike bayer [Tue, 24 Mar 2020 19:51:37 +0000 (19:51 +0000)] 
Merge "Improve the method ``__str__`` of :class:`ColumnCollection`"

5 years agoImprove the method ``__str__`` of :class:`ColumnCollection`
Federico Caselli [Mon, 23 Mar 2020 20:17:01 +0000 (21:17 +0100)] 
Improve the method ``__str__`` of :class:`ColumnCollection`

The change avoids confusing a :class:`ColumnCollection` with a python list since the
previous string representation was the same.

Fixes: #5191
Change-Id: Icdbc08f9991d31ce86372505e3614740eaee56e2

5 years agoAdd link to whats new in 2.0 doc
Mike Bayer [Tue, 24 Mar 2020 18:46:46 +0000 (14:46 -0400)] 
Add link to whats new in 2.0 doc

Change-Id: Iff54f3db8ccf47802f61837956afae0c5d441f68

5 years agoConvert schema_translate to a post compile
Mike Bayer [Mon, 23 Mar 2020 18:52:05 +0000 (14:52 -0400)] 
Convert schema_translate to a post compile

Revised the :paramref:`.Connection.execution_options.schema_translate_map`
feature such that the processing of the SQL statement to receive a specific
schema name occurs within the execution phase of the statement, rather than
at the compile phase.   This is to support the statement being efficiently
cached.   Previously, the current schema being rendered into the statement
for a particular run would be considered as part of the cache key itself,
meaning that for a run against hundreds of schemas, there would be hundreds
of cache keys, rendering the cache much less performant.  The new behavior
is that the rendering is done in a similar  manner as the "post compile"
rendering added in 1.4 as part of :ticket:`4645`, :ticket:`4808`.

Fixes: #5004
Change-Id: Ia5c89eb27cc8dc2c5b8e76d6c07c46290a7901b6

5 years agoImplement autocommit isolation level for pysqlite
Gord Thompson [Sat, 22 Feb 2020 13:44:05 +0000 (06:44 -0700)] 
Implement autocommit isolation level for pysqlite

Fixes: #5164
Change-Id: I190b9de552dfed9f2a33babf82e42465ef09c82a

5 years agoImplement SQL VALUES in core.
Gord Thompson [Fri, 20 Dec 2019 00:58:52 +0000 (19:58 -0500)] 
Implement SQL VALUES in core.

Added a core :class:`Values` object that enables a VALUES construct
to be used in the FROM clause of an SQL statement for databases that
support it (mainly PostgreSQL and SQL Server).

Fixes: #4868
Closes: #5030
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5030
Pull-request-sha: 84684038a8efa93b460318e0db53f6c644554588

Change-Id: Ib8109b63bc1a9dc04ab987c5322ca3375f7e824d

5 years agoReword changelog for issue #5207
Mike Bayer [Tue, 24 Mar 2020 16:51:53 +0000 (12:51 -0400)] 
Reword changelog for issue #5207

SQLAlchemy can remain using setuptools even when pep-517 is
the standard installation process.   We are omitting the file
for now because it leads to new pip installation issues that need
to be worked out in the greater pip community before SQLAlchemy
opts into this system.

Change-Id: I40b196100c6f16ae1291fcb7f8b5196bba14a300

5 years agoMerge "Remove deprecated elements from selectable.py; remove lockmode"
mike bayer [Mon, 23 Mar 2020 18:55:02 +0000 (18:55 +0000)] 
Merge "Remove deprecated elements from selectable.py; remove lockmode"

5 years agoRemove deprecated elements from selectable.py; remove lockmode
Mike Bayer [Sun, 2 Feb 2020 16:39:37 +0000 (11:39 -0500)] 
Remove deprecated elements from selectable.py; remove lockmode

Removed autocommit and legacy "for update" / "lockmode" elements
from selectable.py / query.py.  lockmode was removed from
selectable in 693938dd6fb2f3ee3e031aed4c62355ac97f3ceb
however was not removed from the ORM.

Also removes the ignore_nonexistent_tables option on
join().

Change-Id: I0cfcf9e6a8d4ef6432c9e25ef75173b3b3f5fd87
Partially-fixes: #4643

5 years agoImplement autocommit isolation level for cx_oracle
Gord Thompson [Thu, 12 Mar 2020 18:54:37 +0000 (12:54 -0600)] 
Implement autocommit isolation level for cx_oracle

As part of this change Oracle also gets the concept of a
default isolation level, however since Oracle does not provide a
fixed method of knowing what the isolation level would be without a
server side transaction actually in progress, for now we hardcode
just to "READ COMMITTED".

Enhanced the test suite for isolation level testing in the dialect
test suite and added features to requirements so that the supported
isolation levels can be reported generically for dialects.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #5200
Change-Id: I2c4d49da9ff80ccc228c21e196ec9a961de53478

5 years agoMerge "Test instance for matching class hierarchy on get_from_identity"
mike bayer [Sun, 22 Mar 2020 16:47:04 +0000 (16:47 +0000)] 
Merge "Test instance for matching class hierarchy on get_from_identity"

5 years agoTest instance for matching class hierarchy on get_from_identity
Mike Bayer [Sat, 21 Mar 2020 21:26:24 +0000 (17:26 -0400)] 
Test instance for matching class hierarchy on get_from_identity

Fixed issue where a lazyload that uses session-local "get" against a target
many-to-one relationship where an object with the correct primary key is
present, however it's an instance of a sibling class, does not correctly
return None as is the case when the lazy loader actually emits a load for
that row.

Fixes: #5210
Change-Id: I89f9946cfeba61d89a272435f76a5a082b1da30c

5 years agoMerge "Deprecate plain string in execute and introduce `exec_driver_sql`"
mike bayer [Sun, 22 Mar 2020 15:04:59 +0000 (15:04 +0000)] 
Merge "Deprecate plain string in execute and introduce `exec_driver_sql`"

5 years agoDeprecate plain string in execute and introduce `exec_driver_sql`
Federico Caselli [Sat, 14 Mar 2020 13:02:44 +0000 (14:02 +0100)] 
Deprecate plain string in execute and introduce `exec_driver_sql`

Execution of literal sql string is deprecated in the
:meth:`.Connection.execute` and a warning is raised when used stating
that it will be coerced to :func:`.text` in a future release.
To execute a raw sql string the new connection method
:meth:`.Connection.exec_driver_sql` was added, that will retain the previous
behavior, passing the string to the DBAPI driver unchanged.
Usage of scalar or tuple positional parameters in :meth:`.Connection.execute`
is also deprecated.

Fixes: #4848
Fixes: #5178
Change-Id: I2830181054327996d594f7f0d59c157d477c3aa9

5 years agoRemove pyproject.toml from distribution
Mike Bayer [Sat, 21 Mar 2020 14:16:47 +0000 (10:16 -0400)] 
Remove pyproject.toml from distribution

SQLAlchemy does not want to opt-in to pep-517 at this time
as this would require a custom build backend interface
which we have not built yet, and the standard is not
widely adopted at this time in any case.  Per
[1] [2], the presence of this file indicates a positive opt-in
to pep-517, so it must be omitted from source distributions.

[1] https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
[2] https://www.python.org/dev/peps/pep-0517/#id5

Fixes: #5207
Change-Id: If8d26a9edf942047920d273d8be778df7a018b3e

5 years agoClarify Alembic vs. Migrate
Mike Bayer [Fri, 20 Mar 2020 20:40:47 +0000 (16:40 -0400)] 
Clarify Alembic vs. Migrate

Migrate is fully legacy at this point so continue to mention
it to provide clarity, but ensure it isn't suggested
as a real alternative.  It's unclear if Migrate will be able
to support SQLAlchemy 2.0.

Change-Id: Ia81aaccbd18f197ab533b083e87cc4d04ea05839

5 years agoEmphasize context managers when working with Core
Mike Bayer [Fri, 20 Mar 2020 19:21:10 +0000 (15:21 -0400)] 
Emphasize context managers when working with Core

Prep the main documentation for the changes coming up in 1.4
by first removing references to engine.execute() outside
of the "connectionless" section, and using context managers
in all cases.  For features that have always been confusing
and are going away, add a note that this feature will
be going away.

Change-Id: I94583444734e36f5432c32cb37f88a9fad15634a

5 years agoCorrect misleading guidance on multiprocessing
Mike Bayer [Fri, 20 Mar 2020 15:17:47 +0000 (11:17 -0400)] 
Correct misleading guidance on multiprocessing

Link the connections intro to the dedicated section
on multiprocessing rather than stating that a separate
engine per process is needed, since this is inaccurate
and vague.

Change-Id: I48c66f88a90db918e864cd198c6aed335e28c7e6

5 years agoDon't include PG INCLUDE columns as regular index columns
mike bayer [Wed, 18 Mar 2020 23:05:20 +0000 (19:05 -0400)] 
Don't include PG INCLUDE columns as regular index columns

Fixed issue where a "covering" index, e.g. those which have an  INCLUDE
clause, would be reflected including all the columns in INCLUDE clause as
regular columns.  A warning is now emitted if these additional columns are
detected indicating that they are currently ignored.  Note that full
support for "covering" indexes is part of :ticket:`4458`.  Pull request
courtesy Marat Sharafutdinov.

Fixes: #5205
Closes: #5206
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5206
Pull-request-sha: 512a3817bb21991142add2d192fa7ce9b285369d

Change-Id: I3196a2bf77dc5a6abd85b2fbf0ebff1b30d4fb00

5 years agoMerge "updated doc string to show `NOT (EXISTS` instead of `NOT EXISTS`, as …"
mike bayer [Wed, 18 Mar 2020 17:01:25 +0000 (17:01 +0000)] 
Merge "updated doc string to show `NOT (EXISTS` instead of `NOT EXISTS`, as â€¦"

5 years agoMerge "import the module as passed before we look in sys.modules"
mike bayer [Tue, 17 Mar 2020 18:08:30 +0000 (18:08 +0000)] 
Merge "import the module as passed before we look in sys.modules"

5 years agoimport the module as passed before we look in sys.modules
Mike Bayer [Fri, 13 Mar 2020 22:37:25 +0000 (18:37 -0400)] 
import the module as passed before we look in sys.modules

in I2e291eba4297867fc0ddb5d875b9f7af34751d01, the importer
is importing tokens[0:-1] and then the final token as the name;
this doesn't always work for the two example modules of "xml.dom"
and "wsgiref.simple_server".  import the complete path we will
pull from sys.modules directly.

Change-Id: I833a770f4c3e7463fa56234d891870083e48cc73

5 years agoFix "special_key" attribute name in association proxy documentation
Mike Bayer [Tue, 17 Mar 2020 02:06:15 +0000 (22:06 -0400)] 
Fix "special_key" attribute name in association proxy documentation

Fixes: #5204
Change-Id: I1366be823d753bdcd92c98b948bdfa7960a27eb7

5 years agoSupport inspection of computed column
Federico Caselli [Sat, 14 Mar 2020 12:57:42 +0000 (13:57 +0100)] 
Support inspection of computed column

Added support for reflection of "computed" columns, which are now returned
as part of the structure returned by :meth:`.Inspector.get_columns`.
When reflecting full :class:`.Table` objects, computed columns will
be represented using the :class:`.Computed` construct.

Also improve the documentation in :meth:`Inspector.get_columns`, correctly
listing all the returned keys.

Fixes: #5063
Fixes: #4051
Closes: #5064
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5064
Pull-request-sha: ba00fc321ce468f8885aad23b3dd33c789e50fbe

Change-Id: I789986554fc8ac7f084270474d0b2c12046b1cc2

5 years agoupdated doc string to show `NOT (EXISTS` instead of `NOT EXISTS`, as …
jonathan vanasco [Sat, 14 Mar 2020 12:27:43 +0000 (08:27 -0400)] 
updated doc string to show `NOT (EXISTS` instead of `NOT EXISTS`, as â€¦

…that is what SqlAlchemy now renders.

SqlAlchemy currently renders `NOT (EXISTS` not `NOT EXISTS`. This fixes the example SQL.

### Description
The change is a docstring only.

### Checklist

This pull request is:

- [x] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [ ] 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: #4593
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4593
Pull-request-sha: fef577313242a1f79feb18969118a8fbb93bb6e9

Change-Id: Iee826a1754d76c93c014b44374e0f9aeabb8d0b6

5 years agoMerge "Fix IntegerTest for sqlalchemy-firebird"
mike bayer [Fri, 13 Mar 2020 21:11:59 +0000 (21:11 +0000)] 
Merge "Fix IntegerTest for sqlalchemy-firebird"

5 years agoFix tests failing for SQLite file databases; repair provisioning
Gord Thompson [Wed, 26 Feb 2020 19:50:01 +0000 (12:50 -0700)] 
Fix tests failing for SQLite file databases; repair provisioning

1. ensure provision.py loads dialect implementations when running
reap_dbs.py.   Reapers haven't been working since
598f2f7e557073f29563d4d567f43931fc03013f .

2. add some exclusion rules to allow the sqlite_file target to work;
add to tox.

3. add reap dbs target for SQLite, repair SQLite drop_db routine
which also wasn't doing the right thing for memory databases
etc.

4. Fix logging in provision files, as the main provision logger
is the one that's enabled by reap_dbs and maybe others, have all
the provision files use the provision logger.

Fixes: #5180
Fixes: #5168
Change-Id: Ibc1b0106394d20f5bcf847f37b09d185f26ac9b5

5 years agoDisable sqlite_file tests by default, take two
Mike Bayer [Fri, 13 Mar 2020 16:14:12 +0000 (12:14 -0400)] 
Disable sqlite_file tests by default, take two

We need no tests to run for sqlite_file until we merge
a full fix for it.   We'd like Jenkins to include this target.

Change-Id: I2737fa462572f08e2925b232a8f24d1ecd26b3ac

5 years agoInclude schema in all_tab_comments query
Mike Bayer [Fri, 13 Mar 2020 03:11:18 +0000 (23:11 -0400)] 
Include schema in all_tab_comments query

Fixed regression / incorrect fix caused by fix for :ticket:`5146` where the
Oracle dialect reads from the "all_tab_comments" view to get table comments
but fails to accommodate for the current owner of the table being
requested, causing it to read the wrong comment if multiple tables of the
same name exist in multiple schemas.

Fixes: #5146
Change-Id: Id79fbaa81b0e36cd4af60c48e4ab35c593ace057

5 years agoDont raise on pytest deprecation warnings
Mike Bayer [Thu, 12 Mar 2020 23:44:37 +0000 (19:44 -0400)] 
Dont raise on pytest deprecation warnings

py.test 5.4.0 emits deprecation warnings for pytest.Class.
make sure we don't raise for these, and log the code that will
be used for 5.4.0 when we bump requirements.

Fixes: #5201
Change-Id: I83e0402c4a6b2365a63b58d052c6989df3a37328

5 years agoAdd placeholder for sqlite file database
Mike Bayer [Thu, 12 Mar 2020 23:12:09 +0000 (19:12 -0400)] 
Add placeholder for sqlite file database

So that we can enable this in jenkins until
 Ibc1b0106394d20f5bcf847f37b09d185f26ac9b5 is merged.

Change-Id: Ia704e75bf3767e02d448a6af02530dfc89c9920b

5 years agoRemove trailing slashes in pre-commit config
Mike Bayer [Thu, 12 Mar 2020 00:47:25 +0000 (20:47 -0400)] 
Remove trailing slashes in pre-commit config

See https://github.com/sqlalchemy/dogpile.cache/pull/176

Change-Id: Id9a75546d4d0eae93ad837a77c6ffa9249efff5c

5 years agoMerge "Fix link in docs of query_expression and with_expression"
mike bayer [Wed, 11 Mar 2020 18:39:09 +0000 (18:39 +0000)] 
Merge "Fix link in docs of query_expression and with_expression"

5 years agoFix link in docs of query_expression and with_expression
Federico Caselli [Wed, 11 Mar 2020 18:09:41 +0000 (19:09 +0100)] 
Fix link in docs of query_expression and with_expression

Ref #5198

Change-Id: I566c2f7bbe08e9017e09e133079bef1c38469595

5 years agoMerge "Add missing changelog"
mike bayer [Wed, 11 Mar 2020 18:09:08 +0000 (18:09 +0000)] 
Merge "Add missing changelog"

5 years agoMerge "Rework select(), CompoundSelect() in terms of CompileState"
mike bayer [Wed, 11 Mar 2020 18:08:03 +0000 (18:08 +0000)] 
Merge "Rework select(), CompoundSelect() in terms of CompileState"

5 years agoAdd missing changelog
Federico Caselli [Wed, 11 Mar 2020 12:49:57 +0000 (13:49 +0100)] 
Add missing changelog

Add a changelog plus migration notes for the behavior
that's been improved by #4656, #4689

Original patch I2e291eba4297867fc0ddb5d875b9f7af34751d01

Change-Id: Ie956f55ba79b2a4f7a0c972a47c767de2ffd0081

5 years agocherry-pick changelog update for 1.3.16
Mike Bayer [Wed, 11 Mar 2020 16:36:59 +0000 (12:36 -0400)] 
cherry-pick changelog update for 1.3.16

5 years agocherry-pick changelog from 1.3.15
Mike Bayer [Wed, 11 Mar 2020 16:36:59 +0000 (12:36 -0400)] 
cherry-pick changelog from 1.3.15

5 years agoRepair broken call to sys.exc_info()
Mike Bayer [Wed, 11 Mar 2020 14:41:12 +0000 (10:41 -0400)] 
Repair broken call to sys.exc_info()

Fixed regression in 1.3.14 due to :ticket:`4849` where a sys.exc_info()
call failed to be invoked correctly when a flush error would occur. Test
coverage has been added for this exception case.

Fixes: #5196
Change-Id: Ib59a58a3a9d4c9c6f4b751201b794816a9f70225

5 years agoReword implicit left join error; ensure deterministic FROM for columns
Mike Bayer [Tue, 10 Mar 2020 22:48:42 +0000 (18:48 -0400)] 
Reword implicit left join error; ensure deterministic FROM for columns

Adjusted the error message emitted by :meth:`.Query.join` when a left hand
side can't be located that the :meth:`.Query.select_from` method is the
best way to resolve the issue.  Also, within the 1.3 series, used a
deterministic ordering when determining the FROM clause from a given column
entity passed to :class:`.Query` so that the same expression is determined
each time.

Fixes: #5194
Change-Id: I2e4065fd31e98c57edf2f11d5e831be44d2c1ea2

5 years agoMerge "Also run black --check in the tox pep8 env"
mike bayer [Tue, 10 Mar 2020 21:27:15 +0000 (21:27 +0000)] 
Merge "Also run black --check in the tox pep8 env"

5 years agoMerge "Simplified module pre-loading strategy and made it linter friendly"
mike bayer [Tue, 10 Mar 2020 21:26:37 +0000 (21:26 +0000)] 
Merge "Simplified module pre-loading strategy and made it linter friendly"

5 years agoRework select(), CompoundSelect() in terms of CompileState
Mike Bayer [Fri, 6 Mar 2020 21:04:46 +0000 (16:04 -0500)] 
Rework select(), CompoundSelect() in terms of CompileState

Continuation of I408e0b8be91fddd77cf279da97f55020871f75a9

- add an options() method to the base Generative construct.
this will be where ORM options can go
- Change Null, False_, True_ to be singletons, so that
we aren't instantiating them and having to use isinstance.
The previous issue with this was that they would produce dupe
labels in SELECT statements.   Apply the duplicate column
logic, newly added in 1.4, to these objects as well as to
non-apply-labels SELECT statements in general as a means of
improving this.
- create a revised system for generating ClauseList compilation
constructs that simplfies up front creation to not actually
use ClauseList; a simple tuple is rendered by the compiler
using the same constrcution rules as what are used for
ClauseList but without creating the actual object.  Apply
to Select, CompoundSelect, revise Update, Delete
- Select, CompoundSelect get an initial CompileState
implementation.  All methods used only within compilation
are moved here
- refine update/insert/delete compile state to not require
an outside boolean
- refine and simplify Select._copy_internals
- rework bind(), which is going away, to not use some
of the internal traversal stuff
- remove "autocommit", "for_update" parameters from Select,
  references #4643
- remove "autocommit" parameter from TextClause ,
  references #4643
- add deprecation warnings for statement.execute(),
engine.execute(), statement.scalar(), engine.scalar().
Fixes: #5193
Change-Id: I04ca0152b046fd42c5054ba10f37e43fc6e5a57b

5 years agoAlso run black --check in the tox pep8 env
Federico Caselli [Tue, 10 Mar 2020 18:49:39 +0000 (19:49 +0100)] 
Also run black --check in the tox pep8 env

Change-Id: I3b86bb3b4263048646676972bb2a870c7e2a7393

5 years agoDeprecate :func:`.eagerload` and :func:`.relation`
Federico Caselli [Tue, 10 Mar 2020 18:33:51 +0000 (19:33 +0100)] 
Deprecate :func:`.eagerload` and :func:`.relation`

The :func:`.eagerload` and :func:`.relation` were old
aliases and are now deprecated. Use :func:`.joinedload`
and :func:`.relationship` respectively.

Fixes: #5192
Change-Id: Ie13186e117e93e04a9c19d42fed4ef1af629b465

5 years agocherry-pick changelog update for 1.3.15
Mike Bayer [Tue, 10 Mar 2020 15:57:24 +0000 (11:57 -0400)] 
cherry-pick changelog update for 1.3.15

5 years agocherry-pick changelog from 1.3.14
Mike Bayer [Tue, 10 Mar 2020 15:57:23 +0000 (11:57 -0400)] 
cherry-pick changelog from 1.3.14

5 years agoReflect comments from any table accessible by the current user
Gord Thompson [Mon, 9 Mar 2020 21:50:53 +0000 (17:50 -0400)] 
Reflect comments from any table accessible by the current user

Fixed a reflection bug where table comments could only be retrieved for
tables actually owned by the user but not for tables visible to the user
but owned by someone else.  Pull request courtesy Dave Hirschfeld.

Fixes: #5146
Closes: #5147
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5147
Pull-request-sha: 0651e3bed05923765203b37986a2506dac3e634e

Change-Id: If970fda10d6adf04d926d38df1a567df1de9f7b9

5 years agoMerge remote-tracking branch 'origin/pr/5058'
Mike Bayer [Mon, 9 Mar 2020 15:09:29 +0000 (11:09 -0400)] 
Merge remote-tracking branch 'origin/pr/5058'

Change-Id: I83c998ef76adf2853a5d626b78dc76e433a5a8c5

5 years agoSimplified module pre-loading strategy and made it linter friendly
Federico Caselli [Sat, 7 Mar 2020 18:17:07 +0000 (19:17 +0100)] 
Simplified module pre-loading strategy and made it linter friendly

Introduced a modules registry to register modules that should be lazily loaded
in the package init. This ensures that they are in the system module cache,
avoiding potential thread safety issues as when importing them directly
in the function that uses them. The module registry is used to obtain
these modules directly, ensuring that the all the lazily loaded modules
are resolved at the proper time

This replaces dependency_for decorator and the dependencies decorator logic,
removing the need to pass the resolved modules as arguments of the
decodated functions and removes possible errors caused by linters.

Fixes: #4689
Fixes: #4656
Change-Id: I2e291eba4297867fc0ddb5d875b9f7af34751d01

5 years agoClean up list of external dialects
Gord Thompson [Fri, 6 Mar 2020 23:49:22 +0000 (16:49 -0700)] 
Clean up list of external dialects

Fixes: #5190
Change-Id: I3636eeda08bfaa882477397a4cd8064820d25356

5 years agoDecouple compiler state from DML objects; make cacheable
Mike Bayer [Sun, 23 Feb 2020 18:37:18 +0000 (13:37 -0500)] 
Decouple compiler state from DML objects; make cacheable

Targeting select / insert / update / delete, the goal
is to minimize overhead of construction and generative methods
so that only the raw arguments passed are handled.   An interim
stage that converts the raw state into more compiler-ready state
is added, which is analogous to the ORM QueryContext which will
also be rolled in to be a similar concept, as is currently
being prototyped in I19e05b3424b07114cce6c439b05198ac47f7ac10.
the ORM update/delete BulkUD concept is also going to be rolled
onto this idea.   So while the compiler-ready state object,
here called DMLState, looks a little thin, it's the
base of a bigger pattern that will allow for ORM functionality
to embed itself directly into the compiler, execution
context, and result set objects.

This change targets the DML objects, primarily focused on the
values() method which is the most complex process.   The
work done by values() is minimized as much as possible
while still being able to create a cache key.   Additional
computation is then offloaded to a new object ValuesState
that is handled by the compiler.

Architecturally, a big change here is that insert.values()
and update.values() will generate BindParameter objects for
the values now, which are then carefully received by crud.py
so that they generate the expected names.   This is so that
the values() portion of these constructs is cacheable.
for the "multi-values" version of Insert, this is all skipped
and the plan right now is that a multi-values insert is
not worth caching (can always be revisited).

Using the
coercions system in values() also gets us nicer validation
for free, we can remove the NotAClauseElement thing from
schema, and we also now require scalar_subquery() is called
for an insert/update that uses a SELECT as a column value,
1.x deprecation path is added.

The traversal system is then applied to the DML objects
including tests so that they have traversal, cloning, and
cache key support.  cloning is not a use case for DML however
having it present allows better validation of the structure
within the tests.

Special per-dialect DML is explicitly not cacheable at the moment,
more as a proof of concept that third party DML constructs can
exist as gracefully not-cacheable rather than producing an
incomplete cache key.

A few selected performance improvements have been added as well,
simplifying the immutabledict.union() method and adding
a new SQLCompiler function that can generate delimeter-separated
clauses like WHERE and ORDER BY without having to build
a ClauseList object at all.   The use of ClauseList will
be removed from Select in an upcoming commit.  Overall,
ClaustList is unnecessary for internal use and only adds
overhead to statement construction and will likely be removed
as much as possible except for explcit use of conjunctions like
and_() and or_().

Change-Id: I408e0b8be91fddd77cf279da97f55020871f75a9

5 years agoMerge "Render VALUES within composed MySQL on duplicate key expressions"
mike bayer [Thu, 5 Mar 2020 04:18:22 +0000 (04:18 +0000)] 
Merge "Render VALUES within composed MySQL on duplicate key expressions"

5 years agoMerge "Add docker commands to README.unittests"
mike bayer [Wed, 4 Mar 2020 22:50:04 +0000 (22:50 +0000)] 
Merge "Add docker commands to  README.unittests"

5 years agoRender VALUES within composed MySQL on duplicate key expressions
Mike Bayer [Wed, 4 Mar 2020 22:44:40 +0000 (17:44 -0500)] 
Render VALUES within composed MySQL on duplicate key expressions

Fixed issue in MySQL :meth:`.mysql.Insert.on_duplicate_key_update` construct
where using a SQL function or other composed expression for a column argument
would not properly render the ``VALUES`` keyword surrounding the column
itself.

Fixes: #5173
Change-Id: I16d39c2fdb8bbb7f3d1b2ffdd20e1bf69359ab75

5 years agoMerge "Don't import provision.py unconditionally"
mike bayer [Wed, 4 Mar 2020 21:06:57 +0000 (21:06 +0000)] 
Merge "Don't import provision.py unconditionally"

5 years agoAdd docker commands to README.unittests
Federico Caselli [Tue, 3 Mar 2020 22:34:09 +0000 (17:34 -0500)] 
Add docker commands to  README.unittests

Closes: #5116
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5116
Pull-request-sha: e70ad70426de03982c3abb78eb7b8292e86c3950

Change-Id: If9ef93312d8ce78908a76ea84cb95f3068ffb306

5 years agoMerge remote-tracking branch 'origin/pr/5186'
Mike Bayer [Wed, 4 Mar 2020 14:12:27 +0000 (09:12 -0500)] 
Merge remote-tracking branch 'origin/pr/5186'

Change-Id: I35921d46676e77ebdbe93f12406cdde3f6656704

5 years agofix typo in PickleType documentation 5186/head
Federico Caselli [Wed, 4 Mar 2020 12:48:30 +0000 (13:48 +0100)] 
fix typo in PickleType documentation

5 years agoMerge "Remove the deprecated loader options"
mike bayer [Wed, 4 Mar 2020 02:39:52 +0000 (02:39 +0000)] 
Merge "Remove the deprecated loader options"

5 years agoMerge "Restore crud flags if visiting_cte is set"
mike bayer [Wed, 4 Mar 2020 02:32:21 +0000 (02:32 +0000)] 
Merge "Restore crud flags if visiting_cte is set"

5 years agoRun handle_error for any exceptions raised in execute_context()
Mike Bayer [Wed, 4 Mar 2020 00:15:55 +0000 (19:15 -0500)] 
Run handle_error for any exceptions raised in execute_context()

Observing a SQLite connection/cursor being hung on
test_resultset -> PositionalTextTest -> test_dupe_col_obj.
this uses connectionless execution and the result object
fails to be constructed.  When that happens, there is no path
for the cursor or connection to be closed / released.
Recent changes with the exception assertions in #4849 seem to
be causing a cycle to last a little longer than usual which
is exposing this issue for one particular test on SQLite.

As we want to get rid of weakref cleanup, evaluate
why we dont have handle_dbapi_exception for this whole
block, as after_cursor_execute can raise, result construction
can raise, autocommit can raise, close can raise, there
does not seem to be a reason these things should be outside
of the block that gets cleaned up.

Fixes: #5182
Change-Id: I640ac55e8c5f39d287f779fbb5dc0ab727218ca3

5 years agoRestore crud flags if visiting_cte is set
Mike Bayer [Tue, 3 Mar 2020 22:22:30 +0000 (17:22 -0500)] 
Restore crud flags if visiting_cte is set

Fixed bug where a CTE of an INSERT/UPDATE/DELETE that also uses RETURNING
could then not be SELECTed from directly, as the internal state of the
compiler would try to treat the outer SELECT as a DELETE statement itself
and access nonexistent state.

Fixes: #5181
Change-Id: Icba76f2148c8344baa1c04bac4ab6c6d24f23072

5 years agoRemove the deprecated loader options
Federico Caselli [Tue, 3 Mar 2020 21:32:19 +0000 (22:32 +0100)] 
Remove the deprecated loader options

Remove the deprecated loader options ``joinedload_all``, ``subqueryload_all``,
``lazyload_all``, ``selectinload_all``. The normal version with method chaining
should be used in their place.

Fixes: #4642
Change-Id: I12eb4dfa7a86375911a570934ee662653d85d50a

5 years agoDon't import provision.py unconditionally
Mike Bayer [Tue, 3 Mar 2020 21:03:39 +0000 (16:03 -0500)] 
Don't import provision.py unconditionally

Removed the imports for provision.py from each dialect
and instead added a call in the central provision.py to
a new dialect level method load_provisioning().  The
provisioning registry works in the same way, so an existing
dialect that is using the provision.py system right now
by importing it as part of the package will still continue to
function.  However, to avoid pulling in the testing package when
the dialect is used in a non-testing context, the new hook may be
used.   Also removed a module-level dependency
of the testing framework on the orm package.

Revised an internal change to the test system added as a result of
:ticket:`5085` where a testing-related module per dialect would be loaded
unconditionally upon making use of that dialect, pulling in SQLAlchemy's
testing framework as well as the ORM into the module import space.   This
would only impact initial startup time and memory to a modest extent,
however it's best that these additional modules aren't reverse-dependent on
straight Core usage.

Fixes: #5180
Change-Id: I6355601da5f6f44d85a2bbc3acb5928559942b9c

5 years agoInclude column_property composition examples
Mike Bayer [Tue, 3 Mar 2020 13:58:35 +0000 (08:58 -0500)] 
Include column_property composition examples

Add cross-linking between column_property() and ColumnProperty

Add section to describe using .expression

remove inherited-members from ColumnProperty to greatly
decrease verbosity

Fixes: #5179
Change-Id: Ic477b16350dbf551100b31d14ff3ba8ba8221a43

5 years agoMerge "Ensure all nested exception throws have a cause"
mike bayer [Mon, 2 Mar 2020 23:45:35 +0000 (23:45 +0000)] 
Merge "Ensure all nested exception throws have a cause"

5 years agoEnsure all nested exception throws have a cause
Mike Bayer [Sat, 29 Feb 2020 19:40:45 +0000 (14:40 -0500)] 
Ensure all nested exception throws have a cause

Applied an explicit "cause" to most if not all internally raised exceptions
that are raised from within an internal exception catch, to avoid
misleading stacktraces that suggest an error within the handling of an
exception.  While it would be preferable to suppress the internally caught
exception in the way that the ``__suppress_context__`` attribute would,
there does not as yet seem to be a way to do this without suppressing an
enclosing user constructed context, so for now it exposes the internally
caught exception as the cause so that full information about the context
of the error is maintained.

Fixes: #4849
Change-Id: I55a86b29023675d9e5e49bc7edc5a2dc0bcd4751

5 years agoMerge "Remove obsolete util.compat.nested"
mike bayer [Mon, 2 Mar 2020 19:21:24 +0000 (19:21 +0000)] 
Merge "Remove obsolete util.compat.nested"

5 years agoRemove obsolete util.compat.nested
Gord Thompson [Sun, 1 Mar 2020 18:30:56 +0000 (11:30 -0700)] 
Remove obsolete util.compat.nested

Fixes: #5177
Change-Id: Ie02b0c065e3833f43e056ad9c31f414871d9e8ee