]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
21 months agodont mis-render value from previous loop iteration
Mike Bayer [Thu, 19 Oct 2023 15:21:26 +0000 (11:21 -0400)] 
dont mis-render value from previous loop iteration

Fixed issue where using the same bound parameter more than once with
``literal_execute=True`` in some combinations with other literal rendering
parameters would cause the wrong values to render due to an iteration
issue.

Fixes: #10142
Change-Id: Idde314006568e3445558f0104aed9d2f4af72b56
(cherry picked from commit 9fe7c291921540df9173820d3a06b949d7a3d949)

21 months agofix 1.4 test suite
Mike Bayer [Thu, 19 Oct 2023 13:59:34 +0000 (09:59 -0400)] 
fix 1.4 test suite

add some recent fixes so we can get new 1.4 fixes merged

Change-Id: I692c8adb6b22f10629b9d797c1a64334d43f13b3

21 months agoupdate pipelines to include 3.12
Federico Caselli [Thu, 5 Oct 2023 19:16:14 +0000 (21:16 +0200)] 
update pipelines to include 3.12

Change-Id: I894a03089e4b7eedb3e42de9554c19f9ffea8ce1

22 months agoremove ancient engine.execute() reference from main engine doc
Mike Bayer [Thu, 7 Sep 2023 22:28:32 +0000 (18:28 -0400)] 
remove ancient engine.execute() reference from main engine doc

Change-Id: I51a30c2e53ad7da3e1209b5623388dd2aea7589c
(cherry picked from commit c16ed9dd24a091dbaba4683ae2f04a3f199416bf)

23 months agoFix rendering of order in sequences and identity columns.
Federico Caselli [Wed, 9 Aug 2023 21:27:21 +0000 (23:27 +0200)] 
Fix rendering of order in sequences and identity columns.

Fixes the rendering of the Oracle only ``order`` attribute in
Sequence and Identity that was passed also when rendering
the DDL in PostgreSQL.

Fixes: #10207
Change-Id: I5b918eab38ba68fa10a213a79e2bd0cc48401a02
(cherry picked from commit 5615ab52c81e2343330069f91ec3544840519956)

23 months agofix test for mysql
Mike Bayer [Tue, 15 Aug 2023 13:41:50 +0000 (09:41 -0400)] 
fix test for mysql

Change-Id: Ib05d950a4284412d2daf9b315314c46a70d9cdc7

23 months agoupdate CI supported DB versions
Mike Bayer [Mon, 14 Aug 2023 18:20:12 +0000 (14:20 -0400)] 
update CI supported DB versions

Change-Id: I6f7991242eebc2b25df96e6779881882d29eb7a1
(cherry picked from commit 41cb8f7c05c51b9ceb28dab16d348652e4bc7d82)

23 months agosafe annotate QueryableAttribute inside of join() condition
Mike Bayer [Thu, 10 Aug 2023 22:26:45 +0000 (18:26 -0400)] 
safe annotate QueryableAttribute inside of join() condition

Fixed fundamental issue which prevented some forms of ORM "annotations"
from taking place for subqueries which made use of :meth:`_sql.Select.join`
against a relationship target.  These annotations are used whenever a
subquery is used in special situations such as within
:meth:`_orm.PropComparator.and_` and other ORM-specific scenarios.

Fixes: #10223
Change-Id: I40f04265a6caa0fdcbc9f1b121a35561ab4b1fcf
(cherry picked from commit 6cfdc0743b7d1ebee3582f612a4f8acaa6ab42f9)

23 months agoMerge "implement custom setstate to work around implicit type/comparator" into rel_1_4
mike bayer [Thu, 10 Aug 2023 21:04:40 +0000 (21:04 +0000)] 
Merge "implement custom setstate to work around implicit type/comparator" into rel_1_4

23 months agore-add aiomysql to the ci, remove unmaintained note
Federico Caselli [Sat, 5 Aug 2023 10:02:53 +0000 (12:02 +0200)] 
re-add aiomysql to the ci, remove unmaintained note

References: #6893
Change-Id: Ifb70975f686eef2b7239ca266e9dbfff1f1007cb
(cherry picked from commit 8bacaad859b63418c1dd6099b4a8c7f00727c23e)

23 months agoimplement custom setstate to work around implicit type/comparator
Mike Bayer [Wed, 9 Aug 2023 14:17:35 +0000 (10:17 -0400)] 
implement custom setstate to work around implicit type/comparator

Fixed issue where unpickling of a :class:`_schema.Column` or other
:class:`_sql.ColumnElement` would fail to restore the correct "comparator"
object, which is used to generate SQL expressions specific to the type
object.

Fixes: #10213
Change-Id: I74e805024bcc0d93d549bd94757c2865b3117d72
(cherry picked from commit 9d2b83740ad5c700b28cf4ca7807c09c7338c36a)

23 months agoupdate for latest flake8
Mike Bayer [Wed, 9 Aug 2023 21:26:54 +0000 (17:26 -0400)] 
update for latest flake8

Change-Id: Ic0282fd1de889d1dcf22a1aad6e09fe3aa074dc2

2 years agofix typo in test pipeline
Federico Caselli [Mon, 10 Jul 2023 20:25:13 +0000 (22:25 +0200)] 
fix typo in test pipeline

Change-Id: I596c38cfcf56552deb913b494dd10ee4b1d68462

2 years agorepair pipelines for 2.7
Federico Caselli [Thu, 6 Jul 2023 20:49:05 +0000 (22:49 +0200)] 
repair pipelines for 2.7

Change-Id: Id4766704e4f7e4da2495ebdd8f44e4618a695df5

2 years agoVersion 1.4.50 placeholder
Mike Bayer [Wed, 5 Jul 2023 17:56:40 +0000 (13:56 -0400)] 
Version 1.4.50 placeholder

2 years ago- 1.4.49 rel_1_4_49
Mike Bayer [Wed, 5 Jul 2023 17:45:01 +0000 (13:45 -0400)] 
- 1.4.49

2 years agochangelog updates
Mike Bayer [Wed, 5 Jul 2023 17:37:25 +0000 (13:37 -0400)] 
changelog updates

Change-Id: If3baf79906d062e1e046d7c31b38eeeefdc984bf
(cherry picked from commit 0346da63f009740df2f3c1c94b80f995168d5d9e)

2 years agoupdate mypy warnings / deprecation
Mike Bayer [Wed, 5 Jul 2023 14:04:08 +0000 (10:04 -0400)] 
update mypy warnings / deprecation

Change-Id: Ib89f80568427833561f644894791f7d68caada0d

2 years agoremove use of SQL expressions in "modifiers" for regexp
Mike Bayer [Fri, 30 Jun 2023 14:14:55 +0000 (10:14 -0400)] 
remove use of SQL expressions in "modifiers" for regexp

Fixed issue where the :meth:`_sql.ColumnOperators.regexp_match`
when using "flags" would not produce a "stable" cache key, that
is, the cache key would keep changing each time causing cache pollution.
The same issue existed for :meth:`_sql.ColumnOperators.regexp_replace`
with both the flags and the actual replacement expression.
The flags are now represented as fixed modifier strings rendered as
safestrings rather than bound parameters, and the replacement
expression is established within the primary portion of the "binary"
element so that it generates an appropriate cache key.

Note that as part of this change, the
:paramref:`_sql.ColumnOperators.regexp_match.flags` and
:paramref:`_sql.ColumnOperators.regexp_replace.flags` have been modified to
render as literal strings only, whereas previously they were rendered as
full SQL expressions, typically bound parameters.   These parameters should
always be passed as plain Python strings and not as SQL expression
constructs; it's not expected that SQL expression constructs were used in
practice for this parameter, so this is a backwards-incompatible change.

The change also modifies the internal structure of the expression
generated, for :meth:`_sql.ColumnOperators.regexp_replace` with or without
flags, and for :meth:`_sql.ColumnOperators.regexp_match` with flags. Third
party dialects which may have implemented regexp implementations of their
own (no such dialects could be located in a search, so impact is expected
to be low) would need to adjust the traversal of the structure to
accommodate.

Fixed issue in mostly-internal :class:`.CacheKey` construct where the
``__ne__()`` operator were not properly implemented, leading to nonsensical
results when comparing :class:`.CacheKey` instances to each other.

Fixes: #10042
Change-Id: I2e245f81d7ee7136ad04cf77be35f9745c5da5e5
(cherry picked from commit 2d8ff4f9171bcef9fa70dfa27f2c0cab708fd75e)

2 years agoadjust py312 fix
Mike Bayer [Mon, 3 Jul 2023 12:09:06 +0000 (08:09 -0400)] 
adjust py312 fix

- version detection should anticipate pyhex version on 3.12.0.0
- github actions has removed py2.7 totally
- put changelog in correct place / tags
- not sure what to do for py2.7 wheels for 1.4.   might have to just go
  with there being no py2.7 wheel on pypi

Change-Id: I3f0b3fa1adc3f0c4e6bb62f31e6494eeda88ba78

2 years agoadd 3.12
Federico Caselli [Mon, 22 May 2023 19:54:47 +0000 (21:54 +0200)] 
add 3.12

Initial fixes to test to accommodate py312

this is a backport of 59521abcc0676e936b31a523bd968fc157fef0c2
however includes greenlet>=3.0.0a1 that now builds and/or installs
on Python 3.12.

result row handling is also different in 1.4.

Fixes: #9819
Change-Id: I91a51dcbad2902f7c4c7cec88ebbf42c2417b512
(cherry picked from commit 59521abcc0676e936b31a523bd968fc157fef0c2)

2 years agoqualify mypy1.4 update for python 3.9, 3.10 +
Mike Bayer [Wed, 21 Jun 2023 18:59:21 +0000 (14:59 -0400)] 
qualify mypy1.4 update for python 3.9, 3.10 +

in I68084199858e9da901641d6036780437bcf5f2d6 we added a mypy1.4
check to check for new-style type messages.  mypy only
does lowercase types on python 3.9 and above, OR syntax on 3.10
and above.  qualify these both

Change-Id: Ic1ee12927ae02c1936d1c2905db28b587c7fece7
(cherry picked from commit cb39c0109ef5167de3a7a682cc553480172dac82)

2 years agoupdates for mypy 1.4
Mike Bayer [Tue, 20 Jun 2023 19:24:38 +0000 (15:24 -0400)] 
updates for mypy 1.4

mypy 1.4 is reporting new style types list[], tuple[], etc.
as well as "x | None" for optional.

they also added one argument for format_type().

This is for 1.4 backport as well

Change-Id: I68084199858e9da901641d6036780437bcf5f2d6
(cherry picked from commit f79d09221b1ec6cd6bc8d83d6e947db5f75c6d1c)

2 years agoclarify exec_driver_sql
Mike Bayer [Fri, 19 May 2023 13:50:09 +0000 (09:50 -0400)] 
clarify exec_driver_sql

this docstring wasn't really saying what this method was for.

Change-Id: I2d83ed2690c93d215faadaf7c6edcb02c6c57a6f
(cherry picked from commit 75d716c7799e28ba5c86c72db08025dd6fc8c6e0)

2 years agoqualify session.execute() resulting in autoflush
Mike Bayer [Sat, 13 May 2023 02:30:40 +0000 (22:30 -0400)] 
qualify session.execute() resulting in autoflush

maybe this was planned differently at some point but
session.execute() only autoflushes for ORM contexts.

Change-Id: Ia10af232248e321875f79d5bde71f64d3dc25177
References: #9776
(cherry picked from commit eb286c15f096771dbb128acbe8fe03e94aa72f6a)

2 years agonote future row change for session.execute()
Mike Bayer [Wed, 10 May 2023 14:08:47 +0000 (10:08 -0400)] 
note future row change for session.execute()

Fixes: #9761
Change-Id: I555e822b092d047badab86b3a365380121968592
(cherry picked from commit 987285fb4b13c39bcc6b8922e618d9e830577dda)

2 years agoVersion 1.4.49 placeholder
Mike Bayer [Sun, 30 Apr 2023 21:33:17 +0000 (17:33 -0400)] 
Version 1.4.49 placeholder

2 years ago- 1.4.48 rel_1_4_48
Mike Bayer [Sun, 30 Apr 2023 21:24:32 +0000 (17:24 -0400)] 
- 1.4.48

2 years agoadjust verbiage
Mike Bayer [Sun, 30 Apr 2023 21:22:44 +0000 (17:22 -0400)] 
adjust verbiage

Change-Id: Icc8f201d63e4cc2e7df2f42acb28a6dc84a58342
(cherry picked from commit 623044bb54a58eaa25ed239b7646396548f4b1e7)

2 years agodo not allow non-cache-key entity objects in annotations
Mike Bayer [Sun, 30 Apr 2023 17:56:33 +0000 (13:56 -0400)] 
do not allow non-cache-key entity objects in annotations

Fixed critical caching issue where combination of :func:`_orm.aliased()`
:func:`_sql.case` and :func:`_hybrid.hybrid_property` expressions would
cause a cache key mismatch, leading to cache keys that held onto the actual
:func:`_orm.aliased` object while also not matching each other, filling up
the cache.

Fixes: #9728
Change-Id: I700645b5629a81a0104cf923db72a7421fa43ff4
(cherry picked from commit 4d69d83530666f9aaf3fb327d8c63110ef5e7ff5)

2 years agouse a lot more random names
Mike Bayer [Thu, 27 Apr 2023 13:49:07 +0000 (09:49 -0400)] 
use a lot more random names

very small number of tiny names generated by
random_names() could cause _ordered_name_fixture() to
run out of names.

Fixes: #9706
Change-Id: I3df00c9cf99e76fe82eb535c7fe589b73b10cd67
(cherry picked from commit 1329037bfed428e458547824a861ce1aa9df0c78)

2 years agodont assume _compile_options are present
Mike Bayer [Mon, 17 Apr 2023 14:16:35 +0000 (10:16 -0400)] 
dont assume _compile_options are present

Fixed bug where various ORM-specific getters such as
:attr:`.ORMExecuteState.is_column_load`,
:attr:`.ORMExecuteState.is_relationship_load`,
:attr:`.ORMExecuteState.loader_strategy_path` etc. would throw an
``AttributeError`` if the SQL statement itself were a "compound select"
such as a UNION.

Fixes: #9634
Change-Id: Ia37df5d6f89d6534d69237dcab294bd849ece28b
(cherry picked from commit 89608ccd3f5e5796d578e9a39201f7c5c45a61fe)

2 years agoclarify get_isolation_level() excludes AUTOCOMMIT
Mike Bayer [Mon, 17 Apr 2023 12:22:49 +0000 (08:22 -0400)] 
clarify get_isolation_level() excludes AUTOCOMMIT

I thought this was documented but apparently not.

Fixes: #9658
Change-Id: I93fad12c159c599ffdbab1aff586b49e8c92a6e4
(cherry picked from commit f7bfa04bcae1e9bafa19a5ee03aaa0beac532294)

2 years agoconsider aliased mappers in cycles also
Mike Bayer [Sun, 2 Apr 2023 18:24:32 +0000 (14:24 -0400)] 
consider aliased mappers in cycles also

Fixed endless loop which could occur when using "relationship to aliased
class" feature and also indicating a recursive eager loader such as
``lazy="selectinload"`` in the loader, in combination with another eager
loader on the opposite side. The check for cycles has been fixed to include
aliased class relationships.

Fixes: #9590
Change-Id: I8d340882f040ff9289c209bedd8fbdfd7186f944
(cherry picked from commit e79ab08165e01dc7af50fcffadb31468ace51b6c)

2 years agoadd tip that reflection is not necessary for an existing database
Mike Bayer [Tue, 21 Mar 2023 17:40:36 +0000 (13:40 -0400)] 
add tip that reflection is not necessary for an existing database

a new user spent many days misled by this paragraph thinking
they were required to use reflection for an existing database.

Change-Id: I4c6757b931481db7a8d4202334382143e1491935
(cherry picked from commit 42b3b80fae8d7b808125efc1dd9a900231c2ed21)

2 years agoVersion 1.4.48 placeholder
Mike Bayer [Sat, 18 Mar 2023 17:09:08 +0000 (13:09 -0400)] 
Version 1.4.48 placeholder

2 years ago- 1.4.47 rel_1_4_47
Mike Bayer [Sat, 18 Mar 2023 17:04:58 +0000 (13:04 -0400)] 
- 1.4.47

2 years agoimplement content hashing for custom_op, not identity
Mike Bayer [Sat, 18 Mar 2023 15:43:47 +0000 (11:43 -0400)] 
implement content hashing for custom_op, not identity

Fixed critical SQL caching issue where use of the :meth:`_sql.Operators.op`
custom operator function would not produce an appropriate cache key,
leading to reduce the effectiveness of the SQL cache.

Fixes: #9506
Change-Id: I3eab1ddb5e09a811ad717161a59df0884cdf70ed
(cherry picked from commit 0a0c7c73729152b7606509b6e750371106dfdd46)

2 years agoremove "listeners" docstring
Mike Bayer [Wed, 15 Mar 2023 14:09:57 +0000 (10:09 -0400)] 
remove "listeners" docstring

this should have been removed with #4638.

Fixes: #9492
Change-Id: If82dba7e63382e921aceb0c01d88f0977b7f5e8d
(cherry picked from commit 7fd3b4747d2935effd9e0c2bbe72f080df4ffc50)

2 years agoadditional consistency for ORM/Core in tutorial
Mike Bayer [Wed, 8 Mar 2023 15:10:14 +0000 (10:10 -0500)] 
additional consistency for ORM/Core in tutorial

* Make sure we have blue borders for all sections
* rewrite "blue border" text, refer to textual means of determining
  subject matter for a section; "blue borders" are not a primary
  source of information
* Add some more intro text that was missing

Change-Id: I4d599e13d23bad8bb3c199a11afb53e3e9100c59
References: #9450
(cherry picked from commit 8d5986fafd8360ddfe3992bd56602d5a52a23392)

2 years agoAdd separate version notes for scalars
Grey Li [Sun, 26 Feb 2023 10:56:37 +0000 (05:56 -0500)] 
Add separate version notes for scalars

Add separate 1.4.24 and 1.4.26 version notes for the .scalars method;
this covers Session, scoped_session, AsyncSession, async_scoped_session
as the "scoped" versions did not have the method added until 1.4.26
as part of :ticket:`7103`.

Also indicate scoped_session as ``sqlalchemy.orm.scoped_session`` in
docs rather than ``sqlalchemy.orm.scoping.scoped_session``.  This is
also happening in I77da54891860095edcb1f0625ead99fee89bd76f separately,
as both changesets refer to scoped_session without using ".scoping".

References: #7103
Closes: #9371
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9371
Pull-request-sha: 61132230cc6e897ab61beff25d98b19a4c0aefd0

Change-Id: I84c8b1aad752db124cfee6bc8516f6eed7ba2faf
(cherry picked from commit ff97b9ab5e59283f684edac9a075702c43e8a4c1)

2 years agoprevent float tests from running on asyncmy
Mike Bayer [Wed, 15 Feb 2023 23:28:12 +0000 (18:28 -0500)] 
prevent float tests from running on asyncmy

asyncmy 0.2.7 has had a loss in float precision for even
very low numbers of significant digits.

Change-Id: Iec6d2650943eeaa8e854f21990f6565d73331f8c
References: https://github.com/long2ice/asyncmy/issues/56
(cherry picked from commit 8855656626202e541bd2c95bc023e820a022322f)

2 years agoUpdate dialect documentation about CrateDB (#9322)
Andreas Motl [Sun, 19 Feb 2023 16:47:02 +0000 (08:47 -0800)] 
Update dialect documentation about CrateDB (#9322)

The `crate-0.30.0` package offers compatibility with SQLAlchemy 2.0.

(cherry picked from commit 46b81981340a703ae4fbe47fcdaaec85a590d5e9)

2 years agoFix grammatical error in intro.rst (#9316)
Maxwell D. Dorliea [Sun, 19 Feb 2023 16:46:42 +0000 (16:46 +0000)] 
Fix grammatical error in intro.rst (#9316)

(cherry picked from commit 1fc1aafbc4bd5bc85289699c0de1d82cb6cbc2d3)

2 years agopin sphinx-copybutton and change config
Mike Bayer [Thu, 9 Feb 2023 17:05:47 +0000 (12:05 -0500)] 
pin sphinx-copybutton and change config

sphinx-copybutton introduced a new feature
in 0.5.1 which includes a default configuration
that breaks the regexp prompt matching scheme.

set copybutton_exclude to not include ".gp" as that's the class
where we exactly look for the prompts we are matching.
While we're there, use this new feature to exclude our sql
styles, even though this is not strictly necessary in our case.

pin sphinx-copybutton at 0.5.1 to avoid future problems.

Change-Id: I8eaeab13995c032b9ee3afd1f08dae5929009d45
References: https://github.com/executablebooks/sphinx-copybutton/issues/185
(cherry picked from commit 13d3b2c291f49525bc38d082d1c2abe9e03bd3fe)

2 years agofix late-eval example
Mike Bayer [Wed, 1 Feb 2023 16:18:55 +0000 (11:18 -0500)] 
fix late-eval example

Fixes: #9209
Change-Id: Ic5bc87b25281e3cecc967843c402e96c7c2a3dbb
(cherry picked from commit bfc33c5c72e3b24fd62d80b77441b38f40c746b0)

2 years agouse scalars().one() for count migration
Mike Bayer [Mon, 30 Jan 2023 14:02:33 +0000 (09:02 -0500)] 
use scalars().one() for count migration

so that the typed result is non-optional

Fixes: #9184
Change-Id: I40e655010d08f795f3b835b9327ce50c6ec72135
(cherry picked from commit 956f152a29632afacacc4ea11dce1a54a7afb3ea)

2 years agoCorrect #7664 to include DropSchema
Mike Bayer [Sat, 28 Jan 2023 14:37:50 +0000 (09:37 -0500)] 
Correct #7664 to include DropSchema

Corrected the fix for :ticket:`7664`, released in version 2.0.0, to also
include :class:`.DropSchema` which was inadvertently missed in this fix,
allowing stringification without a dialect. The fixes for both constructs
is backported to the 1.4 series as of 1.4.47.

Fixes: #7664
Change-Id: I509b7500ee496ac1e444ea2096c2a02520167e6d
(cherry picked from commit 70d1de6cff816d4627dd6b72223d9796e28aca1e)

2 years agofix incorrect use of testing.future()
Mike Bayer [Thu, 26 Jan 2023 01:19:10 +0000 (20:19 -0500)] 
fix incorrect use of testing.future()

this has been emitting a warning probably for a long
time

Change-Id: I44a6766b5e92d14ce6bbb5a90ab52648f877afc2
(cherry picked from commit 74aabce5190449ba2af65c180ebe67fe444193fb)

2 years agodisable new tox 4.4.0 feature
Mike Bayer [Wed, 25 Jan 2023 22:34:08 +0000 (17:34 -0500)] 
disable new tox 4.4.0 feature

a new flag constrain_package_deps appears to interpret deps
as constraints, and not requirements.  turn it off.

also remove the python setup command and use their default,
try to stay compatible

Change-Id: Ib400a7783c08c2c63ddb099944cd48b9631acd75
(cherry picked from commit aa2c2c8b4189b0fd71e7f8af0a81eda4204678f9)

2 years agoMerge "reflect Oracle ROWID" into rel_1_4
mike bayer [Wed, 25 Jan 2023 01:46:41 +0000 (01:46 +0000)] 
Merge "reflect Oracle ROWID" into rel_1_4

2 years agoreflect Oracle ROWID
Mike Bayer [Tue, 24 Jan 2023 20:08:30 +0000 (15:08 -0500)] 
reflect Oracle ROWID

Added :class:`_oracle.ROWID` to reflected types as this type may be used in
a "CREATE TABLE" statement.

For 1.4, the cherry-pick also backports a few more type reflection
tests that should pass without issue.

Fixes: #5047
Change-Id: I818dcf68ed81419d0fd5df5e2d51d6fa0f1be7fc
(cherry picked from commit 1c6c5532d8bec105d9aaa7843a176b4e1ef0340a)

2 years agofix stringify for CreateSchema
Mike Bayer [Tue, 24 Jan 2023 20:34:27 +0000 (15:34 -0500)] 
fix stringify for CreateSchema

Fixed stringify for a the :class:`.CreateSchema` DDL construct, which would
fail with an ``AttributeError`` when stringified without a dialect.

Fixes: #7664
Change-Id: Ifc1769604bc5219c060f5112f7bdea0f780f1a1c
(cherry picked from commit 90f4b5d84f248d95f3df38e74be92b23fd880e42)

2 years agoRun bracket interpretation for reflection
Shan [Sun, 22 Jan 2023 16:19:11 +0000 (11:19 -0500)] 
Run bracket interpretation for reflection

Fixed bug where a schema name given with brackets, but no dots inside the
name, for parameters such as :paramref:`_schema.Table.schema` would not be
interpreted within the context of the SQL Server dialect's documented
behavior of interpreting explicit brackets as token delimiters, first added
in 1.2 for #2626, when referring to the schema name in reflection
operations. The original assumption for #2626's behavior was that the
special interpretation of brackets was only significant if dots were
present, however in practice, the brackets are not included as part of the
identifier name for all SQL rendering operations since these are not valid
characters within regular or delimited identifiers.  Pull request courtesy
Shan.

Fixes: #9133
Closes: #9134
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9134
Pull-request-sha: 5dac87c82cd3063dd8e50f0075c7c00330be6439

Change-Id: I7a507bc38d75a04ffcb7e920298775baae22c6d1
(cherry picked from commit aa50375a9aa72be896a7cf3afbbbec161c7111bd)

2 years agomypy plugin fixes
Mike Bayer [Tue, 17 Jan 2023 01:17:50 +0000 (20:17 -0500)] 
mypy plugin fixes

Adjustments made to the mypy plugin to accommodate for some potential
changes being made for issue #236 sqlalchemy2-stubs when using SQLAlchemy
1.4. These changes are being kept in sync within SQLAlchemy 2.0.
The changes are also backwards compatible with older versions of
sqlalchemy2-stubs.

Fixed crash in mypy plugin which could occur on both 1.4 and 2.0 versions
if a decorator for the :func:`_orm.registry.mapped` decorator were used
that was referenced in an expression with more than two components (e.g.
``@Backend.mapper_registry.mapped``). This scenario is now ignored; when
using the plugin, the decorator expression needs to be two components (i.e.
``@reg.mapped``).

References: https://github.com/sqlalchemy/sqlalchemy2-stubs/issues/236
Fixes: #9102
Change-Id: Ieb1bf7bf8184645bcd43253e57f1c267b2640537
(cherry picked from commit cf64582f61b15716228302f669322d7efa1003c1)
(cherry picked from commit 36285760238314f70eed4532ca2c2c0c2d684609)

2 years agoapply changelog note for change of column loader options
Mike Bayer [Mon, 16 Jan 2023 21:02:07 +0000 (16:02 -0500)] 
apply changelog note for change of column loader options

Change-Id: Ib9a69e20420e1fda755f4533c5f90bc08ba11b48
References: #8879
References: #9101
(cherry picked from commit 5e6cb26a017fb72bc3f925194c6f8c1eda968fbe)

2 years agofix orm-header for standalone
Mike Bayer [Sun, 15 Jan 2023 16:28:22 +0000 (11:28 -0500)] 
fix orm-header for standalone

Change-Id: I20e7f8ad5800c2ce5cdc9645c4dbe66f53b8cdf8
(cherry picked from commit 48eed9eb9c6ba853b48e41ef6038ec97c5a3fb68)

2 years agoRemove missing doc section
Federico Caselli [Thu, 12 Jan 2023 22:08:33 +0000 (23:08 +0100)] 
Remove missing doc section

Change-Id: Ic6dda7f32a7561a0c0a92b8a7c08e44cb174eec1

2 years agoMerge "add with_loader_criteria() test for #8064 / #9091" into rel_1_4
mike bayer [Thu, 12 Jan 2023 18:55:16 +0000 (18:55 +0000)] 
Merge "add with_loader_criteria() test for #8064 / #9091" into rel_1_4

2 years agoMove docs in mysql dbapi
Federico Caselli [Wed, 11 Jan 2023 19:33:16 +0000 (20:33 +0100)] 
Move docs in mysql dbapi

Fixes: #9084
Change-Id: I5e174c318a20b7fcb5ea7c771293c5102e761ed7
(cherry picked from commit a06cd94baab114cd0b2fa0987267e31811d38f7a)

2 years agoadd with_loader_criteria() test for #8064 / #9091
Mike Bayer [Thu, 12 Jan 2023 16:25:39 +0000 (11:25 -0500)] 
add with_loader_criteria() test for #8064 / #9091

test related to #8064, added after discussion #9091 which
requested this behavior for with_loader_criteria() where it was
found to be working as of this issue, just not tested

Change-Id: I703f25af3708e49380b6004badd3a8ffb783ef70
References: #8064
References: #9091
(cherry picked from commit a2bf6f1bb4a56dfe6c6d1fe22c3a4e84f5da99bc)

2 years agofix ORM support for column-named bindparam() in crud .values()
Mike Bayer [Tue, 10 Jan 2023 14:51:23 +0000 (09:51 -0500)] 
fix ORM support for column-named bindparam() in crud .values()

Fixed bug / regression where using :func:`.bindparam()` with the same name
as a column in the :meth:`.Update.values` method of :class:`.Update`, as
well as the :meth:`.Insert.values` method of :class:`.Insert` in 2.0 only,
would in some cases silently fail to honor the SQL expression in which the
parameter were presented, replacing the expression with a new parameter of
the same name and discarding any other elements of the SQL expression, such
as SQL functions, etc. The specific case would be statements that were
constructed against ORM entities rather than plain :class:`.Table`
instances, but would occur if the statement were invoked with a
:class:`.Session` or a :class:`.Connection`.

:class:`.Update` part of the issue was present in both 2.0 and 1.4 and is
backported to 1.4.

For 1.4, also backports the sqlalchemy.testing.Variation update
to the variation() API.

Fixes: #9075
Change-Id: Ie954bc1f492ec6a566163588182ef4910c7ee452
(cherry picked from commit b5b864e0fe50243a94c0ef04fddda6fa446c1524)

2 years agoremove misleading line in post_update
Mike Bayer [Mon, 9 Jan 2023 17:38:10 +0000 (12:38 -0500)] 
remove misleading line in post_update

this UPDATE refers to the unit of work's need to consider this
additional UPDATE as a dependency and not an actual UPDATE statement.

Change-Id: I2a520af21ebf96b45c431efa898d4e7683a5bc2d
References: #9066
References: #1063
(cherry picked from commit 2ef4b449a7709ecab45e926f0e8d0dd398fd12db)

2 years agoMerge "include parsed col length field as integer from mysql index reflection" into...
mike bayer [Thu, 5 Jan 2023 14:17:09 +0000 (14:17 +0000)] 
Merge "include parsed col length field as integer from mysql index reflection" into rel_1_4

2 years ago[asyncpg] Extract rowcount for SELECT statements
Michael Gorven [Wed, 4 Jan 2023 17:30:42 +0000 (12:30 -0500)] 
[asyncpg] Extract rowcount for SELECT statements

Added support to the asyncpg dialect to return the ``cursor.rowcount``
value for SELECT statements when available. While this is not a typical use
for ``cursor.rowcount``, the other PostgreSQL dialects generally provide
this value. Pull request courtesy Michael Gorven.

Fixes: #9048
Closes: #9049
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9049
Pull-request-sha: df16160530c6001d99de059995ad5047a75fb7b0

Change-Id: I095b866779ccea7e4d50bc841fef7605e61c667f
(cherry picked from commit 9c502f5788737fa65029716c73fe0f65f3dafb53)

2 years agoinclude parsed col length field as integer from mysql index reflection
Mike Bayer [Wed, 4 Jan 2023 14:23:07 +0000 (09:23 -0500)] 
include parsed col length field as integer from mysql index reflection

Added support to MySQL index reflection to correctly reflect the
``mysql_length`` dictionary, which previously was being ignored.

Fixes: #9047
Change-Id: I0a5e27123be68741e12af4464a0fa305052ec36e
(cherry picked from commit 4a31f97824095610cfdbc1ac1180fd8690f9f477)

2 years agoVersion 1.4.47 placeholder
Mike Bayer [Tue, 3 Jan 2023 20:17:21 +0000 (15:17 -0500)] 
Version 1.4.47 placeholder

2 years ago- 1.4.46 rel_1_4_46
Mike Bayer [Tue, 3 Jan 2023 20:02:32 +0000 (15:02 -0500)] 
- 1.4.46

2 years agoupdate wording
Mike Bayer [Tue, 3 Jan 2023 20:01:40 +0000 (15:01 -0500)] 
update wording

Change-Id: I19c7d9683218d2c059aa36dd1743661e78974976

2 years agochangelog updates
Mike Bayer [Tue, 3 Jan 2023 19:54:14 +0000 (14:54 -0500)] 
changelog updates

Change-Id: I69581c1563f15762a9a9afae4741e23fefd76906

2 years agohappy new year 2023
Mike Bayer [Tue, 3 Jan 2023 17:50:29 +0000 (12:50 -0500)] 
happy new year 2023

Change-Id: I14db8e9c69a832b0f5dae8036db3c0a70bb49edd

2 years agolink to with_variant() narrative from API doc
Mike Bayer [Tue, 3 Jan 2023 14:48:06 +0000 (09:48 -0500)] 
link to with_variant() narrative from API doc

Change-Id: I5d8e4d7cb7871bedebe0fe89758be441e64b94c6
(cherry picked from commit 7f86be997eea27bc994b25c4fb65d72b3d4567f9)

2 years agoMerge "add uber warning for 1.4" into rel_1_4
mike bayer [Tue, 3 Jan 2023 05:14:06 +0000 (05:14 +0000)] 
Merge "add uber warning for 1.4" into rel_1_4

2 years agorepair underline levels in 20 migration doc
Mike Bayer [Tue, 3 Jan 2023 04:58:06 +0000 (23:58 -0500)] 
repair underline levels in 20 migration doc

two sections got whacked here, update underlines to be
the same as the 2.0 branch

Change-Id: Ic36d51ad9a2cbe23482f72e73f4cbbcbe1617780

2 years agoadd uber warning for 1.4
Mike Bayer [Mon, 2 Jan 2023 17:27:36 +0000 (12:27 -0500)] 
add uber warning for 1.4

As we don't have any automatic deprecation warning for 2.0
unless SQLALCHEMY_WARN_20 is set, applications that are not
being monitored for deprecations have no way to guard against
2.0 being released on pypi unless they add a requirements
rule.

make sure we are putting out a major warning for people who
may have not noticed that SQLAlchemy 2.0 will break compatibility
with legacy use patterns.

Fixes: #8983
Change-Id: I7d50db52c9a0fe3165b0131aab2fce9af80d51dd

2 years agoRectify reference to class LambdaElement, misnamed as LamdaElement (#9037)
Lele Gaifax [Thu, 29 Dec 2022 09:21:09 +0000 (10:21 +0100)] 
Rectify reference to class LambdaElement, misnamed as LamdaElement (#9037)

Fixes #9034.

2 years agonote that 2.0 has behavioral changes outside of the 1.4->2.0 process
Mike Bayer [Wed, 28 Dec 2022 20:53:03 +0000 (15:53 -0500)] 
note that 2.0 has behavioral changes outside of the 1.4->2.0 process

Change-Id: I0ab9611c75f592acec73ca92271f970eae74d7ab
(cherry picked from commit 2c1550af60e5fc8303990519b3ae497401196348)

2 years agochangelog adjustments
Mike Bayer [Wed, 28 Dec 2022 20:30:32 +0000 (15:30 -0500)] 
changelog adjustments

include backport markings

Change-Id: I810923a641977569b8b4d9967e84b8cb684e7a52
(cherry picked from commit 46fe3e53e06864cafbbcbfd8a82a2ec00727b8c5)

2 years agoensure whereclause, returning copied as tuples
Mike Bayer [Wed, 28 Dec 2022 17:04:07 +0000 (12:04 -0500)] 
ensure whereclause, returning copied as tuples

Fixed issue in the internal SQL traversal for DML statements like
:class:`_dml.Update` and :class:`_dml.Delete` which would cause among other
potential issues, a specific issue using lambda statements with the ORM
update/delete feature.

Fixes: #9033
Change-Id: I76428049cb767ba302fbea89555114bf63ab8687
(cherry picked from commit e68173bf7d296b2948abed06f79c7cbd0ab66b0d)

2 years agoCorrect URL import in docs
Federico Caselli [Wed, 28 Dec 2022 12:33:53 +0000 (13:33 +0100)] 
Correct URL import in docs

Fixes: #9032
Change-Id: I2c4164d8e1c74e0c74a578f4629c714b96761ed5

2 years agoMerge "pass more contextual information to PyWrapper param create" into rel_1_4
mike bayer [Tue, 27 Dec 2022 20:54:01 +0000 (20:54 +0000)] 
Merge "pass more contextual information to PyWrapper param create" into rel_1_4

2 years agodont prefix ssl args with "ssl" in the ssl dict
Mike Bayer [Tue, 27 Dec 2022 20:51:06 +0000 (15:51 -0500)] 
dont prefix ssl args with "ssl" in the ssl dict

Fixes: #9031
Change-Id: I9ef077e7da5b2328a345f6526a6210ce82d807f6
(cherry picked from commit e0ea78bd079c1545ced7c9233f949fabe296cd07)

2 years agopass more contextual information to PyWrapper param create
Mike Bayer [Tue, 27 Dec 2022 17:29:38 +0000 (12:29 -0500)] 
pass more contextual information to PyWrapper param create

Fixed issue in lambda SQL feature where the calculated type of a literal
value would not take into account the type coercion rules of the "compared
to type", leading to a lack of typing information for SQL expressions, such
as comparisons to :class:`.JSON` elements and similar.

Fixes: #9029
Change-Id: I381c8d7458d98ba762313dee9ec47a9c1881f74a
(cherry picked from commit f63d7e33ec785a5ea4fbc77963c537be26b8419b)

2 years agoexpand out Index if passed to "constraint"
Mike Bayer [Thu, 22 Dec 2022 23:14:31 +0000 (18:14 -0500)] 
expand out Index if passed to "constraint"

Fixed bug where the PostgreSQL
:paramref:`_postgresql.OnConflictClause.constraint` parameter would accept
an :class:`.Index` object, however would not expand this index out into its
individual index expressions, instead rendering its name in an ON CONFLICT
ON CONSTRAINT clause, which is not accepted by PostgreSQL; the "constraint
name" form only accepts unique or exclude constraint names. The parameter
continues to accept the index but now expands it out into its component
expressions for the render.

Fixes: #9023
Change-Id: I6baf243e26bfe578bf3f193c162dd7a623b6ede9
(cherry picked from commit 5cc18bb80077e98418b4a8066c0bc628209f3ada)

2 years agoMerge "add joins_implicitly to column_valued()" into rel_1_4
mike bayer [Tue, 20 Dec 2022 20:48:36 +0000 (20:48 +0000)] 
Merge "add joins_implicitly to column_valued()" into rel_1_4

2 years agoadd joins_implicitly to column_valued()
Mike Bayer [Mon, 19 Dec 2022 20:15:35 +0000 (15:15 -0500)] 
add joins_implicitly to column_valued()

Added parameter
:paramref:`.FunctionElement.column_valued.joins_implicitly`, which is
useful in preventing the "cartesian product" warning when making use of
table-valued or column-valued functions. This parameter was already
introduced for :meth:`.FunctionElement.table_valued` in :ticket:`7845`,
however it failed to be added for :meth:`.FunctionElement.column_valued`
as well.

Fixes: #9009
Change-Id: Ifb72fbcb4f4d2998e730d6f85ec7280df3bf3d47
(cherry picked from commit 567878e5c67d08c561dd064fe6dc25e4db7349e7)

2 years agoAdd MACCADDR8 for PGCompiler
asimfarooq5 [Wed, 14 Dec 2022 20:32:47 +0000 (15:32 -0500)] 
Add MACCADDR8 for PGCompiler

Add MACCADDR8 for PGCompiler

Closes: #8393
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8393
Pull-request-sha: 837a68eba3e31e0acbb7c47ee87bca4e9def7648

Change-Id: I87e4999eb8d82662ff8ab409c98dc57edd7fd271
(cherry picked from commit 33f15740a0b72bae64fc2c2f6d0f9724cfe9164a)

2 years agoadd exclusion for unusual chars in column names
Mike Bayer [Mon, 19 Dec 2022 13:34:51 +0000 (08:34 -0500)] 
add exclusion for unusual chars in column names

Added new exclusion rule for third party dialects called
``unusual_column_name_characters``, which can be "closed" for third party
dialects that don't support column names with unusual characters such as
dots, slashes, or percent signs in them, even if the name is properly
quoted.

Fixes: #9002
Change-Id: I44b765df4c73ce5ec1907d031fd9c89761fd99d1
References: #8993
(cherry picked from commit 946058ec6070ab4db9fdfab612ec4543fea9cd1c)

2 years agodont call platform.architecture()
Mike Bayer [Fri, 16 Dec 2022 19:05:48 +0000 (14:05 -0500)] 
dont call platform.architecture()

Fixed regression where the base compat module was calling upon
``platform.architecture()`` in order to detect some system properties,
which results in an over-broad system call against the system-level
``file`` call that is unavailable under some circumstances, including
within some secure environment configurations.

Fixes: #8995
Change-Id: Ib6171e75aff5a60a79dab81a0be21bee2456318b
(cherry picked from commit e852362bfdf9a18dfd91137f4a2d7c2dfee30082)

2 years agoimplement literal_binds with expanding + bind_expression
Mike Bayer [Thu, 15 Dec 2022 15:22:36 +0000 (10:22 -0500)] 
implement literal_binds with expanding + bind_expression

Fixed bug where SQL compilation would fail (assertion fail in 2.0, NoneType
error in 1.4) when using an expression whose type included
:meth:`_types.TypeEngine.bind_expression`, in the context of an "expanding"
(i.e. "IN") parameter in conjunction with the ``literal_binds`` compiler
parameter.

Fixes: #8989
Change-Id: Ic9fd27b46381b488117295ea5a492d8fc158e39f
(cherry picked from commit 8c6de3c2c43ab372cbbe76464b4c5be3b6457252)

2 years agoMerge "catch all BaseException in pool and revert failed checkouts" into rel_1_4
mike bayer [Wed, 14 Dec 2022 20:40:59 +0000 (20:40 +0000)] 
Merge "catch all BaseException in pool and revert failed checkouts" into rel_1_4

2 years agocheck index_list pragma for number of columns returned
Mike Bayer [Mon, 12 Dec 2022 23:05:07 +0000 (18:05 -0500)] 
check index_list pragma for number of columns returned

Fixed regression caused by new support for reflection of partial indexes on
SQLite added in 1.4.45 for :ticket:`8804`, where the ``index_list`` pragma
command in very old versions of SQLite (possibly prior to 3.8.9) does not
return the current expected number of columns, leading to exceptions raised
when reflecting tables and indexes.

Fixes: #8969
Change-Id: If317cdcfc6782f7e180df329b6ea0ddb48ce2269
(cherry picked from commit e026a0f3562bec5fbc18e223176be8121c147193)

2 years agocatch all BaseException in pool and revert failed checkouts
Mike Bayer [Mon, 12 Dec 2022 18:47:27 +0000 (13:47 -0500)] 
catch all BaseException in pool and revert failed checkouts

Fixed a long-standing race condition in the connection pool which could
occur under eventlet/gevent monkeypatching schemes in conjunction with the
use of eventlet/gevent ``Timeout`` conditions, where a connection pool
checkout that's interrupted due to the timeout would fail to clean up the
failed state, causing the underlying connection record and sometimes the
database connection itself to "leak", leaving the pool in an invalid state
with unreachable entries. This issue was first identified and fixed in
SQLAlchemy 1.2 for :ticket:`4225`, however the failure modes detected in
that fix failed to accommodate for ``BaseException``, rather than
``Exception``, which prevented eventlet/gevent ``Timeout`` from being
caught. In addition, a block within initial pool connect has also been
identified and hardened with a ``BaseException`` -> "clean failed connect"
block to accommodate for the same condition in this location.
Big thanks to Github user @niklaus for their tenacious efforts in
identifying and describing this intricate issue.

Fixes: #8974
Change-Id: I95a0e1f080d0cee6f1a66977432a586fdf87f686
(cherry picked from commit a71917204dcf12a93d957a0fa29c9df97d0411ee)

2 years agoadd color directives
Mike Bayer [Sun, 11 Dec 2022 20:47:25 +0000 (15:47 -0500)] 
add color directives

See https://tox.wiki/en/latest/faq.html#tox-4-known-regressions

Change-Id: I3c7291a660dc167bce3151e02cd123edc4707ca1
(cherry picked from commit 184508afbb7656c4f51d98695bbeeeec9aae9b87)

2 years agoadjust for tox changes to passenv
Mike Bayer [Sun, 11 Dec 2022 16:27:52 +0000 (11:27 -0500)] 
adjust for tox changes to passenv

Fixed issue in tox.ini file where changes in the tox 4.0 series to the
format of "passenv" caused tox to not function correctly, in particular
raising an error as of tox 4.0.6.

Change-Id: I659c8fc523a71deaa02a89103c9e7241cf81d831
References: https://github.com/tox-dev/tox/issues/2676

2 years agoMerge "Specify view columns in HasTableTest" into rel_1_4
mike bayer [Sun, 11 Dec 2022 15:07:00 +0000 (15:07 +0000)] 
Merge "Specify view columns in HasTableTest" into rel_1_4

2 years agoVersion 1.4.46 placeholder
Mike Bayer [Sat, 10 Dec 2022 18:51:43 +0000 (13:51 -0500)] 
Version 1.4.46 placeholder

2 years ago- 1.4.45 rel_1_4_45
Mike Bayer [Sat, 10 Dec 2022 18:47:24 +0000 (13:47 -0500)] 
- 1.4.45

2 years agochangelog edits for 1.4.45
Mike Bayer [Sat, 10 Dec 2022 18:46:43 +0000 (13:46 -0500)] 
changelog edits for 1.4.45

Change-Id: Ic54a46c5091eda1480ce80989075527c6b3a6d7e

2 years agoSpecify view columns in HasTableTest
Gord Thompson [Fri, 9 Dec 2022 16:55:34 +0000 (09:55 -0700)] 
Specify view columns in HasTableTest

Fixes: #8960
Avoid test errors on databases that do not
support CREATE VIEW vv AS SELECT * FROM

Change-Id: Ic9e892aa4466030b9b325c11228dad15cf59a258
(cherry picked from commit 7e9b1450b6899c82c9362cbc92fcc0f01c97b043)