]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoSupport pytest 6.x
Mike Bayer [Sun, 27 Sep 2020 01:01:01 +0000 (21:01 -0400)] 
Support pytest 6.x

pytest has removed support for pytest.Class().collect()
and we need to use from_parent.

Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4

4 years agoformatting fixes, some content addition
Mike Bayer [Fri, 25 Sep 2020 04:10:04 +0000 (00:10 -0400)] 
formatting fixes, some content addition

Change-Id: I807f9763252cdb18ba8702cf42fdb2a7d4c72b52

4 years agoMerge "new docs WIP"
mike bayer [Fri, 25 Sep 2020 03:19:21 +0000 (03:19 +0000)] 
Merge "new docs WIP"

4 years agonew docs WIP
Mike Bayer [Thu, 17 Sep 2020 22:15:42 +0000 (18:15 -0400)] 
new docs WIP

This WIP is part of the final push for 1.4's docs
to fully "2.0-ize" what we can, and have it all ready.

So far this includes a rewrite of the 2.0 migration,
set up for the 1.4 /2.0 docs style, and a total redesign
of the index page using a new flex layout in zzzeeksphinx.

It also reworks some of the API reference sections
to have more subheaders.   zzzeeksphinx is also enhanced
to provide automatic summaries for all api doc section.

Change-Id: I01d360cb9c8749520246b96ee6496143c6037918

4 years agoMerge "Improve Asyncpg json handling"
mike bayer [Thu, 24 Sep 2020 02:19:18 +0000 (02:19 +0000)] 
Merge "Improve Asyncpg json handling"

4 years agoImprove Asyncpg json handling
Federico Caselli [Mon, 21 Sep 2020 17:59:00 +0000 (19:59 +0200)] 
Improve Asyncpg json handling

Set default type codec for ``json`` and ``jsonb`` types when using
the asyncpg driver. By default asyncpg will not decode them and return
strings instead.

Fixes: #5584
Change-Id: I41348eff8096ccf87b952d7e797c0694c6c4b5c4

4 years agoAdd pypi shields
Mike Bayer [Wed, 23 Sep 2020 18:47:43 +0000 (14:47 -0400)] 
Add pypi shields

These are all available from the same shields.io source,
courtesy @dolfinus

Fixes: #5594
Change-Id: I985c415f50627d328384a8fddf9a1457663ee00d

4 years agotry out the github stale hook.
Mike Bayer [Wed, 23 Sep 2020 16:04:18 +0000 (12:04 -0400)] 
try out the github stale hook.

This will mark an issue with the "stale" label after
5 days and close after 7.

The goal is that it will mark "question" issues as stale
automatically.

it doesn't give us a way to link it to that label however,
and we have to define it in terms of labels to exclude.

Change-Id: I7c34f4e8fdf4ee0a15baa93b5831e5cdcf72dcc8

4 years agoMerge "Deprecate negative slice indexes"
mike bayer [Tue, 22 Sep 2020 19:47:21 +0000 (19:47 +0000)] 
Merge "Deprecate negative slice indexes"

4 years agoMerge "Tweak docker config for mssql"
mike bayer [Tue, 22 Sep 2020 19:00:06 +0000 (19:00 +0000)] 
Merge "Tweak docker config for mssql"

4 years agoDeprecate negative slice indexes
Mike Bayer [Tue, 22 Sep 2020 14:26:35 +0000 (10:26 -0400)] 
Deprecate negative slice indexes

The "slice index" feature used by :class:`_orm.Query` as well as by the
dynamic relationship loader will no longer accept negative indexes in
SQLAlchemy 2.0.  These operations do not work efficiently and load the
entire collection in, which is both surprising and undesirable.   These
will warn in 1.4 unless the :paramref:`_orm.Session.future` flag is set in
which case they will raise IndexError.

Fixes: #5606
Change-Id: I5f5dcf984a8f41ab3d0e233ef7553e77fd99a771

4 years agoExpect collected weak reference in ORM listener
Mike Bayer [Tue, 22 Sep 2020 13:00:44 +0000 (09:00 -0400)] 
Expect collected weak reference in ORM listener

CI is showing that this listener may be triggered
when the target, a mapped class, has been garbage collected.

I'm not able to reproduce this locally.

Change-Id: Iad96c088a9a3dc28c4bcd716e293c03d3b312efd

4 years agoMerge "restore slice methods to dynamic query"
mike bayer [Tue, 22 Sep 2020 01:54:52 +0000 (01:54 +0000)] 
Merge "restore slice methods to dynamic query"

4 years agorestore slice methods to dynamic query
Mike Bayer [Tue, 22 Sep 2020 00:17:04 +0000 (20:17 -0400)] 
restore slice methods to dynamic query

in f0f08db5715e41cc08e57dbc76a85300b these got
lost, put them back and test

Change-Id: Id1962e1f5d6160fe222becec5a8e32ec6a40017a

4 years agoRaise if unique() not applied to 2.0 joined eager load results
Mike Bayer [Mon, 21 Sep 2020 21:28:03 +0000 (17:28 -0400)] 
Raise if unique() not applied to 2.0 joined eager load results

The automatic uniquing of rows on the client side is turned off for the new
:term:`2.0 style` of ORM querying.  This improves both clarity and
performance.  However, uniquing of rows on the client side is generally
necessary when using joined eager loading for collections, as there
will be duplicates of the primary entity for each element in the
collection because a join was used.  This uniquing must now be manually
enabled and can be achieved using the new
:meth:`_engine.Result.unique` modifier.   To avoid silent failure, the ORM
explicitly requires the method be called when the result of an ORM
query in 2.0 style makes use of joined load collections.    The newer
:func:`_orm.selectinload` strategy is likely preferable for eager loading
of collections in any case.

This changeset also fixes an issue where ORM-style "single entity"
results would not apply unique() correctly if results were returned
as tuples.

Fixes: #4395
Change-Id: Ie62e0cb68ef2a6d2120e968b79575a70d057212e

4 years agoTweak docker config for mssql
Gord Thompson [Sun, 20 Sep 2020 20:43:33 +0000 (14:43 -0600)] 
Tweak docker config for mssql

Change-Id: Iae6fca41976f9cd7a3870f18eadfbea146d572dd

4 years agoMerge "Stringify correctly for non-str exception argument"
mike bayer [Sun, 20 Sep 2020 19:01:53 +0000 (19:01 +0000)] 
Merge "Stringify correctly for non-str exception argument"

4 years agoStringify correctly for non-str exception argument
Andrzej Bartosiński [Sat, 19 Sep 2020 16:47:46 +0000 (12:47 -0400)] 
Stringify correctly for non-str exception argument

Fixed issue where a non-string object sent to
:class:`_exc.SQLAlchemyError` or a subclass, as occurs with some third
party dialects, would fail to stringify correctly. Pull request
courtesy Andrzej Bartosiński.

Fixes: #5599
Closes: #5600
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5600
Pull-request-sha: cdccccc42a6ac8de771593a43ee8675bfd8dbeb6

Change-Id: Icd710d9015abc80f61a84893d75fbb33ee0fe46e

4 years agoFix has_table() for mssql temporary tables
Gord Thompson [Fri, 18 Sep 2020 22:33:17 +0000 (16:33 -0600)] 
Fix has_table() for mssql temporary tables

Fixes: #5597
Fixes the issue where :meth:`_reflection.has_table` always returns
``False`` for temporary tables.

Change-Id: I03ab04c849a157ce8fd28c07ec3bf4407b0f2c94

4 years agoMerge "Complete deprecation of from_self()"
mike bayer [Sat, 19 Sep 2020 03:10:47 +0000 (03:10 +0000)] 
Merge "Complete deprecation of from_self()"

4 years agoComplete deprecation of from_self()
Mike Bayer [Fri, 18 Sep 2020 17:29:42 +0000 (13:29 -0400)] 
Complete deprecation of from_self()

For most from_self() tests, move them into
test/orm/test_deprecated.py and replace the existing
test with one that uses aliased() plus a subquery.
This then revealed a few more issues.

Related items:

* Added slice() method to GenerativeSelect, to match that
  of orm.Query and to make possible migration of one of the
  from_self() tests.  moved the utility functions used for this
  from orm/util into sql/util.

* repairs a caching issue related to subqueryload
  where information being derived from the cached path info
  was mixing up with query information based on the per-query
  state, specifically an AliasedClass that is per query.

* for the above issue, it seemed like path_registry maybe
  had to change so that it represents AliasedClass objects
  as their cache key rather than on identity, but it wasn't
  needed.  still seems like it would be more correct.

* enhances the error message raised by coercions for a case
  such as when an AliasedClass holds onto a select() object
  and not a subquery(); will name the original and resolved
  object for clarity  (although how is AliasedClass able to
  accept a Select() object in the first place?)

* Added _set_propagate_attrs() to Query so that again if
  it's passed to AliasedClass, it doesn't raise an error
  during coercion, but again maybe that should also be
  rejected up front

Fixes: #5368
Change-Id: I5912aa611d899acc87a75eb5ee9f95990592f210

4 years agoAdd support for Azure authentication options
Gord Thompson [Thu, 17 Sep 2020 16:32:31 +0000 (10:32 -0600)] 
Add support for Azure authentication options

Fixes: #5592
Change-Id: I0688e5ea0fc6b01a0b72f397daea8f57a2ec0766

4 years agoMerge "Create a framework to allow all SQLALCHEMY_WARN_20 to pass"
mike bayer [Wed, 16 Sep 2020 18:45:51 +0000 (18:45 +0000)] 
Merge "Create a framework to allow all SQLALCHEMY_WARN_20 to pass"

4 years agoCreate a framework to allow all SQLALCHEMY_WARN_20 to pass
Mike Bayer [Mon, 17 Aug 2020 21:24:27 +0000 (17:24 -0400)] 
Create a framework to allow all SQLALCHEMY_WARN_20 to pass

As the test suite has widespread use of many patterns
that are deprecated, enable SQLALCHEMY_WARN_20 globally
for the test suite but then break the warnings filter
out into a whole list of all the individual warnings
we are looking for.  this way individual changesets
can target a specific class of warning, as many of these
warnings will indivdidually affect dozens of files
and potentially hundreds of lines of code.

Many warnings are also resolved here as this
patch started out that way.   From this point
forward there should be changesets that target a
subset of the warnings at a time.

For expediency, updates some migration 2.0 docs
for ORM as well.

Change-Id: I98b8defdf7c37b818b3824d02f7668e3f5f31c94

4 years agoDon't change asyncpg's "char" codec
Mike Bayer [Wed, 16 Sep 2020 12:26:14 +0000 (08:26 -0400)] 
Don't change asyncpg's "char" codec

This codec was used to ensure the "pg_attribute.generated"
column comes back as a string and not bytes, matching how
other PG drivers treat this datatype.   However, this breaks
asyncpg's internal implementation of set_type_codec going forward
and the "char" datatype is actually a bytes in any case.
So at the moment it appears psycopg2/pg8000 are broken for mis-treatment
of the datatype and asyncpg is broken in that it was allowing
us to change a codec that it appears to rely upon internally.

Fixes: #5586
Change-Id: I937eba315904721aa4e2726b95432910a8affe5f

4 years agoMerge "Fix ORM gc-related test that seems to be failing on CI"
mike bayer [Wed, 16 Sep 2020 14:43:40 +0000 (14:43 +0000)] 
Merge "Fix ORM gc-related test that seems to be failing on CI"

4 years agoFix ORM gc-related test that seems to be failing on CI
Mike Bayer [Wed, 16 Sep 2020 13:50:25 +0000 (09:50 -0400)] 
Fix ORM gc-related test that seems to be failing on CI

The test relied on the primary key value not being
of a certain number.

Change-Id: I9bd76bee542da44b630a426f1102fc682ad2d7b3

4 years agoMerge "Make :class:`_orm.registry` ``bind`` a private parameter."
mike bayer [Wed, 16 Sep 2020 14:18:59 +0000 (14:18 +0000)] 
Merge "Make :class:`_orm.registry` ``bind`` a private parameter."

4 years agoMerge "Correct for SQL Server temp table owner"
mike bayer [Wed, 16 Sep 2020 01:27:05 +0000 (01:27 +0000)] 
Merge "Correct for SQL Server temp table owner"

4 years agoCorrect for SQL Server temp table owner
Mike Bayer [Tue, 15 Sep 2020 22:48:36 +0000 (18:48 -0400)] 
Correct for SQL Server temp table owner

on my machine, the owner for a temp table comes out as
dbo, and i am testing against a CI machine.  im not sure
what happens on a CI machine except perhaps that it provisions
new databases is changing things.   in any case, since we
are searching the tempdb for the name, get the schema/owner also.

Also refines the test to use a single connection and a transaction
that rolls back, doesn't hang here but let's see what CI does.

Change-Id: I522596ccc526cdab14c516b9a566ff666ac57dd6

4 years agoMake :class:`_orm.registry` ``bind`` a private parameter.
Federico Caselli [Mon, 14 Sep 2020 21:36:14 +0000 (23:36 +0200)] 
Make :class:`_orm.registry` ``bind`` a private parameter.

Explicitly deprecate ``bind`` from :func:`_orm.declarative_base`
and :func:`_orm.as_declarative`.

Some other documentation cleanup on declarative documentation.

Change-Id: I3f7918d23833b2778ab7009ac5018841deb19f75

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""