]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
3 years agoMerge "require at least one dialect name for variant" into main
Federico Caselli [Sun, 26 Jun 2022 15:34:13 +0000 (15:34 +0000)] 
Merge "require at least one dialect name for variant" into main

3 years agorequire at least one dialect name for variant
Mike Bayer [Sun, 26 Jun 2022 14:22:39 +0000 (10:22 -0400)] 
require at least one dialect name for variant

the call doesn't make sense otherwise

Fixes: #8179
Change-Id: I0e5dd584dc7090b536f9732cbfc6f3a5c8846dc5

3 years agoalways use typing_extension
Federico Caselli [Sat, 25 Jun 2022 09:55:07 +0000 (11:55 +0200)] 
always use typing_extension

always use typing_extensions to import missing types in old python version

Change-Id: Ied03e8597e10bfae06f0e37d8624fbad90e74bcf

3 years agocherry-pick changelog update for 1.4.40
Mike Bayer [Fri, 24 Jun 2022 16:20:37 +0000 (12:20 -0400)] 
cherry-pick changelog update for 1.4.40

3 years agocherry-pick changelog from 1.4.39
Mike Bayer [Fri, 24 Jun 2022 16:20:36 +0000 (12:20 -0400)] 
cherry-pick changelog from 1.4.39

3 years agoadd fallback for old mutable format
Mike Bayer [Fri, 24 Jun 2022 14:31:46 +0000 (10:31 -0400)] 
add fallback for old mutable format

Fixed regression caused by :ticket:`8133` where the pickle format for
mutable attributes was changed, without a fallback to recognize the old
format, causing in-place upgrades of SQLAlchemy to no longer be able to
read pickled data from previous versions. A check plus a fallback for the
old format is now in place.

Fixes: #8133
Change-Id: I9029729b4bc56c8b3145797869229eeff48a3b3b

3 years agoadd a lot more caps and boldface
Mike Bayer [Fri, 24 Jun 2022 13:53:22 +0000 (09:53 -0400)] 
add a lot more caps and boldface

Change-Id: I715b80d4ed8dba43efadfb93e169771fb3a943df

3 years agocherry-pick changelog update for 1.4.39
Mike Bayer [Thu, 23 Jun 2022 16:26:49 +0000 (12:26 -0400)] 
cherry-pick changelog update for 1.4.39

3 years agocherry-pick changelog from 1.4.38
Mike Bayer [Thu, 23 Jun 2022 16:26:49 +0000 (12:26 -0400)] 
cherry-pick changelog from 1.4.38

3 years agorefine _include_fn to not include sibling mappers
Mike Bayer [Thu, 23 Jun 2022 15:15:19 +0000 (11:15 -0400)] 
refine _include_fn to not include sibling mappers

Fixed regression caused by :ticket:`8064` where a particular check for
column correspondence was made too liberal, resulting in incorrect
rendering for some ORM subqueries such as those using
:meth:`.PropComparator.has` or :meth:`.PropComparator.any` in conjunction
with joined-inheritance queries that also use legacy aliasing features.

Fixes: #8162
Change-Id: Ib1fff33aa219aadf178348dd571bec1e691e606d

3 years agosub-categorize special function forms
Mike Bayer [Wed, 22 Jun 2022 22:50:35 +0000 (18:50 -0400)] 
sub-categorize special function forms

this is the tutorial, which should have some semblence of
not getting too far into the weeds.  however, as we dont
really have other places to explain SQL concepts, and SQL
functions have a lot of them, we dont have another home right
now.  so at least further sub-categorize window functions,
table/column valued functions, and WITHIN GROUP into an
"advanced function techniques" section with a disclaimer that
these are less common use cases.

Change-Id: I4b16bd5673c0bd39a9b880338f6ce3cfbafbe271

3 years agoMerge "use metadata.reflect() for DeferredReflection" into main
mike bayer [Tue, 21 Jun 2022 20:45:23 +0000 (20:45 +0000)] 
Merge "use metadata.reflect() for DeferredReflection" into main

3 years agopost-edits for ORM rework
Mike Bayer [Tue, 21 Jun 2022 20:41:06 +0000 (16:41 -0400)] 
post-edits for ORM rework

amends f9f1e8b6c5890eb17b6ba055ff563

Change-Id: I2fd6de56db82aad4d22abf5807e5849e48693124

3 years agoMerge "add more pg ENUM tests" into main
mike bayer [Tue, 21 Jun 2022 18:57:21 +0000 (18:57 +0000)] 
Merge "add more pg ENUM tests" into main

3 years agouse metadata.reflect() for DeferredReflection
Mike Bayer [Tue, 21 Jun 2022 18:45:25 +0000 (14:45 -0400)] 
use metadata.reflect() for DeferredReflection

as metadata.reflect() now has a signficant performance gain
over indivdual Table reflection, rework DeferredReflection
to use this

Fixes: #8155
Change-Id: I98d55fae83f0cf06a8ca8b89112c85655424d73a

3 years agoadd more pg ENUM tests
Mike Bayer [Tue, 21 Jun 2022 18:07:49 +0000 (14:07 -0400)] 
add more pg ENUM tests

given 017fd9ae0645eaf2a0fbdd067d10c has changed 'name'
to be required for ENUM, add some more adapt from Enum types
of tests.

Change-Id: I447983e640d6466f969aa51c8dff5a0cb8074ca8

3 years agoMerge "rework ORM mapping docs" into main
mike bayer [Tue, 21 Jun 2022 17:41:43 +0000 (17:41 +0000)] 
Merge "rework ORM mapping docs" into main

3 years agoMerge "Add ability to test using thick mode with oracledb" into main
mike bayer [Tue, 21 Jun 2022 17:20:32 +0000 (17:20 +0000)] 
Merge "Add ability to test using thick mode with oracledb" into main

3 years agorework ORM mapping docs
Mike Bayer [Mon, 13 Jun 2022 15:46:28 +0000 (11:46 -0400)] 
rework ORM mapping docs

prepare docs for newly incoming mapper styles, including
new dataclass mapping.   move the existing dataclass/attrs
docs all into their own section and try to improve organization
and wording into the relatively recent "mapping styles"
document.

Change-Id: I0b5e2a5b6a70db65ab19b5bb0a2bb7df20e0b498

3 years agoDomain type
David Baumgold [Fri, 11 Feb 2022 17:30:24 +0000 (12:30 -0500)] 
Domain type

Added a new Postgresql :class:`_postgresql.DOMAIN` datatype, which follows
the same CREATE TYPE / DROP TYPE behaviors as that of PostgreSQL
:class:`_postgresql.ENUM`. Much thanks to David Baumgold for the efforts on
this.

Fixes: #7316
Closes: #7317
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7317
Pull-request-sha: bc9a82f010e6ca2f70a6e8a7620b748e483c26c3

Change-Id: Id8d7e48843a896de17d20cc466b115b3cc065132

3 years agoAdd ability to test using thick mode with oracledb
Federico Caselli [Mon, 20 Jun 2022 18:41:48 +0000 (20:41 +0200)] 
Add ability to test using thick mode with oracledb

Change-Id: Iee14750ba20422931bde4d61eaa570af482c7d8b
References: #8147

3 years agoremove warnings for index/unique skipped due to exclude_cols
Mike Bayer [Mon, 20 Jun 2022 15:06:34 +0000 (11:06 -0400)] 
remove warnings for index/unique skipped due to exclude_cols

The warnings that are emitted regarding reflection of indexes or unique
constraints, when the :paramref:`.Table.include_columns` parameter is used
to exclude columns that are then found to be part of those constraints,
have been removed. When the :paramref:`.Table.include_columns` parameter is
used it should be expected that the resulting :class:`.Table` construct
will not include constraints that rely upon omitted columns. This change
was made in response to :ticket:`8100` which repaired
:paramref:`.Table.include_columns` in conjunction with foreign key
constraints that rely upon omitted columns, where the use case became
clear that omitting such constraints should be expected.

Fixes: #8102
Change-Id: Id32f628def2d12499cd49d0b436ed345fe49dc6b

3 years agoMerge "create new approach for deeply nested post loader options" into main
mike bayer [Sat, 18 Jun 2022 21:52:25 +0000 (21:52 +0000)] 
Merge "create new approach for deeply nested post loader options" into main

3 years agoMerge "rearchitect reflection for batched performance" into main
Federico Caselli [Sat, 18 Jun 2022 21:08:27 +0000 (21:08 +0000)] 
Merge "rearchitect reflection for batched performance" into main

3 years agocreate new approach for deeply nested post loader options
Mike Bayer [Thu, 16 Jun 2022 17:35:16 +0000 (13:35 -0400)] 
create new approach for deeply nested post loader options

Added very experimental feature to the :func:`_orm.selectinload` and
:func:`_orm.immediateload` loader options called
:paramref:`_orm.selectinload.recursion_depth` /
:paramref:`_orm.immediateload.recursion_depth` , which allows a single
loader option to automatically recurse into self-referential relationships.
Is set to an integer indicating depth, and may also be set to -1 to
indicate to continue loading until no more levels deep are found.
Major internal changes to :func:`_orm.selectinload` and
:func:`_orm.immediateload` allow this feature to work while continuing
to make correct use of the compilation cache, as well as not using
arbitrary recursion, so any level of depth is supported (though would
emit that many queries).  This may be useful for
self-referential structures that must be loaded fully eagerly, such as when
using asyncio.

A warning is also emitted when loader options are connected together with
arbitrary lengths (that is, without using the new ``recursion_depth``
option) when excessive recursion depth is detected in related object
loading. This operation continues to use huge amounts of memory and
performs extremely poorly; the cache is disabled when this condition is
detected to protect the cache from being flooded with arbitrary statements.

Fixes: #8126
Change-Id: I9f162e0a09c1ed327dd19498aac193f649333a01

3 years agoMerge "Normalize postgresql docs links to point to current" into main
mike bayer [Sat, 18 Jun 2022 19:00:16 +0000 (19:00 +0000)] 
Merge "Normalize postgresql docs links to point to current" into main

3 years agoMerge "Allow NUMERIC()/DECIMAL() IDENTITY columns" into main
mike bayer [Sat, 18 Jun 2022 18:59:48 +0000 (18:59 +0000)] 
Merge "Allow NUMERIC()/DECIMAL() IDENTITY columns" into main

3 years agorearchitect reflection for batched performance
Federico Caselli [Thu, 14 Oct 2021 19:45:57 +0000 (21:45 +0200)] 
rearchitect reflection for batched performance

Rearchitected the schema reflection API to allow some dialects to make use
of high performing batch queries to reflect the schemas of many tables at
once using much fewer queries. The new performance features are targeted
first at the PostgreSQL and Oracle backends, and may be applied to any
dialect that makes use of SELECT queries against system catalog tables to
reflect tables (currently this omits the MySQL and SQLite dialects which
instead make use of parsing the "CREATE TABLE" statement, however these
dialects do not have a pre-existing performance issue with reflection. MS
SQL Server is still a TODO).

The new API is backwards compatible with the previous system, and should
require no changes to third party dialects to retain compatibility;
third party dialects can also opt into the new system by implementing
batched queries for schema reflection.

Along with this change is an updated reflection API that is fully
:pep:`484` typed, features many new methods and some changes.

Fixes: #4379
Change-Id: I897ec09843543aa7012bcdce758792ed3d415d08

3 years agoAllow NUMERIC()/DECIMAL() IDENTITY columns
Gord Thompson [Tue, 14 Jun 2022 16:09:04 +0000 (10:09 -0600)] 
Allow NUMERIC()/DECIMAL() IDENTITY columns

Fixed issue where :class:`.Table` objects that made use of IDENTITY columns
with a :class:`.Numeric` datatype would produce errors when attempting to
reconcile the "autoincrement" column, preventing construction of the
:class:`.Column` from using the :paramref:`.Column.autoincrement` parameter
as well as emitting errors when attempting to invoke an :class:`.Insert`
construct.

Fixes: #8111
Change-Id: Iaacc4eebfbafb42fa18f9a1a4f43cb2b6b91d28a

3 years agoNormalize postgresql docs links to point to current
Federico Caselli [Fri, 17 Jun 2022 19:53:32 +0000 (21:53 +0200)] 
Normalize postgresql docs links to point to current

Change-Id: Ib7d3ea7ff3356ff8a2f935892d904a69dbc25c3e

3 years agoRevert "add auto_recurse option to selectinload, immediateload"
Mike Bayer [Thu, 16 Jun 2022 18:46:11 +0000 (14:46 -0400)] 
Revert "add auto_recurse option to selectinload, immediateload"

this option works very badly with caching and the API
is likely not what we want either.  Work continues for
 #8126 including that the additional work in
I9f162e0a09c1ed327dd19498aac193f649333a01
tries to add new recursive features.

This reverts commit b3a1162553879d1369154e920f3f4129020bb88e.

3 years agoMerge "implement literal stringification for arrays" into main
mike bayer [Thu, 16 Jun 2022 02:30:04 +0000 (02:30 +0000)] 
Merge "implement literal stringification for arrays" into main

3 years agoimplement literal stringification for arrays
Mike Bayer [Wed, 15 Jun 2022 16:42:44 +0000 (12:42 -0400)] 
implement literal stringification for arrays

as we already implement stringification for the contents,
provide a bracketed syntax for default and ARRAY literal
for PG specifically.   ARRAY literal seems much simpler to
render than their quoted syntax which requires double quotes
for strings.

also open up testing for pg8000 which has likely been
fine with arrays for awhile now, bump the version pin
also.

Fixes: #8138
Change-Id: Id85b052b0a9564d6aa1489160e58b7359f130fdd

3 years agoremove sqlalchemy2-stubs dep from mypy setup.cfg extras
Mike Bayer [Wed, 15 Jun 2022 17:02:22 +0000 (13:02 -0400)] 
remove sqlalchemy2-stubs dep from mypy setup.cfg extras

this should have been removed awhile ago.

Change-Id: I181bd31936fbd811b34e6a9de44b65857146e359

3 years agoMerge "new features for pep 593 Annotated" into main
mike bayer [Wed, 15 Jun 2022 14:07:53 +0000 (14:07 +0000)] 
Merge "new features for pep 593 Annotated" into main

3 years agonew features for pep 593 Annotated
Mike Bayer [Tue, 14 Jun 2022 21:05:44 +0000 (17:05 -0400)] 
new features for pep 593 Annotated

* extract the inner type from Annotated when the outer type
  isn't present in the type map, to allow for arbitrary Annotated
* allow _IntrospectsAnnotations objects to be directly present
  in an Annotated and resolve the mapper property from that.
  Currently implemented for mapped_column(), with message for
  others.  Can work for composite() and likely some
  relationship() as well at some point

References: https://twitter.com/zzzeek/status/1536693554621341697 and
replies

Change-Id: I04657050a8785f194bf8f63291faf3475af88781

3 years agoMerge "pickle mutable parents according to key" into main
mike bayer [Wed, 15 Jun 2022 01:46:39 +0000 (01:46 +0000)] 
Merge "pickle mutable parents according to key" into main

3 years agopickle mutable parents according to key
Mike Bayer [Tue, 14 Jun 2022 19:41:31 +0000 (15:41 -0400)] 
pickle mutable parents according to key

Fixed bug in :class:`.Mutable` where pickling and unpickling of an ORM
mapped instance would not correctly restore state for mappings that
contained multiple :class:`.Mutable`-enabled attributes.

Fixes: #8133
Change-Id: I508763e0df0d7a624e1169f9a46d7f25404add1e

3 years agoMerge "Remove reflect=True in Base.prepare examples" into main
mike bayer [Tue, 14 Jun 2022 20:13:26 +0000 (20:13 +0000)] 
Merge "Remove reflect=True in Base.prepare examples" into main

3 years agoMerge "typing adjustments for composites" into main
mike bayer [Tue, 14 Jun 2022 20:12:10 +0000 (20:12 +0000)] 
Merge "typing adjustments for composites" into main

3 years agoMerge branch 'workflow_test_json'
Federico Caselli [Tue, 14 Jun 2022 19:56:29 +0000 (21:56 +0200)] 
Merge branch 'workflow_test_json'

Change-Id: I2112f9726fbbbb028ed5ce91f722573913b711de

3 years agotyping adjustments for composites
Mike Bayer [Tue, 14 Jun 2022 13:31:09 +0000 (09:31 -0400)] 
typing adjustments for composites

* if dataclass isn't used, columns have to be named
* _CompositeClassProto is not useful as dataclasses have no
  methods / bases we can use, so composite is against Any
* Adjust session.get() feature to work w/ dataclass composites

Change-Id: Icc606cc76871c738dc794ea4555fca8a1ab0e0fd

3 years agoadd contextual detail to cython change message
Mike Bayer [Tue, 14 Jun 2022 14:10:30 +0000 (10:10 -0400)] 
add contextual detail to cython change message

Change-Id: I57014a16f4718bdbe6eb91b8aeed7075cb4df5f1

3 years agoRemove reflect=True in Base.prepare examples
Gord Thompson [Tue, 14 Jun 2022 13:27:31 +0000 (07:27 -0600)] 
Remove reflect=True in Base.prepare examples

Change-Id: Icdb17fab0f92762a266efbe1a64bec1d5a6dc9ab

3 years agotry fixing the build
Federico Caselli [Mon, 13 Jun 2022 20:15:48 +0000 (22:15 +0200)] 
try fixing the build

Change-Id: Id2e965aa13a6d7134ca1081554cc5b25dbcc9fde

3 years agoremove docs from path ignore in the tests
Federico Caselli [Mon, 13 Jun 2022 19:48:34 +0000 (21:48 +0200)] 
remove docs from path ignore in the tests

Change-Id: I1d399d9532bc63d00a730e3981aef79ad99a97bb

3 years agoneed to use List here since we test on 3.7 at the moment
Mike Bayer [Mon, 13 Jun 2022 16:41:44 +0000 (12:41 -0400)] 
need to use List here since we test on 3.7 at the moment

Change-Id: I8a92fb81a71ae3936f299e2794f1d710fea0a589

3 years agoedits
Mike Bayer [Mon, 13 Jun 2022 15:58:46 +0000 (11:58 -0400)] 
edits

i dont have a good way to preview this.  not sure how i should
be editing here.

Change-Id: I399a5b0fa3fd2a03bbdc66f3a1dcb21043f7214a

3 years agoedits
Mike Bayer [Mon, 13 Jun 2022 15:56:04 +0000 (11:56 -0400)] 
edits

Change-Id: Id0bf143e948255c473558c68b3471fbe62bd98f6

3 years agotry to encourage more discussions, less bugs
Mike Bayer [Mon, 13 Jun 2022 15:54:06 +0000 (11:54 -0400)] 
try to encourage more discussions, less bugs

Change-Id: If7e07fffeea6d32af4f2e819111315783e902b8e

3 years agoMerge "add auto_recurse option to selectinload, immediateload" into main
mike bayer [Sun, 12 Jun 2022 17:46:33 +0000 (17:46 +0000)] 
Merge "add auto_recurse option to selectinload, immediateload" into main

3 years agoupdate quickstart for 2.0
Mike Bayer [Sun, 12 Jun 2022 16:07:54 +0000 (12:07 -0400)] 
update quickstart for 2.0

this is just so we can point people to something
while I get around to doing the rest of the docs

Change-Id: Ie818024a80ad30b76d7f7d6dc179939c246084c6

3 years agoadd auto_recurse option to selectinload, immediateload
Mike Bayer [Sat, 11 Jun 2022 15:33:46 +0000 (11:33 -0400)] 
add auto_recurse option to selectinload, immediateload

Added very experimental feature to the :func:`_orm.selectinload` and
:func:`_orm.immediateload` loader options called
:paramref:`_orm.selectinload.auto_recurse` /
:paramref:`_orm.immediateload.auto_recurse` , which when set to True will
cause a self-referential relationship load to continue loading with
arbitrary depth until no further objects are found. This may be useful for
self-referential structures that must be loaded fully eagerly, such as when
using asyncio.

Fixes: #8126
Change-Id: I5bbd00bd0ca43f4649b44680fea1e84680f0a5db

3 years agoMerge "honor enum length in all cases" into main
mike bayer [Fri, 10 Jun 2022 18:19:06 +0000 (18:19 +0000)] 
Merge "honor enum length in all cases" into main

3 years agoMerge "resolve large ints to BigInteger" into main
mike bayer [Fri, 10 Jun 2022 18:18:35 +0000 (18:18 +0000)] 
Merge "resolve large ints to BigInteger" into main

3 years agoresolve large ints to BigInteger
Mike Bayer [Fri, 10 Jun 2022 16:57:53 +0000 (12:57 -0400)] 
resolve large ints to BigInteger

The in-place type detection for Python integers, as occurs with an
expression such as ``literal(25)``, will now apply value-based adaption as
well to accommodate Python large integers, where the datatype determined
will be :class:`.BigInteger` rather than :class:`.Integer`. This
accommodates for dialects such as that of asyncpg which both sends implicit
typing information to the driver as well as is sensitive to numeric scale.

Fixes: #7909
Change-Id: I1cd3ec2676c9bb03ffedb600695252bd0037ba02

3 years agohonor enum length in all cases
Mike Bayer [Fri, 10 Jun 2022 16:42:54 +0000 (12:42 -0400)] 
honor enum length in all cases

The :paramref:`.Enum.length` parameter, which sets the length of the
``VARCHAR`` column for non-native enumeration types, is now used
unconditionally when emitting DDL for the ``VARCHAR`` datatype, including
when the :paramref:`.Enum.native_enum` parameter is set to ``True`` for
target backends that continue to use ``VARCHAR``. Previously the parameter
would be erroneously ignored in this case. The warning previously emitted
for this case is now removed.

Fixes: #7791
Change-Id: I91764546b56e9416479949be8a118cdc91ac5ed9

3 years agoremove "undefer_pks" as a strategy option
Mike Bayer [Fri, 10 Jun 2022 15:44:45 +0000 (11:44 -0400)] 
remove "undefer_pks" as a strategy option

The behavior of :func:`_orm.defer` regarding primary key and "polymorphic
discriminator" columns is revised such that these columns are no longer
deferrable, either explicitly or when using a wildcard such as
``defer('*')``. Previously, a wildcard deferral would not load
PK/polymorphic columns which led to errors in all cases, as the ORM relies
upon these columns to produce object identities. The behavior of explicit
deferral of primary key columns is unchanged as these deferrals already
were implicitly ignored.

Fixes: #7495
Change-Id: I76d9252426e86619bc142667670a3df75b4f5f6a

3 years agoMerge "update cx_Oracle / oracledb LOB handling" into main
mike bayer [Fri, 10 Jun 2022 15:11:44 +0000 (15:11 +0000)] 
Merge "update cx_Oracle / oracledb LOB handling" into main

3 years agoupdate cx_Oracle / oracledb LOB handling
Mike Bayer [Tue, 7 Jun 2022 20:09:35 +0000 (16:09 -0400)] 
update cx_Oracle / oracledb LOB handling

Adjustments made to the BLOB / CLOB / NCLOB datatypes in the cx_Oracle and
oracledb dialects, to improve performance based on recommendations from
Oracle developers.

References: https://github.com/oracle/python-cx_Oracle/issues/596
Fixes: #7494
Change-Id: I0d8cc3579140aa65cacf5b7d3373f7e1929a8f85

3 years agoMerge "restore parameter escaping for public methods" into main
mike bayer [Thu, 9 Jun 2022 16:03:53 +0000 (16:03 +0000)] 
Merge "restore parameter escaping for public methods" into main

3 years agoMerge "handle non-mapped mixins for with_loader_criteria reduce" into main
mike bayer [Thu, 9 Jun 2022 16:02:21 +0000 (16:02 +0000)] 
Merge "handle non-mapped mixins for with_loader_criteria reduce" into main

3 years agoMerge "dont transfer __weakref__ to regenerated class" into main
mike bayer [Thu, 9 Jun 2022 16:01:26 +0000 (16:01 +0000)] 
Merge "dont transfer __weakref__ to regenerated class" into main

3 years agoRevert "document thread safety workaround for lambda statements"
Mike Bayer [Thu, 9 Jun 2022 14:56:59 +0000 (10:56 -0400)] 
Revert "document thread safety workaround for lambda statements"

This reverts commit bf40bade26e32fc3757bbd756f4c9ebdc5d72090.

3 years agorestore parameter escaping for public methods
Mike Bayer [Thu, 9 Jun 2022 01:35:02 +0000 (21:35 -0400)] 
restore parameter escaping for public methods

Adjusted the fix made for :ticket:`8056` which adjusted the escaping of
bound parameter names with special characters such that the escaped names
were translated after the SQL compilation step, which broke a published
recipe on the FAQ illustrating how to merge parameter names into the string
output of a compiled SQL string. The change restores the escaped names that
come from ``compiled.params`` and adds a conditional parameter to
:meth:`.SQLCompiler.construct_params` named ``escape_names`` that defaults
to ``True``, restoring the old behavior by default.

Fixes: #8113
Change-Id: I9cbedb1080bc06d51f287fd2cbf26aaab1c74653

3 years agodont transfer __weakref__ to regenerated class
Mike Bayer [Thu, 9 Jun 2022 13:53:43 +0000 (09:53 -0400)] 
dont transfer __weakref__ to regenerated class

Repaired a deprecation warning class decorator that was preventing key
objects such as :class:`_engine.Connection` from having a proper
``__weakref__`` attribute, causing operations like Python standard library
``inspect.getmembers()`` to fail.

Fixes: #8115
Change-Id: Ifd0bc2325fb9dc9e1431998c308b7fc081968373

3 years agohandle non-mapped mixins for with_loader_criteria reduce
Mike Bayer [Thu, 9 Jun 2022 12:55:14 +0000 (08:55 -0400)] 
handle non-mapped mixins for with_loader_criteria reduce

special handling is needed for a with_loader_criteria()
against a non-mapped mixin class.  added that to test
coverage

Fixes: #8109
Change-Id: Ia599361c8faab008e92095eb4607d02820f590d5

3 years agoMerge "fix race conditions in lambda statements" into main
mike bayer [Thu, 9 Jun 2022 12:37:17 +0000 (12:37 +0000)] 
Merge "fix race conditions in lambda statements" into main

3 years agoMerge "suppport with_loader_criteria pickling w/ fixed callable" into main
mike bayer [Thu, 9 Jun 2022 00:54:16 +0000 (00:54 +0000)] 
Merge "suppport with_loader_criteria pickling w/ fixed callable" into main

3 years agoadd tests to confirm no issue w/ pg json keys
Mike Bayer [Wed, 8 Jun 2022 23:04:23 +0000 (19:04 -0400)] 
add tests to confirm no issue w/ pg json keys

Change-Id: Ie91e5efb217c309bc40c3933f538bcf29c1fd87b
References: #8112

3 years agodocument thread safety workaround for lambda statements
Mike Bayer [Wed, 8 Jun 2022 20:03:26 +0000 (16:03 -0400)] 
document thread safety workaround for lambda statements

Change-Id: Idb7840ff64487ef985087a28bb6e96088e6a392e
References: #8098

3 years agoMerge "graceful degrade for FKs not reflectable" into main
mike bayer [Wed, 8 Jun 2022 17:13:28 +0000 (17:13 +0000)] 
Merge "graceful degrade for FKs not reflectable" into main

3 years agosuppport with_loader_criteria pickling w/ fixed callable
Mike Bayer [Wed, 8 Jun 2022 17:05:20 +0000 (13:05 -0400)] 
suppport with_loader_criteria pickling w/ fixed callable

Fixed issue where a :func:`_orm.with_loader_criteria` option could not be
pickled, as is necessary when it is carried along for propagation to lazy
loaders in conjunction with a caching scheme. Currently, the only form that
is supported as picklable is to pass the "where criteria" as a fixed
module-level callable function that produces a SQL expression. An ad-hoc
"lambda" can't be pickled, and a SQL expression object is usually not fully
picklable directly.

Fixes: #8109
Change-Id: I49fe69088b0c7e58a0f22c67d2ea4e33752a5a73

3 years agoadd note re: pickling for loader criteria
Mike Bayer [Wed, 8 Jun 2022 15:54:46 +0000 (11:54 -0400)] 
add note re: pickling for loader criteria

Change-Id: I75992af71ba08799a03995178a6e4612c9a7428a
References: #8108

3 years agofix race conditions in lambda statements
Mike Bayer [Tue, 7 Jun 2022 19:00:20 +0000 (15:00 -0400)] 
fix race conditions in lambda statements

Fixed multiple observed race conditions related to :func:`.lambda_stmt`,
including an initial "dogpile" issue when a new Python code object is
initially analyzed among multiple simultaneous threads which created both a
performance issue as well as some internal corruption of state.
Additionally repaired observed race condition which could occur when
"cloning" an expression construct that is also in the process of being
compiled or otherwise accessed in a different thread due to memoized
attributes altering the ``__dict__`` while iterated, for Python versions
prior to 3.10; in particular the lambda SQL construct is sensitive to this
as it holds onto a single statement object persistently. The iteration has
been refined to use ``dict.copy()`` with or without an additional iteration
instead.

Fixes: #8098
Change-Id: I4e0b627bfa187f1780dc68ec81b94db1c78f846a

3 years agoMerge "Add support for the new oracle driver ``oracledb``." into main
mike bayer [Tue, 7 Jun 2022 18:46:36 +0000 (18:46 +0000)] 
Merge "Add support for the new oracle driver ``oracledb``." into main

3 years agoMerge "migrate labels to new tutorial" into main
mike bayer [Tue, 7 Jun 2022 17:02:20 +0000 (17:02 +0000)] 
Merge "migrate labels to new tutorial" into main

3 years agoAdd support for the new oracle driver ``oracledb``.
Federico Caselli [Fri, 3 Jun 2022 12:51:04 +0000 (14:51 +0200)] 
Add support for the new oracle driver ``oracledb``.

Fixes: #8054
Change-Id: Idd7c1bbb7ca39499f53bdf59a63a6a9d65f144a5

3 years agograceful degrade for FKs not reflectable
Mike Bayer [Tue, 7 Jun 2022 13:40:26 +0000 (09:40 -0400)] 
graceful degrade for FKs not reflectable

Fixed bugs involving the :paramref:`.Table.include_columns` and the
:paramref:`.Table.resolve_fks` parameters on :class:`.Table`; these
little-used parameters were apparently not working for columns that refer
to foreign key constraints.

In the first case, not-included columns that refer to foreign keys would
still attempt to create a :class:`.ForeignKey` object, producing errors
when attempting to resolve the columns for the foreign key constraint
within reflection; foreign key constraints that refer to skipped columns
are now omitted from the table reflection process in the same way as
occurs for :class:`.Index` and :class:`.UniqueConstraint` objects with the
same conditions. No warning is produced however, as we likely want to
remove the include_columns warnings for all constraints in 2.0.

In the latter case, the production of table aliases or subqueries would
fail on an FK related table not found despite the presence of
``resolve_fks=False``; the logic has been repaired so that if a related
table is not found, the :class:`.ForeignKey` object is still proxied to the
aliased table or subquery (these :class:`.ForeignKey` objects are normally
used in the production of join conditions), but it is sent with a flag that
it's not resolvable. The aliased table / subquery will then work normally,
with the exception that it cannot be used to generate a join condition
automatically, as the foreign key information is missing. This was already
the behavior for such foreign key constraints produced using non-reflection
methods, such as joining :class:`.Table` objects from different
:class:`.MetaData` collections.

Fixes: #8100
Fixes: #8101
Change-Id: Ifa37a91bd1f1785fca85ef163eec031660d9ea4d

3 years agomigrate labels to new tutorial
Mike Bayer [Sat, 4 Jun 2022 19:53:34 +0000 (15:53 -0400)] 
migrate labels to new tutorial

other org changes and some sections from old tutorial
ported to new tutorial.

Change-Id: Ic0fba60ec82fff481890887beef9ed0fa271875a

3 years agorun test_update_rowcount_return_defaults only w/ returning
Mike Bayer [Mon, 6 Jun 2022 14:58:59 +0000 (10:58 -0400)] 
run test_update_rowcount_return_defaults only w/ returning

sane_rowcount_w_returning asserts failure, which will only
occur here if the DBAPI actually uses RETURNING.

as SQLite conditionally supports RETURNING which breaks
rowcount support only if present, limit this test to that
case.

Additionally, newer pysqlites will likely fix the issue so
we will probably want to put a sqlite3_version check as well
once that fix is released.

Change-Id: I065aa181eb48363c1024550ae3622486ae0b4a6e

3 years agoMerge "Generalize RETURNING and suppor for MariaDB / SQLite" into main
mike bayer [Sun, 5 Jun 2022 20:40:41 +0000 (20:40 +0000)] 
Merge "Generalize RETURNING and suppor for MariaDB / SQLite" into main

3 years agoDocs Update - Add **kwargs to CaseInsensitiveComparator docs (#8063)
Justin Crown [Sat, 4 Jun 2022 20:10:38 +0000 (16:10 -0400)] 
Docs Update - Add **kwargs to CaseInsensitiveComparator docs (#8063)

* Add **kwargs to CaseInsensitiveComparator docs

* add kwargs to other operate examples

Change-Id: I70a1e68bca27c2355ad3b7c5bbc538027f112bd9

* missed one entry

Change-Id: Ieb4a18ab6d96e588e9ec7672cfa65fe2fd8301e5

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
3 years agoMerge "Fixed orm not applying fetch" into main
mike bayer [Sat, 4 Jun 2022 18:21:02 +0000 (18:21 +0000)] 
Merge "Fixed orm not applying fetch" into main

3 years agoFixed orm not applying fetch
Federico Caselli [Fri, 3 Jun 2022 10:13:10 +0000 (12:13 +0200)] 
Fixed orm not applying fetch

Fixed an issue where :meth:`_sql.GenerativeSelect.fetch` would be
ignored when executing a statement using the ORM.

Fixes: #8091
Change-Id: I6790c7272a71278e90de2529c8bc8ae89e54e288

3 years agofix some typos (#8093)
cui fliter [Sat, 4 Jun 2022 10:16:27 +0000 (18:16 +0800)] 
fix some typos (#8093)

Signed-off-by: cuishuang <imcusg@gmail.com>
3 years agoLink to dialect for Actian Avalanche, Vector, Actian X, and Ingres (#8039)
clach04 [Sat, 4 Jun 2022 10:15:17 +0000 (03:15 -0700)] 
Link to dialect for Actian Avalanche, Vector, Actian X, and Ingres (#8039)

3 years agodocs: spelling error (#8088)
Galen Rice [Sat, 4 Jun 2022 10:07:43 +0000 (06:07 -0400)] 
docs: spelling error (#8088)

Leave off the last S for savings!

3 years agosome typing fixes
Mike Bayer [Fri, 3 Jun 2022 14:34:19 +0000 (10:34 -0400)] 
some typing fixes

* ClassVar for decl fields, add __tablename__
* dataclasses require annotations for all fields.  For us,
  if no annotation, then skip that field as part of what is
  considered to be a "dataclass", as this matches the behavior
  of pyright right now.   We could alternatively raise on this
  use, which is what dataclasses does.   we should ask the pep
  people
* plain field that's just "str", "int", etc., with no value.
  Disallow it unless __allow_unmapped__ is set.   If field
  has dataclasses.field, Column, None, a value etc, it goes through,
  and when using dataclasses mixin all such fields are considered
  for the dataclass setup just like a dataclass.  Hopefully this
  does not have major backwards compat issues.  __allow_unmapped__
  can be set on the base class, mixins, etc., it's liberal for
  now in case people have this problem.
* accommodate for ClassVar, these are not considered at all for
  mapping.

Change-Id: Id743aa0456bade9a5d5832796caeecc3dc4accb7

3 years agoemphasize expire_on_commit in detached error docs
Mike Bayer [Thu, 2 Jun 2022 18:52:27 +0000 (14:52 -0400)] 
emphasize expire_on_commit in detached error docs

issues like #8082 suggest users are still not
fully aware of the need to set this parameter
when dealing with detached objects.

Change-Id: I6f389fdbe18b9c977bfb8188fc4732dbd56884d9

3 years agoGeneralize RETURNING and suppor for MariaDB / SQLite
Daniel Black [Tue, 28 Sep 2021 18:20:06 +0000 (14:20 -0400)] 
Generalize RETURNING and suppor for MariaDB / SQLite

As almost every dialect supports RETURNING now, RETURNING
is also made more of a default assumption.

* the default compiler generates a RETURNING clause now
  when specified; CompileError is no longer raised.
* The dialect-level implicit_returning parameter now has
  no effect.   It's not fully clear if there are real world
  cases relying on the dialect-level parameter, so we will see
  once 2.0 is released.   ORM-level RETURNING can be disabled
  at the table level, and perhaps "implicit returning" should
  become an ORM-level option at some point as that's where
  it applies.
* Altered ORM update() / delete() to respect table-level
  implicit returning for fetch.
* Since MariaDB doesnt support UPDATE returning, "full_returning"
  is now split into insert_returning, update_returning, delete_returning
* Crazy new thing.  Dialects that have *both* cursor.lastrowid
  *and* returning.   so now we can pick between them for SQLite
  and mariadb.  so, we are trying to keep it on .lastrowid for
  simple inserts with an autoincrement column, this helps with
  some edge case test scenarios and i bet .lastrowid is faster
  anyway.  any return_defaults() / multiparams etc then we
  use returning
* SQLite decided they dont want to return rows that match in
  ON CONFLICT.  this is flat out wrong, but for now we need to
  work with it.

Fixes: #6195
Fixes: #7011
Closes: #7047
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7047
Pull-request-sha: d25d5ea3abe094f282c53c7dd87f5f53a9e85248

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I9908ce0ff7bdc50bd5b27722081767c31c19a950

3 years agoMerge "propagate proxy_key from WrapsColumnExpression" into main
mike bayer [Wed, 1 Jun 2022 17:27:13 +0000 (17:27 +0000)] 
Merge "propagate proxy_key from WrapsColumnExpression" into main

3 years agoMerge "add backend agnostic UUID datatype" into main
mike bayer [Wed, 1 Jun 2022 16:13:36 +0000 (16:13 +0000)] 
Merge "add backend agnostic UUID datatype" into main

3 years agopropagate proxy_key from WrapsColumnExpression
Mike Bayer [Wed, 1 Jun 2022 16:11:19 +0000 (12:11 -0400)] 
propagate proxy_key from WrapsColumnExpression

this allows cast() of a label() to propagate the
proxy key outwards in the same way that it apparently
works at the SQL level.

This is stuffing even more rules into naming so basically
seeing how far we can go without other cases starting
to fail.

Fixes: #8084
Change-Id: I20bd97dae798fee6492334c06934e807d0f269ef

3 years agoadd backend agnostic UUID datatype
Mike Bayer [Fri, 11 Feb 2022 09:54:45 +0000 (04:54 -0500)] 
add backend agnostic UUID datatype

Added new backend-agnostic :class:`_types.Uuid` datatype generalized from
the PostgreSQL dialects to now be a core type, as well as migrated
:class:`_types.UUID` from the PostgreSQL dialect. Thanks to Trevor Gross
for the help on this.

also includes:

* corrects some missing behaviors in the suite literal fixtures
  test where row round trips weren't being correctly asserted.
* fixes some of the ISO literal date rendering added in
  952383f9ee0 for #5052 to truncate datetime strings for date/time
  datatypes in the same way that drivers typically do for bound
  parameters; this was not working fully and wasn't caught by the
  broken test fixture

Fixes: #7212
Change-Id: I981ac6d34d278c18281c144430a528764c241b04

3 years agoMerge "Support handle_error for pre_ping" into main
mike bayer [Wed, 1 Jun 2022 13:58:17 +0000 (13:58 +0000)] 
Merge "Support handle_error for pre_ping" into main

3 years agocherry-pick changelog update for 1.4.38
Mike Bayer [Tue, 31 May 2022 21:28:09 +0000 (17:28 -0400)] 
cherry-pick changelog update for 1.4.38

3 years agocherry-pick changelog from 1.4.37
Mike Bayer [Tue, 31 May 2022 21:28:08 +0000 (17:28 -0400)] 
cherry-pick changelog from 1.4.37

3 years agochangelog fixes
Mike Bayer [Tue, 31 May 2022 21:21:39 +0000 (17:21 -0400)] 
changelog fixes

Change-Id: Id3fc3019f8eb799aa5adf6ca28e0aeedc0da31dd

3 years agoMerge "establish sessionmaker and async_sessionmaker as generic" into main
mike bayer [Tue, 31 May 2022 20:56:53 +0000 (20:56 +0000)] 
Merge "establish sessionmaker and async_sessionmaker as generic" into main