]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoRemove silent ignore for skip_locked w/ unsupported backends
Gord Thompson [Sun, 13 Sep 2020 22:38:13 +0000 (16:38 -0600)] 
Remove silent ignore for skip_locked w/ unsupported backends

For SQLAlchemy 1.4:

The "skip_locked" keyword used with ``with_for_update()`` will render "SKIP
LOCKED" on all MySQL backends, meaning it will fail for MySQL less than
version 8 and on current MariaDB backends.  This is because those backends
do not support "SKIP LOCKED" or any equivalent, so this error should not be
silently ignored.   This is upgraded from a warning in the 1.3 series.

For SQLAlchemy 1.3:

The "skip_locked" keyword used with ``with_for_update()`` will emit a
warning when used on MariaDB backends, and will then be ignored.   This is
a deprecated behavior that will raise in SQLAlchemy 1.4, as an application
that requests "skip locked" is looking for a non-blocking operation which
is not available on those backends.

Fixes: #5578
Change-Id: I49ccb6c6ff46eafed12b77f51e1da8e0e397966c

4 years agoMerge "Rename Core expression isnot, not_in_"
mike bayer [Mon, 14 Sep 2020 20:35:51 +0000 (20:35 +0000)] 
Merge "Rename Core expression isnot, not_in_"

4 years agoMerge "Pass all pool parameters in recreate()"
mike bayer [Mon, 14 Sep 2020 18:25:51 +0000 (18:25 +0000)] 
Merge "Pass all pool parameters in recreate()"

4 years agoPass all pool parameters in recreate()
Mike Bayer [Mon, 14 Sep 2020 14:14:48 +0000 (10:14 -0400)] 
Pass all pool parameters in recreate()

The following pool parameters were not being propagated to the new pool
created when :meth:`_engine.Engine.dispose` were called: ``pre_ping``,
``use_lifo``.  Additionally the ``recycle`` and ``reset_on_return``
parameters were not propagated for the :class:`_engine.AssertionPool`
class.  These issues have been fixed.

Fixes: #5582
Change-Id: Ifdb703aa7e849652242b9ff8071c854cd1d77e71

4 years agoRename Core expression isnot, not_in_
jonathan vanasco [Tue, 1 Sep 2020 20:56:53 +0000 (16:56 -0400)] 
Rename Core expression isnot, not_in_

Several operators are renamed to achieve more consistent naming across
SQLAlchemy.

The operator changes are:

* `isnot` is now `is_not`
* `not_in_` is now `not_in`

Because these are core operators, the internal migration strategy for this
change is to support legacy terms for an extended period of time -- if not
indefinitely -- but update all documentation, tutorials, and internal usage
to the new terms.  The new terms are used to define the functions, and
the legacy terms have been deprecated into aliases of the new terms.

Fixes: #5429
Change-Id: Ia1e66e7a50ac35d3f6260d8bf6ba3ce8087cbad2

4 years agoAdapt event exec_once_mutex to asyncio
Mike Bayer [Mon, 14 Sep 2020 12:04:09 +0000 (08:04 -0400)] 
Adapt event exec_once_mutex to asyncio

The pool makes use of a threading.Lock() for the
"first_connect" event.  if the pool is async make sure this
is a greenlet-adapted asyncio lock.

Fixes: #5581
Change-Id: If52415839c7ed82135465f1fe93b95d86c305820

4 years agoMerge "Update session.execute() and related documentation"
mike bayer [Sun, 13 Sep 2020 18:00:33 +0000 (18:00 +0000)] 
Merge "Update session.execute() and related documentation"

4 years agoUpdate session.execute() and related documentation
Mike Bayer [Sun, 13 Sep 2020 17:15:29 +0000 (13:15 -0400)] 
Update session.execute() and related documentation

The docs here were completely out of date and referred
to behaviors that are no longer true, behaviors that are
deprecated, etc.   For the moment, take out all the verbiage
so that nothing incorrect is present.   New ORM documentation
will need to be constructed to support this statement.

Change-Id: I4782aebb6443ceb68752c3b52b574fd30658ebc9

4 years agoDeprecate engine-wise ss cursors; repair mariadbconnector
Mike Bayer [Sun, 13 Sep 2020 14:36:16 +0000 (10:36 -0400)] 
Deprecate engine-wise ss cursors; repair mariadbconnector

The server_side_cursors engine-wide feature relies upon
regexp parsing of statements a well as general guessing as
to when the feature should be used.   This is not within the
2.0 way of doing things and should be removed.

Additionally, mariadbconnector defaults to unbuffered cursors;
add new cursor hooks so that mariadbconnector can specify
buffered or unbuffered cursors without too much difficulty.
This will also correctly default mariadbconnector to buffered
cursors which should repair the segfaults we've been getting.

Try to restore the assert_raises that was removed in
5b6dfc0c38bf1f01da4b8 to see if mariadbconnector segfaults
are resolved.

Change-Id: I77f1c972c742e40694972f578140bb0cac8c39eb

4 years agoEnsure cursor is closed for scalar() if make_row fails
Mike Bayer [Sat, 12 Sep 2020 20:07:50 +0000 (16:07 -0400)] 
Ensure cursor is closed for scalar() if make_row fails

As we have some tests that are against enums which
can raise on fetch, if we call scalar() and it fails,
we need to close the cursor.  mariadb segfaults
etc. seem to have been caused by this.

Change-Id: I8261f6fe7f972ae2d8702650440fd8d71e9bce53

4 years agoMerge "Improve handling of covering indexes"
mike bayer [Sat, 12 Sep 2020 19:46:50 +0000 (19:46 +0000)] 
Merge "Improve handling of covering indexes"

4 years agoImprove handling of covering indexes
Gord Thompson [Tue, 1 Sep 2020 20:36:40 +0000 (14:36 -0600)] 
Improve handling of covering indexes

Improved support for covering indexes (with INCLUDE columns). Added the
ability for postgresql to render CREATE INDEX statements with an INCLUDE
clause from Core. Index reflection also report INCLUDE columns separately
for both mssql and postgresql (11+).

Fixes: #4458
Change-Id: If0b82103fbc898cdaeaf6a6d2d421c732744acd6

4 years agoMerge "Raname ``mustexit`` to ``must_exist``"
mike bayer [Sat, 12 Sep 2020 16:36:00 +0000 (16:36 +0000)] 
Merge "Raname ``mustexit`` to ``must_exist``"

4 years agoMerge "Add missing "temp_table_reflect_indexes" to SuiteRequirements"
mike bayer [Sat, 12 Sep 2020 16:28:28 +0000 (16:28 +0000)] 
Merge "Add missing "temp_table_reflect_indexes" to SuiteRequirements"

4 years agoMerge "Do not specify type on mssql by default"
mike bayer [Sat, 12 Sep 2020 16:26:39 +0000 (16:26 +0000)] 
Merge "Do not specify type on mssql by default"

4 years agoMerge "Reflect mssql/postgresql filtered/partial indexes"
mike bayer [Sat, 12 Sep 2020 16:26:28 +0000 (16:26 +0000)] 
Merge "Reflect mssql/postgresql filtered/partial indexes"

4 years agoReflect mssql/postgresql filtered/partial indexes
RamonWill [Thu, 20 Aug 2020 19:05:39 +0000 (15:05 -0400)] 
Reflect mssql/postgresql filtered/partial indexes

Added support for inspection / reflection of partial indexes / filtered
indexes, i.e. those which use the ``mssql_where`` or ``postgresql_where``
parameters, with :class:`_schema.Index`.   The entry is both part of the
dictionary returned by :meth:`.Inspector.get_indexes` as well as part of a
reflected :class:`_schema.Index` construct that was reflected.  Pull
request courtesy Ramon Williams.

**Have a nice day!**
Fixes: #4966
Closes: #5504
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5504
Pull-request-sha: b3018bac987081193b2e65cfdb6aeb7d5d270fcd

Change-Id: Icbb2f93d1545700718ccb5222097185b815f5dbc

4 years agoDo not specify type on mssql by default
Federico Caselli [Fri, 7 Aug 2020 21:38:02 +0000 (23:38 +0200)] 
Do not specify type on mssql by default

Make optional sequences render as identity in mssql
Remove unused dialect option sequence_default_column_type

Change-Id: I821eeffcb442f8d1b69186a9b798b15c3d8d6ff3

4 years agoMerge "Emit deprecation warning for **kw passed to session.execute()"
mike bayer [Sat, 12 Sep 2020 13:10:19 +0000 (13:10 +0000)] 
Merge "Emit deprecation warning for **kw passed to session.execute()"

4 years agoTear down InstrumentationEvents for declarative test
Mike Bayer [Fri, 11 Sep 2020 22:15:51 +0000 (18:15 -0400)] 
Tear down InstrumentationEvents for declarative test

Fixes gc collection issues later on that occur in test_mixin.py

HUGE thanks to Federico Caselli for finding the issue!

Change-Id: I6444e868ab3d6ff62fb644ebe2fbded7df139c9c

4 years agoRevert "remote debugging"
Mike Bayer [Fri, 11 Sep 2020 22:09:31 +0000 (18:09 -0400)] 
Revert "remote debugging"

This reverts commit ce0b2f3cd1869331b6bcc971219789f3578ff705.

Revert "remote debugging continued"

This reverts commit 881d6f12f70e1b594695e2bbc7b87ab846407f58.

Revert "try to debug failing test on github workers"

This reverts commit 26d2c43c141ba6240fd2d2e01c280ecbe64c3faf.

Revert "Attempt to strengthen gc test"

This reverts commit 73cdd6c21fb5a9699ab8987f59c21ddef3d0b896.

4 years agoremote debugging
Mike Bayer [Fri, 11 Sep 2020 20:37:56 +0000 (16:37 -0400)] 
remote debugging

Change-Id: I3eee96df57caea70d08993287014b5795d8a3716

4 years agoremote debugging continued
Mike Bayer [Fri, 11 Sep 2020 20:13:00 +0000 (16:13 -0400)] 
remote debugging continued

Change-Id: I9e03d50ec00637e47ea87883fd9f450f3ffa8101

4 years agotry to debug failing test on github workers
Mike Bayer [Fri, 11 Sep 2020 18:27:30 +0000 (14:27 -0400)] 
try to debug failing test on github workers

Change-Id: I18c4761dba96b8abeb1461974ee6ed19b299dfdf

4 years agoAttempt to strengthen gc test
Mike Bayer [Fri, 11 Sep 2020 15:44:20 +0000 (11:44 -0400)] 
Attempt to strengthen gc test

- ensure class registry is empty first
- gc_collect() twice

Change-Id: I61324931bfc1aafce97880320951e568be88f121

4 years agofix typos
Mike Bayer [Fri, 11 Sep 2020 15:07:33 +0000 (11:07 -0400)] 
fix typos

Change-Id: I7649576bd1e100fd6f8968f0256b074263943a44

4 years agoEmit deprecation warning for **kw passed to session.execute()
Mike Bayer [Fri, 11 Sep 2020 14:50:58 +0000 (10:50 -0400)] 
Emit deprecation warning for **kw passed to session.execute()

Passing keyword arguments to methods such as :meth:`_orm.Session.execute`
to be passed into the :meth:`_orm.Session.get_bind` method is deprecated;
the new :paramref:`_orm.Session.execute.bind_arguments` dictionary should
be passed instead.

Fixes: #5573
Change-Id: I555bda84384dbf6d12ba4483c486f9488be0fa25

4 years agoBuild out new declarative systems; deprecate mapper()
Mike Bayer [Mon, 31 Aug 2020 15:46:55 +0000 (11:46 -0400)] 
Build out new declarative systems; deprecate mapper()

The ORM Declarative system is now unified into the ORM itself, with new
import spaces under ``sqlalchemy.orm`` and new kinds of mappings.  Support
for decorator-based mappings without using a base class, support for
classical style-mapper() calls that have access to the declarative class
registry for relationships, and full integration of Declarative with 3rd
party class attribute systems like ``dataclasses`` and ``attrs`` is now
supported.

Fixes: #5508
Change-Id: I130b2b6edff6450bfe8a3e6baa099ff04b5471ff

4 years agoAdd 3rd party integration issues FAQ; add numpy
Mike Bayer [Thu, 10 Sep 2020 19:48:14 +0000 (15:48 -0400)] 
Add 3rd party integration issues FAQ; add numpy

Users of numpy and pandas should refer to this section
where we will try to catalog the common issues that don't
really have an automatic solution.

Fixes: #5552
Change-Id: I02990e328616ccb21933ffda1167c52256bace07

4 years agoAdd more docs for populate_existing(); link with_for_update
Mike Bayer [Thu, 10 Sep 2020 15:56:34 +0000 (11:56 -0400)] 
Add more docs for populate_existing(); link with_for_update

The populate_existing() method is actually changing
to be an execution option, however it has almost no
mention in the narrative docs so add docs in terms of the
1.x version first, including that we mention you almost
definitely want to use this method if you are also using
with_for_update().

Fixes: #5572
Fixes: #4774
Change-Id: Ieca916400622c1ffc1ae81204132a02a0983594c

4 years agoRepair documentation issues
Mike Bayer [Wed, 9 Sep 2020 14:24:15 +0000 (10:24 -0400)] 
Repair documentation issues

Fixes some remaining issues detailed at #5428.

Fixes: #5428
Change-Id: I942a64411766fc82f30791eee570747a218af77d

4 years agoMerge "Update select usage to use the new 1.4 format"
mike bayer [Tue, 8 Sep 2020 22:11:29 +0000 (22:11 +0000)] 
Merge "Update select usage to use the new 1.4 format"

4 years agoMerge "Fix typo in :paramref:`_engine.create_engine.isolation_level` names"
mike bayer [Tue, 8 Sep 2020 22:08:22 +0000 (22:08 +0000)] 
Merge "Fix typo in :paramref:`_engine.create_engine.isolation_level` names"

4 years agoUpdate select usage to use the new 1.4 format
Federico Caselli [Wed, 2 Sep 2020 21:46:06 +0000 (23:46 +0200)] 
Update select usage to use the new 1.4 format

This change includes mainly that the bracketed use within
select() is moved to positional, and keyword arguments are
removed from calls to the select() function.  it does not
yet fully address other issues such as keyword arguments passed
to the table.select().

Additionally, allows False / None to both be considered
as "disable" for all of select.correlate(), select.correlate_except(),
query.correlate(), which establishes consistency with
passing of ``False`` for the legact select(correlate=False)
argument.

Change-Id: Ie6c6e6abfbd3d75d4c8de504c0cf0159e6999108

4 years agoFix typo in :paramref:`_engine.create_engine.isolation_level` names
Federico Caselli [Tue, 8 Sep 2020 21:09:21 +0000 (23:09 +0200)] 
Fix typo in :paramref:`_engine.create_engine.isolation_level` names

Fixes: #5563
Change-Id: I29204fdf679d750c66ed17daf70bc8d7cb1b7f65

4 years agoFix typo in I0ad6d7a095e49d331618274c40ce75c76afdc7dd
Federico Caselli [Tue, 8 Sep 2020 20:00:25 +0000 (22:00 +0200)] 
Fix typo in I0ad6d7a095e49d331618274c40ce75c76afdc7dd

Change-Id: I649662d440f83df379922e8c967d28f635f9c85b

4 years agoAdd missing "temp_table_reflect_indexes" to SuiteRequirements
Gord Thompson [Fri, 4 Sep 2020 17:03:03 +0000 (11:03 -0600)] 
Add missing "temp_table_reflect_indexes" to SuiteRequirements

Provide a default value for this requirement to expose it
to external dialects.

Change-Id: I3801a9134493efb65caa6793ef466a3cfb701592

4 years agoMerge "Create connection characteristics API; implement postgresql flags"
mike bayer [Tue, 8 Sep 2020 15:17:37 +0000 (15:17 +0000)] 
Merge "Create connection characteristics API; implement postgresql flags"

4 years agoCreate connection characteristics API; implement postgresql flags
Mike Bayer [Mon, 7 Sep 2020 20:24:47 +0000 (16:24 -0400)] 
Create connection characteristics API; implement postgresql flags

Added support for PostgreSQL "readonly" and "deferrable" flags for all of
psycopg2, asyncpg and pg8000 dialects.   This takes advantage of a newly
generalized version of the "isolation level" API to support other kinds of
session attributes set via execution options that are reliably reset
when connections are returned to the connection pool.

Fixes: #5549
Change-Id: I0ad6d7a095e49d331618274c40ce75c76afdc7dd

4 years agoPostgreSQL dialect-level isolation_level parameter is legacy
Mike Bayer [Tue, 8 Sep 2020 15:01:28 +0000 (11:01 -0400)] 
PostgreSQL dialect-level isolation_level parameter is legacy

The isolation level section in the docs inadvertently
copied the PostgreSQL example using the PGDialect.isolation_level
parameter and not the execution_options.  ensure only
the execution_options version is documented.

Change-Id: I94e02ede62d3dded40e3fcbce8d04608dc063108

4 years agoMerge "Modernize some .execute calls in EnumSetTest"
mike bayer [Tue, 8 Sep 2020 14:15:33 +0000 (14:15 +0000)] 
Merge "Modernize some .execute calls in EnumSetTest"

4 years agoModernize some .execute calls in EnumSetTest
Gord Thompson [Sat, 5 Sep 2020 18:22:43 +0000 (12:22 -0600)] 
Modernize some .execute calls in EnumSetTest

Change-Id: I9bbc3be4ec1797686ddf4a559f5b9e1679c62f58

4 years agoUpdate paths in CHANGES
Stig Otnes Kolstad [Mon, 7 Sep 2020 16:38:48 +0000 (12:38 -0400)] 
Update paths in CHANGES

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
Outdated path to in-repo changelog. Removed whitespace as well.

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

- [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: #5560
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5560
Pull-request-sha: f69e6adbe85997c88cb1c6e6c564cefdbc1c874a

Change-Id: If047c0fd4933ba09af5e3649fb8de874b886e854

4 years agoDon't rely on string col name in adapt_to_context
Mike Bayer [Sat, 5 Sep 2020 23:45:04 +0000 (19:45 -0400)] 
Don't rely on string col name in adapt_to_context

fixed an issue where even though the method claims to be
matching up columns positionally, it was failing on that by
looking in "keymap" based on string name.

Adds a new member to the _keymap recs MD_RESULT_MAP_INDEX
so that we can efficiently link from the generated keymap
back to the compiled._result_columns structure without
any ambiguity.

Fixes: #5559
Change-Id: Ie2fa9165c16625ef860ffac1190e00575e96761f

4 years agoRevert "Block non-mysqldb / pymysql from testing Enum"
Mike Bayer [Sat, 5 Sep 2020 13:47:45 +0000 (09:47 -0400)] 
Revert "Block non-mysqldb / pymysql from testing Enum"

This reverts commit 55843040b1b4e1493e27051f5125fa322a43dc31.

4 years agoRaname ``mustexit`` to ``must_exist``
Federico Caselli [Thu, 3 Sep 2020 20:11:30 +0000 (22:11 +0200)] 
Raname ``mustexit`` to ``must_exist``

:class:`_schema.Table` parameter ``mustexist`` has been renamed
to :paramref:`_schema.Table.must_exist` and will now warn when used.

Change-Id: I0b0ca6021f9f7cfbe2040bbc1125a2236ac79f53

4 years agoBlock non-mysqldb / pymysql from testing Enum
Mike Bayer [Thu, 3 Sep 2020 18:48:57 +0000 (14:48 -0400)] 
Block non-mysqldb / pymysql from testing Enum

The mariadbconnector driver is having sporadic interpreter
crashes within this test suite.  hopefully the crashes
are specific to these tests else we'll have to remove
mariadb from CI.

Change-Id: Idb7a9521e795d39957bce45415013eb4e771e560

4 years agoMerge "Add new MySQL reserved words: `cube`, `lateral`."
mike bayer [Thu, 3 Sep 2020 16:17:23 +0000 (16:17 +0000)] 
Merge "Add new MySQL reserved words: `cube`, `lateral`."

4 years agoAdd caveat re: with_expression and already-loaded object
Mike Bayer [Wed, 2 Sep 2020 18:47:03 +0000 (14:47 -0400)] 
Add caveat re: with_expression and already-loaded object

Adds a test for the populate_existing() behavior as well.

Fixes: #5553
Change-Id: Ib0db6227c3fec7d0065f2a7caa36b3fd94ef14fd

4 years agoMerge "Improve reflection for mssql temporary tables" 5550/head
mike bayer [Tue, 1 Sep 2020 17:12:11 +0000 (17:12 +0000)] 
Merge "Improve reflection for mssql temporary tables"

4 years agoMerge "Add support for classical mapping of dataclasses"
mike bayer [Tue, 1 Sep 2020 17:10:53 +0000 (17:10 +0000)] 
Merge "Add support for classical mapping of dataclasses"

4 years agoMerge "MariaDB dialect implementation"
mike bayer [Tue, 1 Sep 2020 17:09:19 +0000 (17:09 +0000)] 
Merge "MariaDB dialect implementation"

4 years agoAdd support for classical mapping of dataclasses
Václav Klusák [Mon, 17 Aug 2020 15:58:56 +0000 (11:58 -0400)] 
Add support for classical mapping of dataclasses

Added support for direct mapping of Python classes that are defined using
the Python ``dataclasses`` decorator.    See the section
:ref:`mapping_dataclasses` for background.  Pull request courtesy Václav
Klusák.

Fixes: #5027
Closes: #5516
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5516
Pull-request-sha: bb48c63d1561ca48c954ad9f84a3eb2646571115

Change-Id: Ie33db2aae4adeeb5d99633fe926b9c30bab0b885

4 years agoImprove reflection for mssql temporary tables
Gord Thompson [Wed, 12 Aug 2020 20:46:59 +0000 (14:46 -0600)] 
Improve reflection for mssql temporary tables

Fixes: #5506
Change-Id: I718474d76e3c630a1b71e07eaa20cefb104d11de

4 years agoMerge "Provide a more detailed error message for Query.join()"
mike bayer [Tue, 1 Sep 2020 13:50:29 +0000 (13:50 +0000)] 
Merge "Provide a more detailed error message for Query.join()"

4 years agoProvide a more detailed error message for Query.join()
RamonWill [Tue, 25 Aug 2020 00:14:15 +0000 (20:14 -0400)] 
Provide a more detailed error message for Query.join()

An :class:`.ArgumentError` with more detail is now raised if the target
parameter for :meth:`_query.Query.join` is set to an unmapped object.
Prior to this change a less detailed ``AttributeError`` was raised.
Pull request courtesy Ramon Williams.

Fixes: #4428
Closes: #5452
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5452
Pull-request-sha: b148df547037e9a254fe331eff8e922c78426261

Change-Id: I873453d1fdb651178216aac698baac63ae5a94e8

4 years agoFix a mis-reference in create_async_engine().
Fantix King [Sat, 29 Aug 2020 16:37:34 +0000 (12:37 -0400)] 
Fix a mis-reference in create_async_engine().

`AsyncMethodRequired` is actually from
`sqlalchemy.ext.asyncio.exc`, so here it
should be referenced as `async_exc.AsyncMethodRequired`,
instead of `exc.AsyncMethodRequired`.

Fixes: #5529
Closes: #5545
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5545
Pull-request-sha: d8f885c587dd058f909d4f3bdbec3d0fca176680

Change-Id: I6886558bfd33d3e9e283fbd60c0ec971a1f22c0c

4 years agoMariaDB dialect implementation
Georg Richter [Thu, 20 Aug 2020 12:00:14 +0000 (08:00 -0400)] 
MariaDB dialect implementation

Fixes: #5459
Closes: #5515
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5515
Pull-request-sha: 760090b9067304cc65fece12fcf10b522afc4a2a

Change-Id: I30e8fbc02b7b5329ca228cd39f6fb7cfd0e43092

4 years agoSome updates for creational patterns
Mike Bayer [Mon, 31 Aug 2020 17:31:00 +0000 (13:31 -0400)] 
Some updates for creational patterns

I'm finding it useful to use "with Session(engine) as session,
session.begin()" so add an example for that.

Change-Id: I4403ced51a5e90cfe6b0173813db4cb631957f4c

4 years agoMerge "Include PostgreSQL in trigger test and correct documentation example"
mike bayer [Mon, 31 Aug 2020 16:34:31 +0000 (16:34 +0000)] 
Merge "Include PostgreSQL in trigger test and correct documentation example"

4 years agoInclude PostgreSQL in trigger test and correct documentation example
RamonWill [Sun, 30 Aug 2020 13:05:06 +0000 (09:05 -0400)] 
Include PostgreSQL in trigger test and correct documentation example

Include PostgreSQL dialect in trigger test and correct DDL example in documentation

A user highlighted that the syntax in the DDL trigger example was incorrect for PostgreSQL. The trigger tests where also skipping the PostgreSQL dialect until the syntax was corrected. This PR fixes both of these issues.

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!**
Fixes: #4037
Closes: #5548
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5548
Pull-request-sha: 1db5e47adb90f9d51e247711dcfdbb274fb7bf73

Change-Id: I06edbcab99c82a3ce25581b81f8d2a4a028c07c3

4 years agoFix AsyncEngine connect() bug when pool is exhausted
Fantix King [Mon, 31 Aug 2020 07:41:00 +0000 (03:41 -0400)] 
Fix AsyncEngine connect() bug when pool is exhausted

### Description

Decorating the referenced `await_fallback` with `staticmethod` would stop `AsyncAdaptedQueue.await_` from being treated as a bound method.

### Checklist

This pull request is:

- [x] A short code fix
    Fixes #5546

**Have a nice day!**

Closes: #5547
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5547
Pull-request-sha: 6f18ee290e7d9fe24ce2a4a4ed8069b46082ca18

Change-Id: Ie335ee650f1dee0d1fce59e448217a48307b3435

4 years agoSupport extra / single inh criteria with ORM update/delete
Mike Bayer [Sun, 30 Aug 2020 22:13:36 +0000 (18:13 -0400)] 
Support extra / single inh criteria with ORM update/delete

The ORM bulk update and delete operations, historically available via the
:meth:`_orm.Query.update` and :meth:`_orm.Query.delete` methods as well as
via the :class:`_dml.Update` and :class:`_dml.Delete` constructs for
:term:`2.0 style` execution, will now automatically accommodate for the
additional WHERE criteria needed for a single-table inheritance
discrminiator.   Joined-table inheritance is still not directly
supported. The new :func:`_orm.with_loader_criteria` construct is also
supported for all mappings with bulk update/delete.

Fixes: #5018
Fixes: #3903
Change-Id: Id90827cc7e2bc713d1255127f908c8e133de9295

4 years agoAdd new MySQL reserved words: `cube`, `lateral`.
StefanosChaliasos [Thu, 27 Aug 2020 17:53:35 +0000 (13:53 -0400)] 
Add new MySQL reserved words: `cube`, `lateral`.

Closes: #5539
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5539
Pull-request-sha: 8c228be322023041b11691d93dafa1be090f01a0

Change-Id: Ic756472a19563e793cf7e33b24eb1ad5e913dbc0

4 years agoMerge "internal test framework files for standardization of is_not/not_in;"
mike bayer [Sun, 30 Aug 2020 14:33:08 +0000 (14:33 +0000)] 
Merge "internal test framework files for standardization of is_not/not_in;"

4 years agoUpdate connection docs for migrating off of nesting
Mike Bayer [Sat, 29 Aug 2020 18:32:20 +0000 (14:32 -0400)] 
Update connection docs for migrating off of nesting

Change-Id: I3a81140f00a4a9945121bfb8ec4c0e3953b4085f

4 years agointernal test framework files for standardization of is_not/not_in;
jonathan vanasco [Mon, 24 Aug 2020 22:53:31 +0000 (18:53 -0400)] 
internal test framework files for standardization of is_not/not_in;

this is safe for 1.3.x

Change-Id: Icba38fdc20f5d8ac407383a4278ccb346e09af38

4 years agoSee if the future is here
Mike Bayer [Fri, 28 Aug 2020 21:56:43 +0000 (17:56 -0400)] 
See if the future is here

The docs are going to talk a lot about session.execute(select())
for ORM queries, and additionally it's much easier to help
users with queries and such if we can use this new syntax.
I'm hoping to see how hard it is to get a unified tutorial
started that switches to new syntax.  Basically, new syntax
is much easier to explain and less buggy.   But, if we
are starting to present new syntax with the explicit goal
of being easier to explain for less experienced programmers,
the "future" thing is going to just be an impediment
to that.

See if we can remove "future" from session.execute(),
so that ORM-enabled select() statements return ORM results
at that level.  This does not change the presence of the
"future" flag for the Session's construction and for its
transactional behaviors.

The only perceptible change of the future flag for
session.execute() is that session.execute(select()) where the
statement has ORM entities in it now returns ORM new
style tuples rather than old style tuples.   Like
mutating a URL, it's hopefully not very common that people
are doing this.

Change-Id: I0aa10322bb787d554d32772e3bc60548f1bf6206

4 years agoMerge "Emit v2.0 deprecation warning for "implicit autocommit""
mike bayer [Fri, 28 Aug 2020 21:45:51 +0000 (21:45 +0000)] 
Merge "Emit v2.0 deprecation warning for "implicit autocommit""

4 years agoEmit v2.0 deprecation warning for "implicit autocommit"
Gord Thompson [Fri, 21 Aug 2020 16:29:29 +0000 (10:29 -0600)] 
Emit v2.0 deprecation warning for "implicit autocommit"

"Implicit autocommit", which is the COMMIT that occurs when a DML or DDL
statement is emitted on a connection, is deprecated and won't be part of
SQLAlchemy 2.0.   A 2.0-style warning is emitted when autocommit takes
effect, so that the calling code may be adjusted to use an explicit
transaction.

As part of this change, DDL methods such as
:meth:`_schema.MetaData.create_all` when used against a
:class:`_engine.Engine` or :class:`_engine.Connection` will run the
operation in a BEGIN block if one is not started already.

The MySQL and MariaDB dialects now query from the information_schema.tables
system view in order to determine if a particular table exists or not.
Previously, the "DESCRIBE" command was used with an exception catch to
detect non-existent,  which would have the undesirable effect of emitting a
ROLLBACK on the connection. There appeared to be legacy encoding issues
which prevented the use of "SHOW TABLES", for this, but as MySQL support is
now at 5.0.2  or above due to :ticket:`4189`, the information_schema tables
are now available in all cases.

Fixes: #4846
Change-Id: I733a7e0e17477a63607fb9931c87c393bbd7ac57

4 years agoMerge "ARM64 Support to Github Actions For Testing And Development Of Wheels"
Federico Caselli [Fri, 28 Aug 2020 20:25:12 +0000 (20:25 +0000)] 
Merge "ARM64 Support to Github Actions For Testing And Development Of Wheels"

4 years agoMerge "Update authors file"
mike bayer [Fri, 28 Aug 2020 14:06:43 +0000 (14:06 +0000)] 
Merge "Update authors file"

4 years agoUpdate authors file
Federico Caselli [Thu, 20 Aug 2020 20:42:28 +0000 (22:42 +0200)] 
Update authors file

Add all authors with more than 10 commits. The email are
omitted to avoid possible spam (even if they
are not private since they are in the git history, they
are at least not grep friendly)

Output obtained by `git shortlog --summary | sort -r`

Change-Id: Ib364763b755c84e7980dfe9687cada7d2bbd1f63

4 years agoMerge "Add support for regular expression on supported backend."
mike bayer [Thu, 27 Aug 2020 22:28:39 +0000 (22:28 +0000)] 
Merge "Add support for regular expression on supported backend."

4 years agoAdd support for regular expression on supported backend.
Federico Caselli [Thu, 16 Jul 2020 19:32:52 +0000 (21:32 +0200)] 
Add support for regular expression on supported backend.

Two operations have been defined:

* :meth:`~.ColumnOperators.regexp_match` implementing a regular
  expression match like function.
* :meth:`~.ColumnOperators.regexp_replace` implementing a regular
  expression string replace function.

Fixes: #1390
Change-Id: I44556846e4668ccf329023613bd26861d5c674e6

4 years agoRaise NotImplemenedError for association proxy __clause_element__
Mike Bayer [Thu, 27 Aug 2020 19:50:47 +0000 (15:50 -0400)] 
Raise NotImplemenedError for association proxy __clause_element__

It's not possible right now to use an association proxy element as a plain
column expression to be SELECTed from or used in a SQL function.  An
informative error is now raised when this occurs.

Fixes: #5542
Change-Id: I334e767ebc0b56c1dccc4a1e5185b0435af77b93

4 years agoDocument caveat about backrefs and attribute_mapped_collection
Mike Bayer [Wed, 26 Aug 2020 15:44:34 +0000 (11:44 -0400)] 
Document caveat about backrefs and attribute_mapped_collection

Fixes: #5538
Change-Id: I2bda6bed40d35560a71bf0ed09d141047ce59e82

4 years agoMerge "make URL immutable"
mike bayer [Wed, 26 Aug 2020 02:44:17 +0000 (02:44 +0000)] 
Merge "make URL immutable"

4 years agoMerge "More descriptive error for non-mapped string prop name"
mike bayer [Wed, 26 Aug 2020 02:43:32 +0000 (02:43 +0000)] 
Merge "More descriptive error for non-mapped string prop name"

4 years agomake URL immutable
Mike Bayer [Fri, 21 Aug 2020 18:44:04 +0000 (14:44 -0400)] 
make URL immutable

it's not really correct that URL is mutable and doesn't do
any argument checking.   propose replacing it with an immutable
named tuple with rich copy-and-mutate methods.

At the moment this makes a hard change to the CreateEnginePlugin
docs that previously recommended url.query.pop().  I can't find
any plugins on github other than my own that are using this
feature, so see if we can just make a hard change on this one.

Fixes: #5526
Change-Id: I28a0a471d80792fa8c28f4fa573d6352966a4a79

4 years agoMerge "Updates for MariaDB sequences"
mike bayer [Tue, 25 Aug 2020 22:14:19 +0000 (22:14 +0000)] 
Merge "Updates for MariaDB sequences"

4 years agoMore descriptive error for non-mapped string prop name
jonathan vanasco [Mon, 20 Apr 2020 17:56:49 +0000 (13:56 -0400)] 
More descriptive error for non-mapped string prop name

Fixed issue where using a loader option against a string attribute name
that is not actually a mapped attribute, such as a plain Python descriptor,
would raise an uninformative AttributeError;  a descriptive error is now
raised.

Fixes: #4589
Closes: #4594
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4594
Pull-request-sha: 2b7ed5240f49be90f9390e3d041c9cb957083465

Change-Id: I66b9937991eb7cdbe074a92f490af1c80d16449e

4 years agoMerge "Improve docs of Identity columns."
mike bayer [Mon, 24 Aug 2020 22:46:12 +0000 (22:46 +0000)] 
Merge "Improve docs of Identity columns."

4 years agoARM64 Support to Github Actions For Testing And Development Of Wheels
odidev [Sun, 23 Aug 2020 18:54:56 +0000 (14:54 -0400)] 
ARM64 Support to Github Actions For Testing And Development Of Wheels

**Added**:
1. ARM64 jobs in Github Workflows For Testing And Development Of Wheels
2. Two script files for creating wheels and testing.

Resolves #5436

Signed-off-by: odidev <odidev@puresoftware.com>
Co-authored-by: Federico Caselli <cfederico87@gmail.com>
Closes: #5480
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5480
Pull-request-sha: 131ef520bbf863ad9b65ca3bf3c2d2d214405702

Change-Id: Ia10dadd93365ba4beeefbd27c060bc077c2d7aeb

4 years agoFix typo in docs examples of psycopg2.connect
Federico Caselli [Mon, 24 Aug 2020 21:05:10 +0000 (23:05 +0200)] 
Fix typo in docs examples of psycopg2.connect

Fixes: #5535
Change-Id: I7341137ec63c5a7978f9fe15ad1a932e068321c2

4 years agoImprove docs of Identity columns.
Federico Caselli [Mon, 24 Aug 2020 19:13:49 +0000 (21:13 +0200)] 
Improve docs of Identity columns.

Change-Id: Iba85ac3c2c9f40878768d74a5dd33083fc68e504

4 years agoAdd deprecation warning for mssql legacy_schema_aliasing
Gord Thompson [Thu, 20 Aug 2020 22:26:13 +0000 (16:26 -0600)] 
Add deprecation warning for mssql legacy_schema_aliasing

Fixes: #4809
Change-Id: I9ce2a5dfb79d86624c187ee28b5911fd14328ce2

4 years agoUpdates for MariaDB sequences
Federico Caselli [Fri, 21 Aug 2020 22:30:44 +0000 (00:30 +0200)] 
Updates for MariaDB sequences

MariaDB should not run a Sequence if it has optional=True.
Additionally, rework the rules in crud.py to accommodate the
new combination MariaDB brings us, which is a dialect
that supports both cursor.lastrowid, explicit sequences,
*and* no support for returning.

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

4 years agoMerge "Add support for identity columns"
mike bayer [Fri, 21 Aug 2020 21:39:40 +0000 (21:39 +0000)] 
Merge "Add support for identity columns"

4 years agoMerge "Raise UnmappedInstanceError if the attribute of a database object is an unmapp...
mike bayer [Thu, 20 Aug 2020 19:24:12 +0000 (19:24 +0000)] 
Merge "Raise UnmappedInstanceError if the attribute of a database object is an unmapped object."

4 years agoMerge "normalize execute style for events, 2.0"
mike bayer [Thu, 20 Aug 2020 15:22:08 +0000 (15:22 +0000)] 
Merge "normalize execute style for events, 2.0"

4 years agonormalize execute style for events, 2.0
Mike Bayer [Wed, 19 Aug 2020 16:08:26 +0000 (12:08 -0400)] 
normalize execute style for events, 2.0

The _execute_20 and exec_driver_sql methods should wrap
up the parameters so that they represent the single list / single
dictionary style of invocation into the legacy methods.  then
the before_ after_ execute event handlers should be receiving
the parameter dictionary as a single dictionary.   this requires
that we break out distill_params to work differently if event
handlers are present.

additionally, add deprecation warnings for old argument passing
styles.

Change-Id: I97cb4d06adfcc6b889f10d01cc7775925cffb116

4 years agoMerge "Implement DDL visitor for PG ENUM with schema translate support"
mike bayer [Wed, 19 Aug 2020 17:38:07 +0000 (17:38 +0000)] 
Merge "Implement DDL visitor for PG ENUM with schema translate support"

4 years agoMerge "Add JSON support for mssql"
mike bayer [Wed, 19 Aug 2020 17:25:06 +0000 (17:25 +0000)] 
Merge "Add JSON support for mssql"

4 years agoAdd JSON support for mssql
Gord Thompson [Sat, 1 Aug 2020 21:56:12 +0000 (15:56 -0600)] 
Add JSON support for mssql

Added support for the :class:`_types.JSON` datatype on the SQL Server
dialect using the :class:`_mssql.JSON` implementation, which implements SQL
Server's JSON functionality against the ``NVARCHAR(max)`` datatype as per
SQL Server documentation. Implementation courtesy Gord Thompson.

Fixes: #4384
Change-Id: I28af79a4d8fafaa68ea032228609bba727784f18

4 years agoImplement DDL visitor for PG ENUM with schema translate support
Mike Bayer [Wed, 19 Aug 2020 02:53:09 +0000 (22:53 -0400)] 
Implement DDL visitor for PG ENUM with schema translate support

Fixed issue where the :class:`_postgresql.ENUM` type would not consult the
schema translate map when emitting a CREATE TYPE or DROP TYPE during the
test to see if the type exists or not.  Additionally, repaired an issue
where if the same enum were encountered multiple times in a single DDL
sequence, the "check" query would run repeatedly rather than relying upon a
cached value.

Fixes: #5520
Change-Id: I79f46e29ac0168e873ff178c242f8d78f6679aeb

4 years agoAdd support for identity columns
Federico Caselli [Sat, 30 May 2020 12:45:00 +0000 (14:45 +0200)] 
Add support for identity columns

Added the :class:`_schema.Identity` construct that can be used to
configure identity columns rendered with GENERATED { ALWAYS |
BY DEFAULT } AS IDENTITY. Currently the supported backends are
PostgreSQL >= 10, Oracle >= 12 and MSSQL (with different syntax
and a subset of functionalities).

Fixes: #5362
Fixes: #5324
Fixes: #5360
Change-Id: Iecea6f3ceb36821e8b96f0b61049b580507a1875

4 years agoSupport data types for CREATE SEQUENCE in PostgreSQL
Federico Caselli [Fri, 7 Aug 2020 20:38:24 +0000 (22:38 +0200)] 
Support data types for CREATE SEQUENCE in PostgreSQL

Allow specifying the data type when creating a :class:`.Sequence` in
PostgreSQL by using the parameter :paramref:`.Sequence.data_type`.

Fixes: #5498
Change-Id: I2b4a80aa89b1503c56748dc3ecd2cf145faddd8b

4 years agoMerge "Deliver straight BinaryExpr w/ no negate for any() / all()"
mike bayer [Tue, 18 Aug 2020 19:07:19 +0000 (19:07 +0000)] 
Merge "Deliver straight BinaryExpr w/ no negate for any() / all()"

4 years agoDeliver straight BinaryExpr w/ no negate for any() / all()
Mike Bayer [Tue, 18 Aug 2020 18:17:06 +0000 (14:17 -0400)] 
Deliver straight BinaryExpr w/ no negate for any() / all()

Adjusted the :meth:`_types.ARRAY.Comparator.any` and
:meth:`_types.ARRAY.Comparator.all` methods to implement a straight "NOT"
operation for negation, rather than negating the comparison operator.

Fixes: #5518
Change-Id: I87ee9278c321aafe51a679fcfcbb5fbb11307fda