]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agocapitalize author name 5742/head
toh995 [Thu, 3 Dec 2020 02:28:55 +0000 (18:28 -0800)] 
capitalize author name

4 years agomodernize contains_eager() docs
Mike Bayer [Wed, 2 Dec 2020 14:26:18 +0000 (09:26 -0500)] 
modernize contains_eager() docs

Along with other loader options that are likely
to require usage of populate_existing(), make sure
contains_eager() documentation makes it absolutely
clear that already-loaded collections are not overwritten.
consolidate contains_eager() documentation into the narrative docs.

Additionally, remove the "arbitrary statements" section, this is
not a useful case and seems to be left over.

Fixes: #5740
Change-Id: I10e320882990f511eefebcc88cfcc2277e553b50

4 years agoMerge remote-tracking branch 'origin/pr/5733' into master
Mike Bayer [Wed, 2 Dec 2020 03:48:40 +0000 (22:48 -0500)] 
Merge remote-tracking branch 'origin/pr/5733' into master

Change-Id: I7ae5498618fbe9e63440a59243a31f2633777bbd

4 years agoMake sure asyncpgfallback has __slots__
Mike Bayer [Wed, 2 Dec 2020 01:55:06 +0000 (20:55 -0500)] 
Make sure asyncpgfallback has __slots__

the test suite failed to find that we started accessing
a non-existent slot "_isolation_setting" added by me in
9b779611f9, as the test suite makes use of the
AsyncAdaptFallback_asyncpg_connection subclass, which didn't
include __slots__ and therefore didn't catch that
_isolation_setting wasn't added to slots.

Fixes: #5739
Change-Id: Ibbbedc2ee0f1d1c9d91ba7898d755812deccb380

4 years agoPass along other keyword args in _EventsHold.populate
Mike Bayer [Tue, 1 Dec 2020 21:03:35 +0000 (16:03 -0500)] 
Pass along other keyword args in _EventsHold.populate

Fixed bug involving the ``restore_load_context`` option of ORM events such
as :meth:`_orm.InstanceEvents.load` such that the flag would not be carried
along to subclasses which were mapped after the event handler were first
established.

Fixes: #5737
Change-Id: Ie65fbeac7ab223d24993cff0b34094d4928ff113

4 years agoMerge "improve cross-linking between Core /ORM for schema arg"
mike bayer [Tue, 1 Dec 2020 00:41:09 +0000 (00:41 +0000)] 
Merge "improve cross-linking between Core /ORM for schema arg"

4 years agoimprove cross-linking between Core /ORM for schema arg
Mike Bayer [Mon, 16 Nov 2020 19:57:36 +0000 (14:57 -0500)] 
improve cross-linking between Core /ORM for schema arg

this should be backported to 1.3 as well to as much a degree
as possible.

Includes a new recipe to set the default schema name
on connect.   this will only work on 1.4, but also requires
that we fix #5708 for it to work fully.

Change-Id: I882edd5bbe06ee5b4d0a9c148854a57b2bcd4741

4 years agoDisallow bug reports based on flask and others
Mike Bayer [Mon, 30 Nov 2020 16:45:18 +0000 (11:45 -0500)] 
Disallow bug reports based on flask and others

I don't have time to rewrite test cases to not use
these systems.

Change-Id: I76aeec67f97749da1caf2ccfa7d21c27bff51ab0

4 years agoremove duplicate author 5733/head
toh995 [Sun, 29 Nov 2020 21:42:01 +0000 (13:42 -0800)] 
remove duplicate author

4 years agoMerge "Don't discard leftovers from surface_selectables"
mike bayer [Fri, 27 Nov 2020 18:04:13 +0000 (18:04 +0000)] 
Merge "Don't discard leftovers from surface_selectables"

4 years agoMerge "Support Column objects in the SET clause for upsert"
mike bayer [Thu, 26 Nov 2020 17:36:41 +0000 (17:36 +0000)] 
Merge "Support Column objects in the SET clause for upsert"

4 years agoUse String for PostgreSQL xmin example
Mike Bayer [Thu, 26 Nov 2020 17:28:19 +0000 (12:28 -0500)] 
Use String for PostgreSQL xmin example

Fixes: #5728
Change-Id: I1efd6296018a80470b8c215b225898bbfea742a8

4 years agoDon't discard leftovers from surface_selectables
Mike Bayer [Thu, 26 Nov 2020 17:10:25 +0000 (12:10 -0500)] 
Don't discard leftovers from surface_selectables

Fixed regression introduced in 1.3.2 for the PostgreSQL dialect, also
copied out to the MySQL dialect's feature in 1.3.18, where usage of a non
:class:`_schema.Table` construct such as :func:`_sql.text` as the argument
to :paramref:`_sql.Select.with_for_update.of` would fail to be accommodated
correctly within the PostgreSQL or MySQL compilers.

Fixes: #5729
Change-Id: I265bcc171f0eb865ac3910ee805b162f3b70e2c1

4 years agoMerge "Fix typo in sessionmaker example: s/wih/with"
mike bayer [Thu, 26 Nov 2020 16:32:31 +0000 (16:32 +0000)] 
Merge "Fix typo in sessionmaker example: s/wih/with"

4 years agoFix typo in sessionmaker example: s/wih/with
Brendan McCollam [Thu, 26 Nov 2020 16:04:42 +0000 (11:04 -0500)] 
Fix typo in sessionmaker example: s/wih/with

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

### Description
Fix typo in sessionmaker documentation example: s/wih/with

### 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: #5730
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5730
Pull-request-sha: 2759eefbf32862be464ecd5b1e91163c7773df39

Change-Id: I6226802a598e53f12dbdb97470deaa0f47789faf

4 years agoTypo in sessionmaker example: s/wih/with 5730/head
Brendan McCollam [Thu, 26 Nov 2020 15:26:07 +0000 (15:26 +0000)] 
Typo in sessionmaker example: s/wih/with

4 years agoSupport Column objects in the SET clause for upsert
Mike Bayer [Tue, 24 Nov 2020 01:13:20 +0000 (20:13 -0500)] 
Support Column objects in the SET clause for upsert

Established support for :class:`_schema.Column` objects as well as ORM
instrumented attributes as keys in the ``set_`` dictionary passed to the
:meth:`_postgresql.Insert.on_conflict_do_update` and
:meth:`_sqlite.Insert.on_conflict_do_update` methods, which match to the
:class:`_schema.Column` objects in the ``.c`` collection of the target
:class:`_schema.Table`. Previously,  only string column names were
expected; a column expression would be assumed to be an out-of-table
expression that would render fully along with a warning.

Fixes: #5722
Change-Id: Ice73b501d721c28d978a0277a83cedc6aff756a9

4 years agoensure utf-8 used for opening tutorial files
Mike Bayer [Tue, 24 Nov 2020 00:09:48 +0000 (19:09 -0500)] 
ensure utf-8 used for opening tutorial files

python 3.6 on CI seems to be using ascii encoding for some reason.

Change-Id: Ic6881f28201eb2c186a0119dcd843a76f486971d

4 years agoMerge "Add summary table for orm 2.0 migration"
mike bayer [Sun, 22 Nov 2020 22:28:23 +0000 (22:28 +0000)] 
Merge "Add summary table for orm 2.0 migration"

4 years agoAdd summary table for orm 2.0 migration
Federico Caselli [Tue, 10 Nov 2020 22:13:55 +0000 (23:13 +0100)] 
Add summary table for orm 2.0 migration

A new formatting option is added to zzzeeksphinx
to allow the table to slide for horizontal overflow
without blowing up the page.   overall though trying
to keep the table narrow as the code examples are side by
side, other configurations didn't work as well.

Change-Id: Ia2c6cf8b81dd2bf9989a0fcbec4ce6ece08c568f

4 years agoQueuePool: support subsecond timeout
Jordan Pittier [Wed, 18 Nov 2020 14:57:43 +0000 (09:57 -0500)] 
QueuePool: support subsecond timeout

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

### Description
Make it explicit in the documentation and in the default value for the 'timeout'
parameter that `timeout` can be a float. Because Python timing is not
very accurate, warn about the precision.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #5710
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5710
Pull-request-sha: 5f4eef8b4aba756d32e14ea41f71ef2919c26b84

Change-Id: I462524b1624ca5cc76d083a1d58e5dc89501c1a9

4 years agoMerge "Don't emit warnings on descriptor access"
mike bayer [Fri, 20 Nov 2020 19:41:50 +0000 (19:41 +0000)] 
Merge "Don't emit warnings on descriptor access"

4 years agoDon't emit warnings on descriptor access
Mike Bayer [Fri, 20 Nov 2020 15:12:18 +0000 (10:12 -0500)] 
Don't emit warnings on descriptor access

This commit is revising 5162f2bc5fc0ac239f26a76fc9f0c2, which
when I did it felt a little rushed but I couldn't find anything
wrong.  Well here we are :).

Fixed issue where a :class:`.RemovedIn20Warning` would erroneously emit
when the ``.bind`` attribute were accessed internally on objects,
particularly when stringifying a SQL construct.

Alter the deprecated() decorator so that we can use it just to add
docstring warnings but not actually warn when the function is
accessed, adding new argument enable_warnings that can be
set to False.

Added a safety feature to deprecated_20() that will disallow an
":attr:" from proceeding if enable_warnings=False isn't present,
unless there's an extra flag
warn_on_attribute_access, since we want Session.transaction to
emit a deprecation warning.  This is a little hacky but it's essentially
modifying the decorator to require a positive assertion that
a deprecation decorator on a descriptor should actually warn
on access.

Remove the warning filter for session.transaction and get
tests to pass to ensure this is not also being called
internally.

Added tests to ensure that common places .bind can be passed
as a parameter definitely warn as I was not able to find
this otherwise.

Fixes: #5717
Change-Id: Ia586b4f9ee6b212f3a71104b1caf40b5edd399e2

4 years agoMerge "Support pool.connect() event firing before all else"
mike bayer [Fri, 20 Nov 2020 16:34:29 +0000 (16:34 +0000)] 
Merge "Support pool.connect() event firing before all else"

4 years agoMerge "Support PEP-567 context variables"
mike bayer [Thu, 19 Nov 2020 21:06:52 +0000 (21:06 +0000)] 
Merge "Support PEP-567 context variables"

4 years agoMerge "Use ``re.search`` instead of ``re.match`` in sqlite"
mike bayer [Thu, 19 Nov 2020 19:36:42 +0000 (19:36 +0000)] 
Merge "Use ``re.search`` instead of ``re.match`` in sqlite"

4 years agoSupport PEP-567 context variables
Fantix King [Thu, 19 Nov 2020 16:53:50 +0000 (11:53 -0500)] 
Support PEP-567 context variables

Invoke the given function within a copy of the current PEP-567
context in `greenlet_spawn()`, so that subsequent sync methods could
retrieve the correct context variable.

Adjusted the greenlet integration, which provides support for Python asyncio
in SQLAlchemy, to accommodate for the handling of Python ``contextvars``
(introduced in Python 3.7) for ``greenlet`` versions greater than 0.4.17.
Greenlet version 0.4.17 added automatic handling of contextvars in a
backwards-incompatible way; we've coordinated with the greenlet authors to
add a preferred API for this in versions subsequent to 0.4.17 which is now
supported by SQLAlchemy's greenlet integration.  For greenlet versions prior
to 0.4.17 no behavioral change is needed, version 0.4.17 itself is blocked
from the dependencies.

Fixes: #5615
Closes: #5616
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5616
Pull-request-sha: dcf42f7b78ef3e983fda17f7190cda7b4511e3b4

Change-Id: I378953ee69e1ef2535ba51b97f28cbbbf9de3161

4 years agoUse ``re.search`` instead of ``re.match`` in sqlite
Federico Caselli [Sun, 15 Nov 2020 15:58:46 +0000 (16:58 +0100)] 
Use ``re.search`` instead of ``re.match`` in sqlite

Use python ``re.search()`` instead of ``re.match()`` as the operation
used by the :meth:`Column.regexp_match` method when using sqlite.
This matches the behavior of regular expressions on other databases
as well as that of well-known SQLite plugins.

Fixes: #5699
Change-Id: I14b2c7faf51fef172842aeb2dba2500f14544f24

4 years agoSupport pool.connect() event firing before all else
Mike Bayer [Tue, 17 Nov 2020 22:13:24 +0000 (17:13 -0500)] 
Support pool.connect() event firing before all else

Fixed regression where a connection pool event specified with a keyword,
most notably ``insert=True``, would be lost when the event were set up.
This would prevent startup events that need to fire before dialect-level
events from working correctly.

The internal mechanics of the engine connection routine has been altered
such that it's now guaranteed that a user-defined event handler for the
:meth:`_pool.PoolEvents.connect` handler, when established using
``insert=True``, will allow an event handler to run that is definitely
invoked **before** any dialect-specific initialization starts up, most
notably when it does things like detect default schema name.
Previously, this would occur in most cases but not unconditionally.
A new example is added to the schema documentation illustrating how to
establish the "default schema name" within an on-connect event
(upcoming as part of I882edd5bbe06ee5b4d0a9c148854a57b2bcd4741)

Addiional changes to support setting default schema name:

The Oracle dialect now uses
``select sys_context( 'userenv', 'current_schema' ) from dual`` to get
the default schema name, rather than ``SELECT USER FROM DUAL``, to
accommodate for changes to the session-local schema name under Oracle.

Added a read/write ``.autocommit`` attribute to the DBAPI-adaptation layer
for the asyncpg dialect.   This so that when working with DBAPI-specific
schemes that need to use "autocommit" directly with the DBAPI connection,
the same ``.autocommit`` attribute which works with both psycopg2 as well
as pg8000 is available.

Fixes: #5716
Fixes: #5708
Change-Id: I7dce56b4345ffc720e25e2aaccb7e42bb29e5671

4 years agoAllow MetaData as the target for column_reflect event
Mike Bayer [Wed, 18 Nov 2020 14:57:30 +0000 (09:57 -0500)] 
Allow MetaData as the target for column_reflect event

The :meth:`_event.DDLEvents.column_reflect` event may now be applied to a
:class:`_schema.MetaData` object where it will take effect for the
:class:`_schema.Table` objects local to that collection.

Fixes: #5712
Change-Id: I6044baa72d096ebd1fd99128270119747d1461b9

4 years agoimprove column_reflect docs
Mike Bayer [Wed, 18 Nov 2020 14:25:34 +0000 (09:25 -0500)] 
improve column_reflect docs

Change-Id: I41d947e3cccb68c2d1ca811b5b2ae4b3f66409fb
References: #5711

4 years agoMerge "Data type is supported only on sequences, not indentity"
Federico Caselli [Tue, 17 Nov 2020 21:44:01 +0000 (21:44 +0000)] 
Merge "Data type is supported only on sequences, not indentity"

4 years agoData type is supported only on sequences, not indentity
Federico Caselli [Tue, 17 Nov 2020 20:22:48 +0000 (21:22 +0100)] 
Data type is supported only on sequences, not indentity

Change-Id: I16ed79c008ccbb25778426a261e87695e99964c3

4 years agoClarify how ORM rows are returned in the tutorial
Mike Bayer [Tue, 17 Nov 2020 14:58:56 +0000 (09:58 -0500)] 
Clarify how ORM rows are returned in the tutorial

The ORM querying guide discussed how rows are returned but
the tutorial fails to introduce this important concept.

Fixes: #5706
Change-Id: I8c9585e28841b5dd86f4ab642f57cbc763635425

4 years agoadd 1.4.0b2 indicator for recent 1.3 changes
Mike Bayer [Mon, 16 Nov 2020 20:27:51 +0000 (15:27 -0500)] 
add 1.4.0b2 indicator for recent 1.3 changes

Change-Id: Ie16ed91fcd6b518c86fb86dff89c8fba3edb8456

4 years agoCorrect versionadded for #5604
Mike Bayer [Mon, 16 Nov 2020 20:01:37 +0000 (15:01 -0500)] 
Correct versionadded for #5604

Change-Id: I840a08253ecba1c8200c2dfd7f2c0b7b3598af0f

4 years agoMerge "Add opsclass to exclusion constraint"
mike bayer [Mon, 16 Nov 2020 20:00:04 +0000 (20:00 +0000)] 
Merge "Add opsclass to exclusion constraint"

4 years agoAdd opsclass to exclusion constraint
AlonM [Sun, 15 Nov 2020 13:13:25 +0000 (08:13 -0500)] 
Add opsclass to exclusion constraint

Added new parameter :paramref:`_postgresql.ExcludeConstraint.ops` to the
:class:`_postgresql.ExcludeConstraint` object, to support operator class
specification with this constraint.  Pull request courtesy Alon Menczer.

Fixes: #5604
Closes: #5700
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5700
Pull-request-sha: f8613e100792fc0bb3cf300ec6aebc78ecdf0361

Change-Id: Iaf664131ec84f8c2fb05edf799198b8d3bb83597

4 years agoEnsure the "orm" plugin is used unconditionally for bundles
Mike Bayer [Mon, 16 Nov 2020 15:15:17 +0000 (10:15 -0500)] 
Ensure the "orm" plugin is used unconditionally for bundles

This also introduces that the "orm" plugin may be used
when the plugin_subject is None.

Fixed regression where the :paramref:`.Bundle.single_entity` flag would
take effect for a :class:`.Bundle` even though it were not set.
Additionally, this flag is legacy as it only makes sense for the
:class:`_orm.Query` object and not 2.0 style execution.  a deprecation
warning is emitted when used with new-style execution.

Fixes: #5702
Change-Id: If9f43365b9d966cb398890aeba2efa555658a7e5

4 years agoAdd migration note for ticket #5367
Mike Bayer [Sun, 15 Nov 2020 16:23:10 +0000 (11:23 -0500)] 
Add migration note for ticket #5367

Fixes: #5701
Change-Id: Iac5bee4c3ddf25151a695c98e62276525de2b08b

4 years agoMerge "Some small improvements on the tutorial 2.0 documents"
mike bayer [Sat, 14 Nov 2020 14:35:23 +0000 (14:35 +0000)] 
Merge "Some small improvements on the tutorial 2.0 documents"

4 years agodon't check standard_conforming_strings less than server version 8.2
Mike Bayer [Sat, 14 Nov 2020 00:35:25 +0000 (19:35 -0500)] 
don't check standard_conforming_strings less than server version 8.2

Fixed a small regression where the query for "show
standard_conforming_strings" upon initialization would be emitted even if
the server version info were detected as less than version 8.2, previously
it would only occur for server version 8.2 or greater. The query fails on
Amazon Redshift which reports a PG server version older than this value.

Fixes: #5698
Change-Id: Ib27ce4b05106d986a618597e4cf253504f981bf1

4 years agoSome small improvements on the tutorial 2.0 documents
Federico Caselli [Tue, 3 Nov 2020 22:24:28 +0000 (23:24 +0100)] 
Some small improvements on the tutorial 2.0 documents

Change-Id: I7fb37d45c29307b2213bebd0ef280d73804ac473

4 years agoRevert "Added ssl_mode flag to mysqldb"
Mike Bayer [Fri, 13 Nov 2020 21:24:35 +0000 (16:24 -0500)] 
Revert "Added ssl_mode flag to mysqldb"

This reverts commit 2e4dec934cb5215d628e02ed717454c165a33e4d.

I approved this merge before observing that the "ssl_mode"
flag is not actually part of the separate "ssl" dictionary,
so this patch as given is unnecessary as we already pass
all strings into opts.  but also I can't get the flag to work
on either mysqlclient or pymysql, it's not recognized.  so
I need specific info from the submitter what it is that is
actually needed, and if a change is needed it has to be
appropriate for the drivers in use.

4 years agoAdded ssl_mode flag to mysqldb
Gord Thompson [Fri, 13 Nov 2020 19:13:32 +0000 (14:13 -0500)] 
Added ssl_mode flag to mysqldb

Fixes: #5692
ssl_mode flag is added to mysqldb

### Description
mysqldb driver supports "ssl_mode" flag, which can be one of following values:
"DISABLED", "PREFERRED", "REQUIRED", "VERIFY_CA", "VERIFY_IDENTITY".
Depending on these values MySQL will behave accordingly to them.

So this flag has been added to the sqlaclhemy. So in case if TLS is not supported on the server, we can drop the connection right away.

Closes: #5693
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5693
Pull-request-sha: 94aed8b17d21da9a20be4b092f6a60b12f60b761

Change-Id: I7657b9c812d3a40ccacebbd8f4d5f20659d447c3

4 years agoformatting
Mike Bayer [Fri, 13 Nov 2020 15:07:50 +0000 (10:07 -0500)] 
formatting

Change-Id: Icdbd393d1da79b8534a70e1e9e02f2a5a5915391

4 years agoAdded missing keywords for MySQL dialect
Oscar Batori [Wed, 16 Sep 2020 17:41:34 +0000 (13:41 -0400)] 
Added missing keywords for MySQL dialect

Fixes: #5696
Add missing MySQL keywords.

### Description
Adds some missing keywords from the MySQL dialect. While it's hard to describe this as a documentation/typographical fix, there are no current test for presence of the correct keywords, nor a realistic way to implement them those tests.

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

Closes: #5567
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5567
Pull-request-sha: db76e7f9d3a903cb4acf0309d57a14fe69948a0f

Change-Id: Ieaef45d0214fc9052a36924bfee38df9a27f7040

4 years agoAllow multiple returning() calls
Mike Bayer [Wed, 11 Nov 2020 16:41:25 +0000 (11:41 -0500)] 
Allow multiple returning() calls

Multiple calls to "returning", e.g. :meth:`_sql.Insert.returning`,
may now be chained to add new columns to the RETURNING clause.

Fixes: #5695
Change-Id: Ie2dac4162f686c730e000e31dccfb38f9ce9c96e

4 years agoWarn / raise for returning() / return_defaults() combinations
Mike Bayer [Wed, 11 Nov 2020 16:13:27 +0000 (11:13 -0500)] 
Warn / raise for returning() / return_defaults() combinations

A warning is emmitted if a returning() method such as
:meth:`_sql.Insert.returning` is called multiple times, as this does not
yet support additive operation.  Version 1.4 will support additive
operation for this.  Additionally, any combination of the
:meth:`_sql.Insert.returning` and :meth:`_sql.Insert.return_defaults`
methods now raises an error as these methods are mutually exclusive;
previously the operation would fail silently.

Fixes: #5691
Change-Id: Id95e0f9da48bba0b59439cb26564f0daa684c8e3

4 years agoRemove misleading correlation examples
Mike Bayer [Wed, 11 Nov 2020 15:42:09 +0000 (10:42 -0500)] 
Remove misleading correlation examples

add links to tutorial docs

Fixes: #5694
Change-Id: I10a8e3f46a115945ded36d4ee59165c056c10f7a

4 years agos/craete/create/g
Thomas Grainger [Tue, 10 Nov 2020 10:49:59 +0000 (05:49 -0500)] 
s/craete/create/g

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

### Description
it's a typo fix

### 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: #5689
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5689
Pull-request-sha: 3823b2552da2a7b7a345979ad6283d848c0ec7a5

Change-Id: I170e7bea60182ebec8867499b2ea171d813fc49a

4 years agoMerge "Support SQLite WITHOUT ROWID tables"
mike bayer [Mon, 9 Nov 2020 15:56:15 +0000 (15:56 +0000)] 
Merge "Support SQLite WITHOUT ROWID tables"

4 years agoImplement upsert for SQLite
RamonWill [Mon, 14 Sep 2020 22:22:34 +0000 (18:22 -0400)] 
Implement upsert for SQLite

Implemented INSERT... ON CONFLICT clause for SQLite. Pull request courtesy
Ramon Williams.

Fixes: #4010
Closes: #5580
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5580
Pull-request-sha: fb422e0749fac442a455cbce539ef662d9512bc0

Change-Id: Ibeea44f4c2cee8dab5dc22b7ec3ae1ab95c12b65

4 years agoMerge "Allow dialect-specific stringification"
mike bayer [Sun, 8 Nov 2020 18:05:54 +0000 (18:05 +0000)] 
Merge "Allow dialect-specific stringification"

4 years agoAllow dialect-specific stringification
Mike Bayer [Sun, 8 Nov 2020 16:14:22 +0000 (11:14 -0500)] 
Allow dialect-specific stringification

Dialect-specific constructs such as
:meth:`_postgresql.Insert.on_conflict_do_update` can now stringify in-place
without the need to specify an explicit dialect object.  The constructs,
when called upon for ``str()``, ``print()``, etc. now have internal
direction to call upon their appropriate dialect rather than the
"default"dialect which doesn't know how to stringify these.   The approach
is also adapted to generic schema-level create/drop such as
:class:`_schema.AddConstraint`, which will adapt its stringify dialect to
one indicated by the element within it, such as the
:class:`_postgresql.ExcludeConstraint` object.

mostly towards being able to provide doctest-style
examples for "on conflict" constructs using print statements.

Change-Id: I4b855516fe6dee2df77744c1bb21a373d7fbab93

4 years agoSupport SQLite WITHOUT ROWID tables
Sean Anderson [Sun, 8 Nov 2020 00:52:04 +0000 (19:52 -0500)] 
Support SQLite WITHOUT ROWID tables

This adds support for creating tables WITHOUT ROWID in the SQLite
dialect. WITHOUT ROWID tables were introduced in SQLite version 3.8.2
(2013-12-06). They do not use an implicit rowid column as the primary
key. This may result in space and performance savings for tables without
INTEGER primary keys and tables with composite primary keys. For more
information about this feature, see the sqlite documentation [1].

[1] https://www.sqlite.org/withoutrowid.html

Fixes: #5685
### Checklist
This pull request is:

- [x] 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.

Closes: #5686
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5686
Pull-request-sha: 2b44782d1b3d858e31ce1ff8e08e197af37344d8

Change-Id: Ifcf727b0c07c90e267b79828a8e3fd7a8260a074

4 years agoMerge "Convert to autoload_with internally"
mike bayer [Sun, 8 Nov 2020 00:58:38 +0000 (00:58 +0000)] 
Merge "Convert to autoload_with internally"

4 years agorevert the code change part of the previous commit
Mike Bayer [Sat, 7 Nov 2020 19:16:59 +0000 (14:16 -0500)] 
revert the code change part of the previous commit

Change-Id: I0af7b05fa00dbc706c66558873f4542d365acbc5

4 years agoimprove verbiage a bit for the public_factory
Mike Bayer [Sat, 7 Nov 2020 18:38:38 +0000 (13:38 -0500)] 
improve verbiage a bit for the public_factory

Change-Id: I52fb88f6d08333063e749857eb7d8edcebabd738

4 years agoConvert to autoload_with internally
Mike Bayer [Fri, 6 Nov 2020 19:56:56 +0000 (14:56 -0500)] 
Convert to autoload_with internally

Fixed bug where the now-deprecated ``autoload`` parameter was being called
internally within the reflection routines when a related table were
reflected.

Fixes: #5684
Change-Id: I6ab439a2f49ff1ae2d3c7a15b531cbafbc3cf594

4 years agoSupport "sqlalchemy.future" for engine_from_config
Mike Bayer [Fri, 6 Nov 2020 20:44:39 +0000 (15:44 -0500)] 
Support "sqlalchemy.future" for engine_from_config

Added the "future" keyword to the list of words that are known by the
:func:`_sa.engine_from_config` function, so that the values "true" and
"false" may be configured as "boolean" values when using a key such
as ``sqlalchemy.future = true`` or ``sqlalchemy.future = false``.

Change-Id: Ib4bba748497cc68e4c913dde54c23a4bb08b4deb

4 years agoAdd changelog for f016c1ac7f93d2f759
Mike Bayer [Wed, 4 Nov 2020 16:10:01 +0000 (11:10 -0500)] 
Add changelog for f016c1ac7f93d2f759

Fixes: #5681
Change-Id: I2c860a867c26ece69680354d908d02b8ec7e9609

4 years agoMerge "Reduce import time overhead"
mike bayer [Wed, 4 Nov 2020 16:06:53 +0000 (16:06 +0000)] 
Merge "Reduce import time overhead"

4 years agoReduce import time overhead
Mike Bayer [Mon, 2 Nov 2020 22:37:12 +0000 (17:37 -0500)] 
Reduce import time overhead

* Fix subclass traversals to not run classes multiple times

* switch compiler visitor to use an attrgetter, to avoid
  an eval() at startup time

* don't pre-generate traversal functions, there's lots of these
  which are expensive to generate at once and most applications
  won't use them all; have it generate them on first use instead

* Some ideas about removing asyncio imports, they don't seem to
  be too signficant, apply some more simplicity to the overall
  "greenlet fallback" situation

Fixes: #5681
Change-Id: Ib564ddaddb374787ce3e11ff48026e99ed570933

4 years agoFix wheel generation
Federico Caselli [Mon, 2 Nov 2020 21:49:55 +0000 (22:49 +0100)] 
Fix wheel generation

Avoid passing LD_LIBRARY_PATH variable to the docker image used
to generate the wheels

Change-Id: I418a9574a7f49695984b1c68c997fc02f0450c12

4 years agoVersion 1.4.0b2 placeholder
Mike Bayer [Mon, 2 Nov 2020 21:08:39 +0000 (16:08 -0500)] 
Version 1.4.0b2 placeholder

4 years ago- 1.4.0b1 rel_1_4_0b1
Mike Bayer [Mon, 2 Nov 2020 20:59:31 +0000 (15:59 -0500)] 
- 1.4.0b1

4 years agoonly install greenlet for python 3
Mike Bayer [Mon, 2 Nov 2020 20:39:43 +0000 (15:39 -0500)] 
only install greenlet for python 3

Change-Id: I6057cd019bb78486e57f2cce49b58d7806ace36f

4 years agoEnsure AsyncAdaptedLock is present
Mike Bayer [Mon, 2 Nov 2020 20:29:38 +0000 (15:29 -0500)] 
Ensure AsyncAdaptedLock is present

whether or not greenlet is installed

Change-Id: Icd1c5ef3a01ec0d1b8dce0d1def9920700923e51

4 years agoRevert "- 1.4.0b1"
Mike Bayer [Mon, 2 Nov 2020 19:58:15 +0000 (14:58 -0500)] 
Revert "- 1.4.0b1"

This reverts commit a8efd74cebc609e34d3b2a5ce161b2ed32330fab.

release script was out of sync, or something

4 years ago- 1.4.0b1
Mike Bayer [Mon, 2 Nov 2020 19:35:38 +0000 (14:35 -0500)] 
- 1.4.0b1

4 years agochangelog edits and improvements
Mike Bayer [Mon, 2 Nov 2020 19:34:16 +0000 (14:34 -0500)] 
changelog edits and improvements

added new categories and applied better organization
to elements, repaired a few that are already out of date.

Change-Id: I02c619c99237c1e66e932543c4ee95fd119d665d

4 years agofix notes regarding Python 3.5
Mike Bayer [Sun, 1 Nov 2020 15:41:11 +0000 (10:41 -0500)] 
fix notes regarding Python 3.5

Clarify python 3.6 as the minimum python version,
references #5634

Change-Id: Ib93bc1b2a69e509bff8b00809d3db4f0ec5108f3

4 years agoupdate selectin docs
Mike Bayer [Sat, 31 Oct 2020 23:08:28 +0000 (19:08 -0400)] 
update selectin docs

* correct many-to-one example that doesnt use JOIN or ORDER BY
anymore

* Oracle does tuple IN, let's test it

* many-to-many is supported but joins all the way right now

* remove verbiage about yield_per for the moment to simplify
updates to how yield_per works w/ new style execution.  yield_per
is difficult to explain and the section seems kind of complicated
with those details added at the moment.

Change-Id: I010ed36f554f06310f336a5b12760c447b38ec01

4 years agoMerge "tutorial 2.0 WIP"
mike bayer [Sat, 31 Oct 2020 19:50:07 +0000 (19:50 +0000)] 
Merge "tutorial 2.0 WIP"

4 years agotutorial 2.0 WIP
Mike Bayer [Sat, 26 Sep 2020 02:31:16 +0000 (22:31 -0400)] 
tutorial 2.0 WIP

Add SelectBase.exists() method as it seems strange this is
not available already.  The Exists construct itself does
not provide full SELECT-building capabilities so it makes
sense this should be used more like a scalar_subquery.

Make sure stream_results is getting set up when yield_per
is used, for 2.0 style statements as well.  this was
hardcoded inside of Query.yield_per() and is now moved
to take place within QueryContext.

Change-Id: Icafcd4fd9b708772343d56edf40995c9e8f835d6

4 years agoMerge "while working on #5435, I found some misses from the previous PR for #5429"
mike bayer [Sat, 31 Oct 2020 14:54:39 +0000 (14:54 +0000)] 
Merge "while working on #5435, I found some misses from the previous PR for #5429"

4 years agoMerge "Deprecate bind args, execute() methods that were missed"
mike bayer [Sat, 31 Oct 2020 01:05:01 +0000 (01:05 +0000)] 
Merge "Deprecate bind args, execute() methods that were missed"

4 years agoDeprecate bind args, execute() methods that were missed
Mike Bayer [Thu, 29 Oct 2020 16:38:42 +0000 (12:38 -0400)] 
Deprecate bind args, execute() methods that were missed

in particular text(bind), DDL.execute().

Change-Id: Ie85ae9f61219182f5649f68e5f52b4923843199c

4 years agowhile working on #5435, I found some misses from the previous PR for #5429 5676/head
jonathan vanasco [Wed, 28 Oct 2020 19:58:55 +0000 (15:58 -0400)] 
while working on #5435, I found some misses from the previous PR for #5429

Change-Id: I0be15f6234c74302734672450a3275add762bdb8

4 years agoMerge "Apply underscore naming to several more operators"
mike bayer [Fri, 30 Oct 2020 15:14:18 +0000 (15:14 +0000)] 
Merge "Apply underscore naming to several more operators"

4 years agoApply underscore naming to several more operators
jonathan vanasco [Wed, 28 Oct 2020 18:35:39 +0000 (14:35 -0400)] 
Apply underscore naming to several more operators

The operator changes are:

* `isfalse` is now `is_false`
* `isnot_distinct_from` is now `is_not_distinct_from`
* `istrue` is now `is_true`
* `notbetween` is now `not_between`
* `notcontains` is now `not_contains`
* `notendswith` is now `not_endswith`
* `notilike` is now `not_ilike`
* `notlike` is now `not_like`
* `notmatch` is now `not_match`
* `notstartswith` is now `not_startswith`
* `nullsfirst` is now `nulls_first`
* `nullslast` is now `nulls_last`

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: #5435
Change-Id: Ifbd7cb1cdda5981990243c4fc4b4ff467dc132ac

4 years agorename "bulk" UPDATE and DELETE to not use the word "bulk"
Mike Bayer [Fri, 30 Oct 2020 03:21:13 +0000 (23:21 -0400)] 
rename "bulk" UPDATE and DELETE to not use the word "bulk"

This term confuses this feature with the lesser used
"bulk insert/update" feature, and also "bulk" is not as
descriptive here as only a single statement is run; there's
not a large set of data passed in.

For now call it UPDATE/DELETE with arbitrary WHERE clause,
or ORM-enabled UPDATE/DELETE.

Change-Id: I317fcda9d73d4c2dd250031a745dd3d72e4f1fc6

4 years agoClarify bulk operations caveats
Mike Bayer [Fri, 30 Oct 2020 03:12:19 +0000 (23:12 -0400)] 
Clarify bulk operations caveats

Fixes: #5678
Change-Id: I186b26d1265c106bb87fb9e680229cad1eb8d7ea

4 years agoImplement PropComparator.and_() for remaining options
Mike Bayer [Thu, 29 Oct 2020 18:29:57 +0000 (14:29 -0400)] 
Implement PropComparator.and_() for remaining options

In c7b489b25802f7a25ef78d0731411295c611cc1c we implemented
with_loader_criteria() for everyone as well as PropComparator.and_()
for joinedload() and join(), but forgot to do anything for
lazyload(), selectinload(), or subqueryload().  Even though
I actually documented it in terms of lazyload().

Fixes: #4472
Change-Id: I0ef410a83c34e63b9c9c9c3277c0063d8971ec14

4 years agoadded docstring about expire_on_commit for #5243
jonathan vanasco [Fri, 4 Sep 2020 23:48:38 +0000 (19:48 -0400)] 
added docstring about expire_on_commit for #5243

Fixes: #5243
Closes: #5328
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5328
Pull-request-sha: e760ed4ef1749aadfb8d63d776c764d98b93b1e5

Change-Id: I8e7bc3429dc279d447cc66400c76b4d2a04626aa

4 years agoMerge "Correct reflection for composite primary keys"
mike bayer [Mon, 26 Oct 2020 14:29:12 +0000 (14:29 +0000)] 
Merge "Correct reflection for composite primary keys"

4 years agoimprove engine logging docs
Mike Bayer [Sat, 24 Oct 2020 16:59:22 +0000 (12:59 -0400)] 
improve engine logging docs

the text here was a little confusing and didn't refer to major
configurational elements such as hide_parameters.

Change-Id: I4e2179e5a64c326d30b65a8871b924725c41b453

4 years agoCorrect reflection for composite primary keys
fulpm [Tue, 20 Oct 2020 21:54:50 +0000 (17:54 -0400)] 
Correct reflection for composite primary keys

Fixes: #5661
### Description
Fixes reflection of composite primary keys to maintain the correct column order in the MSSQL
and SQLite dialects.

Closes: #5662
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5662
Pull-request-sha: b568dec7070b4f3ee46a528bdf16fb237baade2a

Change-Id: I452b23cbf7f389c4a0a34cffce5c32498efe37d2

4 years agoDon't load expired objects from evaluator
Mike Bayer [Wed, 21 Oct 2020 19:01:03 +0000 (15:01 -0400)] 
Don't load expired objects from evaluator

part 2 of e3dc20ff27fa75e571fb2631e64737ea8f25f7c5, the
pre-evaluate step was also emitting SELECT for expired objects.

Fixes: #5664
Change-Id: I9f5de2a5d480eafeb290ec0c45ce2a82ec93475b

4 years agoDon't populate expired attrs w/ evaluator
Mike Bayer [Wed, 21 Oct 2020 17:58:22 +0000 (13:58 -0400)] 
Don't populate expired attrs w/ evaluator

Fixed bug in :meth:`_orm.Query.update` where objects in the
:class:`_orm.Session` that were already expired would be unnecessarily
SELECTed individually when they were refreshed by the "evaluate"
synchronize strategy.

For 1.4 there was also a similar issue with fetch that would actually
get the wrong data back, as the new value would be loaded, then
applied with the evaluator.

Fixes: #5664
Change-Id: I6e6aff88462654fcefa9fce2b45f5446c418deee

4 years agoImprove assoc proxy docs for 1.3 changes
Mike Bayer [Tue, 20 Oct 2020 14:20:39 +0000 (10:20 -0400)] 
Improve assoc proxy docs for 1.3 changes

Fixes: #5647
Change-Id: I98979577f5354eba993ade9fc5056db718f47a18

4 years agoAdd FAQ entry for retry subject; recipe w/ autocommit
Mike Bayer [Mon, 19 Oct 2020 19:57:13 +0000 (15:57 -0400)] 
Add FAQ entry for retry subject; recipe w/ autocommit

In order to invalidate a connection within a Transaction
block and an execution context, we need to take advantage
of the simpler transaction design added in 1.4.  The recipe
can be done on 1.3 but it requires a lot more hacking
and isn't worth it.

Clearly since the recipe is part of the tests now we can
in the future consider adding a feature that's built
in for this case but it would have to absolutely guarantee
the DBAPI is in autocommit mode and also prevent
any "write" operations from taking place.   Recipe for now.

Fixes: #5657
Change-Id: Ia9ea8cced084d154e83e4d1c259e080b776ec38a

4 years agoEnsure no compiler visit method tries to access .statement
Mike Bayer [Mon, 19 Oct 2020 14:19:29 +0000 (10:19 -0400)] 
Ensure no compiler visit method tries to access .statement

Fixed structural compiler issue where some constructs such as MySQL /
PostgreSQL "on conflict / on duplicate key" would rely upon the state of
the :class:`_sql.Compiler` object being fixed against their statement as
the top level statement, which would fail in cases where those statements
are branched from a different context, such as a DDL construct linked to a
SQL statement.

Fixes: #5656
Change-Id: I568bf40adc7edcf72ea6c7fd6eb9d07790de189e

4 years agoEnsure escaping of percent signs in columns, parameters
Mike Bayer [Sat, 17 Oct 2020 15:39:56 +0000 (11:39 -0400)] 
Ensure escaping of percent signs in columns, parameters

Improved support for column names that contain percent signs in the string,
including repaired issues involving anoymous labels that also embedded a
column name with a percent sign in it, as well as re-established support
for bound parameter names with percent signs embedded on the psycopg2
dialect, using a late-escaping process similar to that used by the
cx_Oracle dialect.

* Added new constructor for _anonymous_label() that ensures incoming
  string tokens based on column or table names will have percent
  signs escaped; abstracts away the format of the label.

* generalized cx_Oracle's quoted_bind_names facility into the compiler
  itself, and leveraged this for the psycopg2 dialect's issue with
  percent signs in names as well.  the parameter substitution is now
  integrated with compiler.construct_parameters() as well as the
  recently reworked set_input_sizes(), reducing verbosity in the
  cx_Oracle dialect.

Fixes: #5653
Change-Id: Ia2ad13ea68b4b0558d410026e5a33f5cb3fbab2c

4 years agoMerge "Add deprecation for base Executable.bind"
mike bayer [Sat, 17 Oct 2020 14:11:48 +0000 (14:11 +0000)] 
Merge "Add deprecation for base Executable.bind"

4 years agoAdd deprecation for base Executable.bind
Mike Bayer [Fri, 16 Oct 2020 16:03:11 +0000 (12:03 -0400)] 
Add deprecation for base Executable.bind

These attributes will be removed in SQLAlchemy 2.0.

Also alters the deprecation message to qualify the
type of object correctly.  this in turn requires changes
in the warnings filter and deprecation tests.

Change-Id: I5779d9813e88f42e5db0c7b5e3ffff1d1535c203

4 years agoGenericize setinputsizes and support pyodbc
Mike Bayer [Thu, 15 Oct 2020 22:18:03 +0000 (18:18 -0400)] 
Genericize setinputsizes and support pyodbc

Reworked the "setinputsizes()" set of dialect hooks to be correctly
extensible for any arbirary DBAPI, by allowing dialects individual hooks
that may invoke cursor.setinputsizes() in the appropriate style for that
DBAPI.   In particular this is intended to support pyodbc's style of usage
which is fundamentally different from that of cx_Oracle.  Added support
for pyodbc.

Fixes: #5649
Change-Id: I9f1794f8368bf3663a286932cfe3992dae244a10

4 years agoindicate legacy ping recipe for handle_error cases
Mike Bayer [Thu, 15 Oct 2020 17:21:34 +0000 (13:21 -0400)] 
indicate legacy ping recipe for handle_error cases

in prep for a new feature as part of #5648.

Change-Id: I6720b0ea797c188de5e8163f79fb7b7994d6e76e

4 years agomove misplaced section
Mike Bayer [Wed, 14 Oct 2020 22:18:13 +0000 (18:18 -0400)] 
move misplaced section

Change-Id: I472049fbdda70da94bbf1cf7b5e10d04721bc771