]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
3 years agofix most sphinx warnings
Mike Bayer [Mon, 16 May 2022 14:57:51 +0000 (10:57 -0400)] 
fix most sphinx warnings

still can't figure out the warnings with some of the older
changelog files.

Fixes: #7946
Change-Id: Id657ab23008eed0b133fed65b2f9ea75a626215c

3 years agoMerge "render col name in on conflict set clause, not given key" into rel_1_4
mike bayer [Sun, 15 May 2022 23:27:59 +0000 (23:27 +0000)] 
Merge "render col name in on conflict set clause, not given key" into rel_1_4

3 years agorender col name in on conflict set clause, not given key
Mike Bayer [Fri, 13 May 2022 20:08:34 +0000 (16:08 -0400)] 
render col name in on conflict set clause, not given key

Fixed bug where the PostgreSQL :meth:`_postgresql.Insert.on_conflict`
method and the SQLite :meth:`_sqlite.Insert.on_conflict` method would both
fail to correctly accommodate a column with a separate ".key" when
specifying the column using its key name in the dictionary passed to
``set_``, as well as if the :attr:`_sqlite.Insert.excluded` or
:attr:`_postgresql.Insert.excluded` collection were used as the dictionary
directly.

Fixes: #8014
Change-Id: I67226aeedcb2c683e22405af64720cc1f990f274
(cherry picked from commit 927abc3b33f10464ed04db3d7a454faeb6e729f2)

3 years agoraise for same param name in expanding + non expanding
Mike Bayer [Fri, 13 May 2022 19:43:53 +0000 (15:43 -0400)] 
raise for same param name in expanding + non expanding

An informative error is raised if two individual :class:`.BindParameter`
objects share the same name, yet one is used within an "expanding" context
(typically an IN expression) and the other is not; mixing the same name in
these two different styles of usage is not supported and typically the
``expanding=True`` parameter should be set on the parameters that are to
receive list values outside of IN expressions (where ``expanding`` is set
by default).

Fixes: #8018
Change-Id: Ie707f29680eea16b9e421af93560ac1958e11a54
(cherry picked from commit f9fccdeeb6749d10aeec458f1a549906d58ddad8)

3 years agoadjust log stacklevel for py3.11.0b1; enable greenlet
Mike Bayer [Sat, 14 May 2022 14:25:53 +0000 (10:25 -0400)] 
adjust log stacklevel for py3.11.0b1; enable greenlet

Fixed issue where support for logging "stacklevel" implemented in
:ticket:`7612` required adjustment to work with recently released Python
3.11.0b1, also repairs the unit tests which tested this feature.

Install greenlet from a py311 compat patch.

re: the stacklevel thing, this is going to be very inconvenient
if we have to keep hardcoding numbers everywhere for every
new python version

Change-Id: I0c8f7293e98c0ca5cc544538284bfd1d3020cb1f
References: https://github.com/python-greenlet/greenlet/issues/288
Fixes: #8019
(cherry picked from commit 43ff5b82dc0d91cacd625ac8943622ab340958c5)

3 years agoRevert "search for pickle failures"
Mike Bayer [Fri, 13 May 2022 14:53:07 +0000 (10:53 -0400)] 
Revert "search for pickle failures"

This reverts commit 48ccecbe69795753baac1ca6d351c1af5ebcdd7b.

not being careful w/ the commandline as I eat breakfast today

3 years agomore expire_on_commit reminders
Mike Bayer [Fri, 13 May 2022 14:25:37 +0000 (10:25 -0400)] 
more expire_on_commit reminders

the session commit/close docs still feel awkward in how
one learns about this operation.   hopefully another pass
over 2.0 can make things more linear.

removed a 1.4 note about autobegin that was completely inaccurate;
commit() does autobegin so it has an effect, just not usually
on the database.

Change-Id: Iaa4b96bd3df6cf82e851b2943322ddad7abbbac0
(cherry picked from commit cd628fad7c92f5f54bf1bf6985fd983269b0ec19)

3 years agosearch for pickle failures
Mike Bayer [Fri, 13 May 2022 13:24:09 +0000 (09:24 -0400)] 
search for pickle failures

this is not for merge, trying to locate what might be
the problem at #8000

Change-Id: I3ee7bf85f42eca861d32fc402b69796d518934d1

3 years agobump zimports to 0.6.0
Mike Bayer [Tue, 10 May 2022 14:32:18 +0000 (10:32 -0400)] 
bump zimports to 0.6.0

new multiprocessing support

Change-Id: I165a419a67c4e4a5e49d15cf2ac5c8aa46d16cbc
(cherry picked from commit 9294ac7fe02eb2f8aad78122eae199192f12ef52)

3 years agodont use the label convention for memoized entities
Mike Bayer [Mon, 9 May 2022 14:27:51 +0000 (10:27 -0400)] 
dont use the label convention for memoized entities

Fixed issue where ORM results would apply incorrect key names to the
returned :class:`.Row` objects in the case where the set of columns to be
selected were changed, such as when using
:meth:`.Select.with_only_columns`.

Fixes: #8001
Change-Id: If3a2a5d00d15ebc2e9d41494845cfb3b06f80dcc
(cherry picked from commit 319f09ffced3f655e7d500b3a9965e19468fd9d9)

3 years agoUse tuple instead of raw url in string formatting (#7987)
dzcode [Tue, 3 May 2022 20:18:43 +0000 (14:18 -0600)] 
Use tuple instead of raw url in string formatting (#7987)

* Fixes: #7902 - Use tuple instead of raw url in string formatting

* Fix lint error

(cherry picked from commit 675c3e17f7fcccb7534c46adb56529fc3ddd8dbf)

3 years agodocs(types) Fix missing import from sqlalchemy (#7978)
khashashin [Tue, 3 May 2022 20:00:59 +0000 (22:00 +0200)] 
docs(types) Fix missing import from sqlalchemy (#7978)

* docs(types) Fix missing import from sqlalchemy

The sample code is missing the import of Enum from sqlalchemy, which might confuse the reader, since we are using another enum type from Python itself here. So it makes sense to clarify that here.

* fix whitespaces

Change-Id: I019bbed8a7278f60e7239160ea4c99ecd2519d3b

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
(cherry picked from commit f89a202d60215b13e3733a3ea950473962b3cf67)

3 years agobypass pyodbc default server version / set charset
Mike Bayer [Tue, 3 May 2022 12:58:27 +0000 (08:58 -0400)] 
bypass pyodbc default server version / set charset

Further adjustments to the MySQL PyODBC dialect to allow for complete
connectivity, which was previously still not working despite fixes in
:ticket:`7871`.

Fixes: #7966
Change-Id: I549ea9e7b6e722e22d3e25bdb2fe0934603e2454
(cherry picked from commit 4abca61b4903e42f9568cc06f3c18ac27a139cf7)

3 years agouse bindparam_type in BinaryElementImpl._post_coercion if available
Mike Bayer [Sun, 1 May 2022 16:28:36 +0000 (12:28 -0400)] 
use bindparam_type in BinaryElementImpl._post_coercion if available

Fixed an issue where using :func:`.bindparam` with no explicit data or type
given could be coerced into the incorrect type when used in expressions
such as when using :meth:`.ARRAY.comparator.any` and
:meth:`.ARRAY.comparator.all`.

Fixes: #7979
Change-Id: If7779e713c9a3a5fee496b66e417cfd3fca5b1f9
(cherry picked from commit 889cbe53121c8fd50c845357dd52b24594346b68)

3 years agoVersion 1.4.37 placeholder
Mike Bayer [Tue, 26 Apr 2022 21:12:08 +0000 (17:12 -0400)] 
Version 1.4.37 placeholder

3 years ago- 1.4.36 rel_1_4_36
Mike Bayer [Tue, 26 Apr 2022 20:56:04 +0000 (16:56 -0400)] 
- 1.4.36

3 years agoMerge "repair fetch_setting call in mysql pyodbc dialect" into rel_1_4
mike bayer [Tue, 26 Apr 2022 20:52:17 +0000 (20:52 +0000)] 
Merge "repair fetch_setting call in mysql pyodbc dialect" into rel_1_4

3 years agochangelog edits for 1.4.36
Mike Bayer [Tue, 26 Apr 2022 19:32:30 +0000 (15:32 -0400)] 
changelog edits for 1.4.36

Change-Id: I0dd6b8ace355e4884b918484ae7b2c7a8319ff7e

3 years agorepair fetch_setting call in mysql pyodbc dialect
Mike Bayer [Tue, 26 Apr 2022 19:02:37 +0000 (15:02 -0400)] 
repair fetch_setting call in mysql pyodbc dialect

Fixed a regression in the untested MySQL PyODBC dialect caused by the fix
for :ticket:`7518` in version 1.4.32 where an argument was being propagated
incorrectly upon first connect, leading to a ``TypeError``.

Fixes: #7871
Change-Id: I37f8ca8e83cb352ee2a2336b52863858259b1d77
(cherry picked from commit 3deff88fe12adc470792f71da7b9c54a5438638f)

3 years agobackport 6f02d5edd88fe247 to 1.4
Mike Bayer [Sun, 24 Apr 2022 20:19:16 +0000 (16:19 -0400)] 
backport 6f02d5edd88fe247 to 1.4

in 6f02d5edd88fe2475629438b0730181a2b00c5fe some cleanup
to ForeignKey repaired the use case of ForeignKey objects
referring to table name alone, by adding more robust
column resolution logic.  This change also fixes an issue
where the "referred column" naming convention key uses the
resolved referred column earlier than usual when a
ForeignKey is setting up its constraint.

Fixed bug where :class:`.ForeignKeyConstraint` naming conventions using the
``referred_column_0`` naming convention key would not work if the foreign
key constraint were set up as a :class:`.ForeignKey` object rather than an
explicit :class:`.ForeignKeyConstraint` object. As this change makes use of
a backport of some fixes from version 2.0, an additional little-known
feature that has likely been broken for many years is also fixed which is
that a :class:`.ForeignKey` object may refer to a referred table by name of
the table alone without using a column name, if the name of the referent
column is the same as that of the referred column.

The ``referred_column_0`` naming convention key was not previously not
tested with the :class:`.ForeignKey` object, only
:class:`.ForeignKeyConstraint`, and this bug reveals that the feature has
never worked correctly unless :class:`.ForeignKeyConstraint` is used for
all FK constraints. This bug traces back to the original introduction of
the feature introduced for :ticket:`3989`.

Fixes: #7958
Change-Id: I230d43e9deba5dff889b9e7fee6cd4d3aa2496d3

3 years agoMerge "properly type array element in any() / all()" into rel_1_4
mike bayer [Sat, 23 Apr 2022 04:08:26 +0000 (04:08 +0000)] 
Merge "properly type array element in any() / all()" into rel_1_4

3 years agoproperly type array element in any() / all()
Mike Bayer [Fri, 22 Apr 2022 14:57:00 +0000 (10:57 -0400)] 
properly type array element in any() / all()

Fixed bug in :class:`.ARRAY` datatype in combination with :class:`.Enum` on
PostgreSQL where using the ``.any()`` method to render SQL ANY(), given
members of the Python enumeration as arguments, would produce a type
adaptation failure on all drivers.

Fixes: #6515
Change-Id: Ia1e3b4e10aaf264ed436ce6030d105fc60023433
(cherry picked from commit d023c8e1c7ad82fb249fab5155eb83dee17a160c)

3 years agofix memory leak in resultproxy.c
Mike Bayer [Fri, 22 Apr 2022 14:27:38 +0000 (10:27 -0400)] 
fix memory leak in resultproxy.c

the error raised for non-existent attribute didn't free
the "name" string, causing a leak.

Fixed a memory leak in the C extensions which could occur when calling upon
named members of :class:`.Row` when the member does not exist under Python
3; in particular this could occur during numpy transformations when it
attempts to call members such as ``.__array__``, but the issue was
surrounding any ``AttributeError`` thrown by the :class:`.Row` object. This
issue does not apply to version 2.0 which has already transitioned to
Cython. Thanks much to Sebastian Berg for identifying the problem.

Fixes: #7875
Change-Id: I444026a877ea1473a5ffac592c7f36ed6f4b563e

3 years agowarn for result.columns() method
Mike Bayer [Thu, 21 Apr 2022 17:27:16 +0000 (13:27 -0400)] 
warn for result.columns() method

A warning is emitted when calling upon the :meth:`.Result.columns` method
with only one index, in particular ORM related cases, indicating that the
current behavior of :meth:`.Result.columns` is broken in this case and
will be changed in 2.0.  To receive a collection of scalar values,
use the :meth:`.Result.scalars` method.

Fixes: #7953
Change-Id: I3c4ca3eecc2bfc85ad1c38000e5990d6dde80d22
(cherry picked from commit fe2045fb1c767436ed1e32359fe005dabead504a)

3 years agoImplement UUID.python_type
Alex Grönholm [Mon, 18 Apr 2022 17:07:19 +0000 (13:07 -0400)] 
Implement UUID.python_type

Implemented :attr:`_postgresql.UUID.python_type` attribute for the
:class:`_postgresql.UUID` type object. The attribute will return either
``str`` or ``uuid.UUID`` based on the :paramref:`_postgresql.UUID.as_uuid`
parameter setting. Previously, this attribute was unimplemented. Pull
request courtesy Alex Grönholm.

Fixes: #7943
Closes: #7944
Change-Id: Ic4fbaeee134d586b08339801968e787cc7e14285
(cherry picked from commit 408c936c77c6aaeceab0e0b001ed745ceb9d19d4)

3 years agoMerge "Allow contextvars to be set in events when using asyncio" into rel_1_4
mike bayer [Thu, 21 Apr 2022 13:44:45 +0000 (13:44 +0000)] 
Merge "Allow contextvars to be set in events when using asyncio" into rel_1_4

3 years agoFixes minor typo (#7950)
Alex Marvin [Wed, 20 Apr 2022 20:31:38 +0000 (16:31 -0400)] 
Fixes minor typo (#7950)

(cherry picked from commit 8ee0bf9e373fe98af38babcbc97435c3b505d09f)

3 years agoupdate ORM join doc
Mike Bayer [Tue, 19 Apr 2022 03:12:31 +0000 (23:12 -0400)] 
update ORM join doc

forgot to remove string support for the ON clause here.
will backport a deprecation message to 1.4.

Change-Id: If90e2bff929cce4dc8a6e9bd3ad818b8f8e514a6
(cherry picked from commit 13a8552053c21a9fa7ff6f992ed49ee92cca73e4)

3 years agoAllow contextvars to be set in events when using asyncio
Federico Caselli [Thu, 14 Apr 2022 22:29:01 +0000 (00:29 +0200)] 
Allow contextvars to be set in events when using asyncio

Allow setting contextvar values inside async adapted event handlers.
Previously the value set to the contextvar would not be properly
propagated.

Fixes: #7937
Change-Id: I787aa869f8d057579e13e32c749f05f184ffd02a
(cherry picked from commit 640d163bd8bf61e87790255558b6f704a0d06174)

3 years agoadapt_from_selectables is a set
Mike Bayer [Sat, 16 Apr 2022 15:40:13 +0000 (11:40 -0400)] 
adapt_from_selectables is a set

aliasedclass setting this as a list, making all the containment
checks more expensive.

the presence of the collection also serves as a flag so it
has to stay optional.

Change-Id: Iafffbeb29d77441ca35ecd8048244ee6eed1232c
(cherry picked from commit c538f810bce57472c8960a0a6c4c61024b00f3ed)

3 years agoupdate bake_queries documentation
Mike Bayer [Fri, 15 Apr 2022 15:11:42 +0000 (11:11 -0400)] 
update bake_queries documentation

this parameter has had no effect since 1.4.23 in #6889,
but the documentation was not updated.

Change-Id: I36f4ea6144b9fd09243f96698e7a03cd217da1e7

3 years agoFix link to RFC 1738 (#7935)
Sergey Golitsynskiy [Thu, 14 Apr 2022 20:01:26 +0000 (16:01 -0400)] 
Fix link to RFC 1738 (#7935)

3 years agoEnsure ORMInsert sets up bind state
Mike Bayer [Thu, 14 Apr 2022 16:01:16 +0000 (12:01 -0400)] 
Ensure ORMInsert sets up bind state

Fixed regression where the change in #7861, released in version 1.4.33,
that brought the :class:`.Insert` construct to be partially recognized as
an ORM-enabled statement did not properly transfer the correct mapper /
mapped table state to the :class:`.Session`, causing the
:meth:`.Session.get_bind` method to fail for a :class:`.Session` that was
bound to engines and/or connections using the :paramref:`.Session.binds`
parameter.

Fixes: #7936
Change-Id: If19edef8e2dd68335465429eb3d2f0bfdade4a4c
(cherry picked from commit 4f96c12db923624204110e56ce730f5aafbb9463)

3 years agoupdate Numeric/Float docstrings
Mike Bayer [Thu, 14 Apr 2022 13:59:11 +0000 (09:59 -0400)] 
update Numeric/Float docstrings

These docs were very out of date re: cdecimal.   Additionally,
as pointed out in #5252, the Numeric documentation is misleading;
SQLAlchemy's Numeric hierarchy resembles more of the Oracle
approach where precision and scale solely determine the kind of
datatype being worked with.   Float is essentially Numeric with
different defaults.

Fixes: #5252
Change-Id: I661109fabf04ba7831c7ddafba15321dd445ea5d
(cherry picked from commit 3d300066e8b20a89e0b82bf09dd0c4016f5f8e51)

3 years agoMerge "Fix psycopg2 pre_ping with autocommit" into rel_1_4
mike bayer [Wed, 13 Apr 2022 21:23:58 +0000 (21:23 +0000)] 
Merge "Fix psycopg2 pre_ping with autocommit" into rel_1_4

3 years agoFix psycopg2 pre_ping with autocommit
Federico Caselli [Mon, 11 Apr 2022 21:19:16 +0000 (23:19 +0200)] 
Fix psycopg2 pre_ping with autocommit

Fixed an issue what would cause autocommit mode to be reset
when using pre_ping in conjunction engine level autocommit
on the psycopg2 driver.

Fixes: #7930
Change-Id: I4cccaf1b7f8cbacd853689458080784114fcc390
(cherry picked from commit 363b68e08e9ceed4ce6821f5fd48ab32bdfd807c)

3 years agoread from cls.__dict__ so init_subclass works
Mike Bayer [Mon, 4 Apr 2022 23:01:54 +0000 (19:01 -0400)] 
read from cls.__dict__ so init_subclass works

Modified the :class:`.DeclarativeMeta` metaclass to pass ``cls.__dict__``
into the declarative scanning process to look for attributes, rather than
the separate dictionary passed to the type's ``__init__()`` method. This
allows user-defined base classes that add attributes within an
``__init_subclass__()`` to work as expected, as ``__init_subclass__()`` can
only affect the ``cls.__dict__`` itself and not the other dictionary. This
is technically a regression from 1.3 where ``__dict__`` was being used.

Additionally makes the reference between ClassManager and
the declarative configuration object a weak reference, so that it
can be discarded after mappers are set up.

Fixes: #7900
Change-Id: I3c2fd4e227cc1891aa4bb3d7d5b43d5686f9f27c
(cherry picked from commit 428ea01f00a9cc7f85e435018565eb6da7af1b77)

3 years agorepair ancient and incorrect comment
Mike Bayer [Tue, 12 Apr 2022 02:03:28 +0000 (22:03 -0400)] 
repair ancient and incorrect comment

it referred towards _columntoproperty refering to
lists of MapperProperty.  this comment goes all the
way to pre 0.1 being released.   it's likely been
wrong for nearly all that time.

Change-Id: I71234ae58a6253249d92224356e38372e4aff148
(cherry picked from commit 8254e3a28a32b7097fb926a373c17c35d4ec1d57)

3 years agoupdate flake8 noqa skips with proper syntax
Federico Caselli [Mon, 11 Apr 2022 20:21:20 +0000 (22:21 +0200)] 
update flake8 noqa skips with proper syntax

Change-Id: I42ed77f559e3ee5b8c600d98457ee37803ef0ea6
(cherry picked from commit 139c6ec0fb1f930be9b64545262d2580f6cbc83e)

3 years agoMerge "add sane_rowcount to SimpleUpdateDeleteTest" into rel_1_4
mike bayer [Sat, 9 Apr 2022 14:21:37 +0000 (14:21 +0000)] 
Merge "add sane_rowcount to SimpleUpdateDeleteTest" into rel_1_4

3 years agoupdate DDL examples removing execute_if
Mike Bayer [Sat, 9 Apr 2022 14:02:35 +0000 (10:02 -0400)] 
update DDL examples removing execute_if

Fixes: #7924
Change-Id: I684bf3720010ffe34dbdd39ec8c7e0c4af94e620
(cherry picked from commit 1eeded1687aef3132b2a1d5995321fb20b2b8dfc)

3 years agoadd sane_rowcount to SimpleUpdateDeleteTest
Mike Bayer [Sat, 9 Apr 2022 13:50:18 +0000 (09:50 -0400)] 
add sane_rowcount to SimpleUpdateDeleteTest

For third party dialects, repaired a missing requirement for the
``SimpleUpdateDeleteTest`` suite test which was not checking for a working
"rowcount" function on the target dialect.

Fixes: #7919
Change-Id: I2bc68132131eb36c43b8dabec0fac86272e26df5
(cherry picked from commit f3a65eb9033397fbf746fbf71df19ca9d1fce2f4)

3 years agoi forgot about begin_nested()
Mike Bayer [Fri, 8 Apr 2022 14:56:54 +0000 (10:56 -0400)] 
i forgot about begin_nested()

make bulleted lists of what is autoflush and what's not.

Change-Id: Id3bc4714013e9df243d804d7b5b60c6ef75e1316
(cherry picked from commit 4acf50c8e86b6b047853b2bc96ccaa494811085f)

3 years agoclarify autoflush setting does not apply to commit
Mike Bayer [Fri, 8 Apr 2022 14:36:50 +0000 (10:36 -0400)] 
clarify autoflush setting does not apply to commit

Change-Id: Icad0f3bd071422b8d1af204c9a1193a9ce6124ba
References: #7916
(cherry picked from commit ed2b29dc344c9cb65745c767b755f82d913695b8)

3 years agoexplicitly refer to Apple M1 for greenlet issue
Mike Bayer [Fri, 8 Apr 2022 13:28:47 +0000 (09:28 -0400)] 
explicitly refer to Apple M1 for greenlet issue

As developers are now buying lots of Apple M1
machines, and AFAWK greenlet is still not able
to provide a pre-built wheel, we are going to get a lot
of devs trying to use asyncio on their Apple M1s, in
greater proportions compared to devs running containers
etc. on other various less popular CPU architectures.

Add a new FAQ section for installation, add new
red dragon to the very top of asyncio docs,
add new verbiage, all of which includes
"Apple M1" in bold text, to minimize the chance of anyone
missing this.

Fixes: #7922
Fixes: #7714
Change-Id: I106923a2860a4efd77d1b999197be102afc1f73d
(cherry picked from commit f7ebfa6072d65c32c61194b265662c957d3f09dd)

3 years agoVersion 1.4.36 placeholder
Mike Bayer [Wed, 6 Apr 2022 15:34:25 +0000 (11:34 -0400)] 
Version 1.4.36 placeholder

3 years ago- 1.4.35 rel_1_4_35
Mike Bayer [Wed, 6 Apr 2022 15:23:05 +0000 (11:23 -0400)] 
- 1.4.35

3 years agoclassify issue
Mike Bayer [Wed, 6 Apr 2022 15:17:05 +0000 (11:17 -0400)] 
classify issue

Change-Id: Id1e59fee382d1d72d78e99b1c56a5837b5503fed
(cherry picked from commit 31ccec00da7e0e81781a523a9d1acbd926be6553)

3 years agomaintain complete cloned_set for BindParameter
Mike Bayer [Wed, 6 Apr 2022 13:41:11 +0000 (09:41 -0400)] 
maintain complete cloned_set for BindParameter

Fixed regression caused by :ticket:`7823` which impacted the caching
system, such that bound parameters that had been "cloned" within ORM
operations, such as polymorphic loading, would in some cases not acquire
their correct execution-time value leading to incorrect bind values being
rendered.

Fixes: #7903
Change-Id: I61c802749b859bebeb127d24e66d6e77d13ce57a
(cherry picked from commit 2168a64affb2e299b9a37079af7b2a8d4ae0ff64)

3 years agofix typo in lambda example
Mike Bayer [Tue, 5 Apr 2022 18:39:32 +0000 (14:39 -0400)] 
fix typo in lambda example

we might have an actual customer so clean up shop

Change-Id: I0b1e36ad78f364805a3a7bfd6fac953cf94b838f
(cherry picked from commit 7935b76d9e5b5fd4e64b2c6c3473737186acf2db)

3 years agoTableValuedAlias generation fixes
Mike Bayer [Sun, 3 Apr 2022 15:28:57 +0000 (11:28 -0400)] 
TableValuedAlias generation fixes

Fixed bug in newly implemented
:paramref:`.FunctionElement.table_valued.joins_implicitly` feature where
the parameter would not automatically propagate from the original
:class:`.TableValuedAlias` object to the secondary object produced when
calling upon :meth:`.TableValuedAlias.render_derived` or
:meth:`.TableValuedAlias.alias`.

Additionally repaired these issues in :class:`.TableValuedAlias`:

* repaired a potential memory issue which could occur when
repeatedly calling :meth:`.TableValuedAlias.render_derived` against
successive copies of the same object (for .alias(), we currently
have to still continue chaining from the previous element.  not sure
if this can be improved but this is standard behavior for .alias()
elsewhere)
* repaired issue where the individual element types would be lost when
calling upon :meth:`.TableValuedAlias.render_derived` or
:meth:`.TableValuedAlias.alias`.

Fixes: #7890
Change-Id: Ie5120c7ff1e5c1bba5aaf77c782a51c637860208
(cherry picked from commit c315c7401a2aa00a8a0fa0f7d4189a9976fd7962)

3 years agoclarify alternative mapping example
Mike Bayer [Sun, 3 Apr 2022 14:39:19 +0000 (10:39 -0400)] 
clarify alternative mapping example

this second example is not part of the doctest steps,
clarify that it's not part of code examples to be present
in execution steps.   Add an extra registry +
declarative base on top
so that even if someone does run it, the Base will have
been reset and the examples will continue to work
(noting that column order in statements may change, but
probably nothing else).

Fixes: #7891
Change-Id: Icb1ba310230841e502185d9d0cadd3c18d467292
(cherry picked from commit 1dffb7cedeb009ca6c532db558bd0588dd846957)

3 years agofix small indentation typo (#7882)
Maple [Sun, 3 Apr 2022 09:30:08 +0000 (17:30 +0800)] 
fix small indentation typo (#7882)

3 years agoVersion 1.4.35 placeholder
Mike Bayer [Thu, 31 Mar 2022 22:28:33 +0000 (18:28 -0400)] 
Version 1.4.35 placeholder

3 years ago- 1.4.34 rel_1_4_34
Mike Bayer [Thu, 31 Mar 2022 22:10:43 +0000 (18:10 -0400)] 
- 1.4.34

3 years agoallow executemany values for ON CONFLICT DO NOTHING
Mike Bayer [Thu, 31 Mar 2022 20:53:43 +0000 (16:53 -0400)] 
allow executemany values for ON CONFLICT DO NOTHING

Scaled back a fix made for :ticket:`6581` where "executemany values" mode
for psycopg2 were disabled for all "ON CONFLICT" styles of INSERT, to
not apply to the "ON CONFLICT DO NOTHING" clause, which does not include
any parameters and is safe for "executemany values" mode.  "ON CONFLICT
DO UPDATE" is still blocked from "executemany values" as there may
be additional parameters in the DO UPDATE clause that cannot be batched
(which is the original issue fixed by :ticket:`6581`).

Fixes: #7880
Change-Id: Id3e23a0c6699333409a50148fa8923cb8e564bdc
(cherry picked from commit cc8c5835a92b0035530b541c81b0c714b570b095)

3 years agoadd template methods for ORMInsert
Mike Bayer [Thu, 31 Mar 2022 18:56:52 +0000 (14:56 -0400)] 
add template methods for ORMInsert

Fixed regression caused by :ticket:`7861` where invoking an
:class:`.Insert` construct which contained ORM entities via
:meth:`_orm.Session.execute` would fail.

Fixes: #7878
Change-Id: Icc4d8028249cc417f504fdd3e31e206b5bbc89f8
(cherry picked from commit cbe38dbc667436f5da74ce7c3d6e5451f41c62e2)

3 years agoVersion 1.4.34 placeholder
Mike Bayer [Thu, 31 Mar 2022 14:38:05 +0000 (10:38 -0400)] 
Version 1.4.34 placeholder

3 years ago- 1.4.33 rel_1_4_33
Mike Bayer [Thu, 31 Mar 2022 14:07:16 +0000 (10:07 -0400)] 
- 1.4.33

3 years agoMerge "add close=False parameter to engine.dispose()" into rel_1_4
mike bayer [Thu, 31 Mar 2022 14:05:45 +0000 (14:05 +0000)] 
Merge "add close=False parameter to engine.dispose()" into rel_1_4

3 years agoadd close=False parameter to engine.dispose()
Mike Bayer [Thu, 31 Mar 2022 13:08:11 +0000 (09:08 -0400)] 
add close=False parameter to engine.dispose()

Added new parameter :paramref:`.Engine.dispose.close`, defaulting to True.
When False, the engine disposal does not touch the connections in the old
pool at all, simply dropping the pool and replacing it. This use case is so
that when the original pool is transferred from a parent process, the
parent process may continue to use those connections.

Fixes: #7877
Change-Id: I88b0808442381ba5e50674787cdb64f0e77d8b54
(cherry picked from commit 87a0f7183de4e8454483c7348bf486265bfe1c4d)

3 years agoUpdate bindparam cache key
Federico Caselli [Wed, 30 Mar 2022 20:50:18 +0000 (22:50 +0200)] 
Update bindparam cache key

The ``literal_execute`` parameter now takes part of the cache
generation of a bindparam, since it changes the sql string generated
by the compiler.
Previously the correct bind values were used, but the ``literal_execute``
would be ignored on subsequent executions of the same query.

Fixes: #7876
Change-Id: I6bf887f1a2fe31f9d0ab68f5b4ff315004d006b2
(cherry picked from commit 429512d55e814b03854bc12ec541dbeee9e3b94e)

3 years agofurther changelog / doc fixes
Mike Bayer [Wed, 30 Mar 2022 15:44:23 +0000 (11:44 -0400)] 
further changelog / doc fixes

Change-Id: I959f242272ff5147b7c1f721cf119d09309a8c57
(cherry picked from commit 9731484f5c991b56e64349ef7b9775ef83b18402)

3 years agochangelog fixes
Mike Bayer [Wed, 30 Mar 2022 14:52:29 +0000 (10:52 -0400)] 
changelog fixes

Change-Id: I24e3de82d656d59719fd067bc81b2948e725b487
(cherry picked from commit 731262b17e0678b2549bf5d41adfd9c82ced01cc)

3 years agoFix spacing on ``bindparam`` docs
Federico Caselli [Tue, 29 Mar 2022 20:53:31 +0000 (22:53 +0200)] 
Fix spacing on ``bindparam`` docs

Change-Id: I9daad5293a4887734f14e6e5de6014aca415453c

3 years agouse annotated entity when adding secondary
Mike Bayer [Tue, 29 Mar 2022 13:48:24 +0000 (09:48 -0400)] 
use annotated entity when adding secondary

Fixed regression in "dynamic" loader strategy where the
:meth:`_orm.Query.filter_by` method would not be given an appropriate
entity to filter from, in the case where a "secondary" table were present
in the relationship being queried and the mapping were against something
complex such as a "with polymorphic".

Fixes: #7868
Change-Id: I3b82eec6485c5a92b56a596da0cfb009e9e67883
(cherry picked from commit a55476fbdbc9b4e192a052b81dfe7e750d6241e4)

3 years agoMerge "apply loader criteria more specifically when refresh is true" into rel_1_4
mike bayer [Tue, 29 Mar 2022 14:05:28 +0000 (14:05 +0000)] 
Merge "apply loader criteria more specifically when refresh is true" into rel_1_4

3 years agoMerge "fix quotes regexp for SQLite CHECK constraints" into rel_1_4
mike bayer [Mon, 28 Mar 2022 22:47:22 +0000 (22:47 +0000)] 
Merge "fix quotes regexp for SQLite CHECK constraints" into rel_1_4

3 years agoapply loader criteria more specifically when refresh is true
Mike Bayer [Mon, 28 Mar 2022 22:39:19 +0000 (18:39 -0400)] 
apply loader criteria more specifically when refresh is true

Fixed bug in :func:`_orm.with_loader_criteria` function where loader
criteria would not be applied to a joined eager load that were invoked
within the scope of a refresh operation for the parent object.

Fixes: #7862
Change-Id: If1ac86eaa95880b5ec5bdeee292d6e8000aac705
(cherry picked from commit 9c52d9a507a738ae68f0a6eae09d87959995b981)

3 years agocolumn_descriptions or equiv for DML, core select
Mike Bayer [Sat, 26 Mar 2022 20:20:34 +0000 (16:20 -0400)] 
column_descriptions or equiv for DML, core select

Added new attributes :attr:`.ValuesBase.returning_column_descriptions` and
:attr:`.ValuesBase.entity_description` to allow for inspection of ORM
attributes and entities that are installed as part of an :class:`.Insert`,
:class:`.Update`, or :class:`.Delete` construct. The
:attr:`.Select.column_descriptions` accessor is also now implemented for
Core-only selectables.

Fixes: #7861
Change-Id: Ia6a1cd24c798ba61f4e8e8eac90a0fd00d738342
(cherry picked from commit 2f1df5f9105149d6cb01c8b6ab6b9ccffa020780)

3 years agofix quotes regexp for SQLite CHECK constraints
Mike Bayer [Mon, 28 Mar 2022 17:46:24 +0000 (13:46 -0400)] 
fix quotes regexp for SQLite CHECK constraints

Fixed bug where the name of CHECK constraints under SQLite would not be
reflected if the name were created using quotes, as is the case when the
name uses mixed case or special characters.

Fixes: #5463
Change-Id: Ic3b1e0a0385fb9e727b0880e90815ea2814df313
(cherry picked from commit cb52b934000047278dbb63d0cfffdb4eae1f669c)

3 years agopin click pre-8.1 for black targets
Mike Bayer [Mon, 28 Mar 2022 20:07:51 +0000 (16:07 -0400)] 
pin click pre-8.1 for black targets

both packages seem to have a bunch of updates,
but as this branch is still formatted for python 2,
keep black at its old version and keep click before
8.1 which seems to be where symbols that are used by
the older black versions were removed

Change-Id: I432a59fb7512cf7c453815e17ec5e0559e5d6be7

3 years agoblock asyncmy 0.2.4
Mike Bayer [Mon, 28 Mar 2022 15:23:39 +0000 (11:23 -0400)] 
block asyncmy 0.2.4

asyncmy made a backwards incompatible change to the
TIME datatype in 0.2.4 which hopefully will be reverted
as this change does not belong in a minor point release

Change-Id: Id8bf932d70f52caba06094308a5b87387e69b94b
References: https://github.com/long2ice/asyncmy/issues/37
(cherry picked from commit bbd6420b39edb24481f171b8d0081149dd2e5ba7)

3 years agosupport BLANK_SCHEMA, RETAIN_SCHEMA FK schema on copy
Mike Bayer [Sat, 26 Mar 2022 14:09:10 +0000 (10:09 -0400)] 
support BLANK_SCHEMA, RETAIN_SCHEMA FK schema on copy

Added support so that the :paramref:`.Table.tometadata.referred_schema_fn`
callable passed to :meth:`.Table.to_metadata` may return the value
:data:`.BLANK_SCHEMA` to indicate that the referenced foreign key should be
reset to None. The :data.`RETAIN_SCHEMA` symbol may also be returned from
this function to indicate "no change", which will behave the same as
``None`` currently does which also indicates no change.

Fixes: #7860
Change-Id: I82a45988d534295d8356453f68001b21d4ff706d
(cherry picked from commit 74d3f3965b383aef7421f2cf1779573a4ac65987)

3 years agoClarify associationproxy.rst examples by using a one word keyword
aathan [Wed, 23 Feb 2022 22:06:42 +0000 (17:06 -0500)] 
Clarify associationproxy.rst examples by using a one word keyword

The examples are based on a `keyword` attribute but use a value
that a human may interpret as multiple keywords.

Closes: #7582
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7582
Pull-request-sha: 18b027035ece587c8bfbecff5a96385bf908edca

Change-Id: I30e8c3c0f46c66058131dfadd2b70959913a6335
(cherry picked from commit 1d4d7d858c0f724ff684423746f986b20b972476)

3 years agoMerge "Git ignore lib/sqlalchemy/cyextension for 1.4" into rel_1_4
mike bayer [Thu, 24 Mar 2022 20:58:16 +0000 (20:58 +0000)] 
Merge "Git ignore lib/sqlalchemy/cyextension for 1.4" into rel_1_4

3 years agomore autocommit messaging
Mike Bayer [Thu, 24 Mar 2022 17:58:20 +0000 (13:58 -0400)] 
more autocommit messaging

Further clarified connection-level logging to indicate the BEGIN, ROLLBACK
and COMMIT log messages do not actually indicate a real transaction when
the AUTOCOMMIT isolation level is in use; messaging has been extended to
include the BEGIN message itself, and the messaging has also been fixed to
accommodate when the :class:`.Engine` level
:paramref:`.create_engine.isolation_level` parameter was used directly.

Fixes: #7853
Change-Id: Iafc78070737ad117f84262e4bde84b81a81e4ea1
(cherry picked from commit 56366924673f88e51c74d94058c11132a057ecfa)

3 years agoMerge "Add option to disable from linting for table valued function" into rel_1_4
mike bayer [Wed, 23 Mar 2022 16:59:39 +0000 (16:59 +0000)] 
Merge "Add option to disable from linting for table valued function" into rel_1_4

3 years agotrust user PK argument as given; don't reduce
Mike Bayer [Wed, 23 Mar 2022 00:14:04 +0000 (20:14 -0400)] 
trust user PK argument as given; don't reduce

Fixed issue where the :class:`_orm.Mapper` would reduce a user-defined
:paramref:`_orm.Mapper.primary_key` argument too aggressively, in the case
of mapping to a ``UNION`` where for some of the SELECT entries, two columns
are essentially equivalent, but in another, they are not, such as in a
recursive CTE. The logic here has been changed to accept a given
user-defined PK as given, where columns will be related to the mapped
selectable but no longer "reduced" as this heuristic can't accommodate for
all situations.

Fixes: #7842
Change-Id: Ie46f0a3d42cae0501641fa213da0a9d5ca26c3ad
(cherry picked from commit d051645463b169bf1535459653eff247cb772e62)

3 years agoAdd option to disable from linting for table valued function
Mike Bayer [Wed, 23 Mar 2022 14:07:13 +0000 (10:07 -0400)] 
Add option to disable from linting for table valued function

Added new parameter
:paramref:`.FunctionElement.table_valued.joins_implicitly`, for the
:meth:`.FunctionElement.table_valued` construct. This parameter indicates
that the given table-valued function implicitly joins to the table it
refers towards, essentially disabling the "from linting" feature, i.e. the
"cartesian product" warning, from taking effect due to the presence of this
parameter. May be used for functions such as ``func.json_each()``.

Fixes: #7845
Change-Id: I80edcb74efbd4417172132c0db4d9c756fdd5eae
(cherry picked from commit 04dcc5c704dbf0b22705523e263e512c24936175)

3 years agofix generate series example
Mike Bayer [Wed, 23 Mar 2022 14:09:18 +0000 (10:09 -0400)] 
fix generate series example

this just drove me nuts because it didn't include
render_derived(), doesn't run on PG as given

Change-Id: I5d39336231c97b6cd5477644a718282709db2e1f
(cherry picked from commit c565c470517e1cc70a7f33d1ad3d3256935f1121)

3 years agoclarify LIMIT/ORDER BY FAQ wording
Mike Bayer [Tue, 22 Mar 2022 18:02:04 +0000 (14:02 -0400)] 
clarify LIMIT/ORDER BY FAQ wording

this will be coming to main in a related patch.
scale back the language here as we have a lot of examples that
use limit without order by in order to retrieve an arbitrary
row.   If subqueryload is not being used, there's nothing
inherently wrong with this.

Change-Id: I73a37658328f46a2e48b3e467f46e324f1d6a5e8

3 years agouse begin() for settting up first PK
Mike Bayer [Mon, 21 Mar 2022 21:47:34 +0000 (17:47 -0400)] 
use begin() for settting up first PK

Change-Id: I227bbb46fbcbae1f60d3f5bb4dd2b9f41ca3dd0c
(cherry picked from commit 257f67b180cadf4ca0df0d1facf27d55c98df676)

3 years agonote that horizontal sharding supports multi schema translates
Mike Bayer [Mon, 21 Mar 2022 21:35:26 +0000 (17:35 -0400)] 
note that horizontal sharding supports multi schema translates

the horizontal sharding API needs some work as it is
still exposing some legacy details, but in any case illustrate
how we can, for the moment, to use multiple schema translate
maps in a single session.

A lot more cleanup is needed in horizontal sharding, see #7837

Change-Id: Ia925e2226ecee9d747a8c4fc1772917f10bc505f
References: #7832
References: #7837
(cherry picked from commit 2a1afd32b82e103961f305b478d4cc6f6244cd00)

3 years agoadditional updates to stream results note
Mike Bayer [Mon, 21 Mar 2022 20:29:59 +0000 (16:29 -0400)] 
additional updates to stream results note

Change-Id: I9d7ed9f412a2d9384f6c0b50316df79b6f8f481a
(cherry picked from commit 512807f02d7aa6c4074910f1d0fba2187f50ee8f)

3 years agoadd note that schema translate not supported per object
Mike Bayer [Mon, 21 Mar 2022 13:07:51 +0000 (09:07 -0400)] 
add note that schema translate not supported per object

Fixes: #7832
Change-Id: I241e4cbd1b5d6df46e49e29e4ab1cac021f2895c
(cherry picked from commit 75a601e2fda7b849b858455eaa17d772bd2381e5)

3 years agocatch unexpected errors when accessing clslevel attribute
Mike Bayer [Fri, 18 Mar 2022 14:33:40 +0000 (10:33 -0400)] 
catch unexpected errors when accessing clslevel attribute

Improved the error message that's raised for the case where the
:func:`.association_proxy` construct attempts to access a target attribute
at the class level, and this access fails. The particular use case here is
when proxying to a hybrid attribute that does not include a working
class-level implementation.

Fixes: #7827
Change-Id: Ic6ff9df010f49253e664a1e7c7e16d8546006965
(cherry picked from commit 764e36e5e7b7faf1a97b4b06be1ca307ac4fce46)

3 years agoGit ignore lib/sqlalchemy/cyextension for 1.4
Gord Thompson [Tue, 15 Mar 2022 00:03:29 +0000 (18:03 -0600)] 
Git ignore lib/sqlalchemy/cyextension for 1.4

Change-Id: Ic5978375278ef6bd49d8ae15a7d6452db1870365

3 years agoMerge "Fix "Ambiguous column name" error on FK reflection" into rel_1_4
mike bayer [Thu, 17 Mar 2022 18:21:45 +0000 (18:21 +0000)] 
Merge "Fix "Ambiguous column name" error on FK reflection" into rel_1_4

3 years agoremove intermediary _is_clone_of entries when cloning
Mike Bayer [Wed, 16 Mar 2022 16:37:20 +0000 (12:37 -0400)] 
remove intermediary _is_clone_of entries when cloning

Improvements in memory usage by the ORM, removing a significant set of
intermediary expression objects that are typically stored when a copy of an
expression object is created. These clones have been greatly reduced,
reducing the number of total expression objects stored in memory by
ORM mappings by about 30%.

note this change causes the tests to have a bit of a harder time with
GC, which we would assume is because mappings now have a lot more
garbage to clean up after mappers are configured.   it remains
to be seen what the long term effects of this are.

Fixes: #7823
Change-Id: If8729747ffb9bf27e8974f069a994b5a823ee095
(cherry picked from commit b8db80e9ea917e4770c78feff092044d386985c6)

3 years agoFix "Ambiguous column name" error on FK reflection
Gord Thompson [Mon, 14 Mar 2022 17:26:54 +0000 (11:26 -0600)] 
Fix "Ambiguous column name" error on FK reflection

Fixes: #7812
Change-Id: Ic16eff9a9201d34515cb8eb884270eced4e1196a
(cherry picked from commit 84a78a97b5903dc246155a63ee8514385ed95d7c)

3 years agorestore quickstart to toc
Mike Bayer [Fri, 11 Mar 2022 21:23:14 +0000 (16:23 -0500)] 
restore quickstart to toc

this was coming out wrong due to the wrong header level
on the page.  it needs to be in a visible toc so that
the inner elements show up on the sidebar / top mobile nav.

Change-Id: I13acbe0d82c6a839230bc2e2454e4ab82e4879e6
(cherry picked from commit df056af49c51dcbcd70eb13ead5c3d8588c08235)

3 years agofurther simplify pool-sharing doc
Mike Bayer [Fri, 11 Mar 2022 21:01:09 +0000 (16:01 -0500)] 
further simplify pool-sharing doc

1. the event based approach doesn't require dispose() to be
   called at all, and the note that the "pool will hang" makes
   no sense.   I have no idea what that refers towards
2. the subsequent paragraph about connections and sessions
   is unintelligible.  old paragraphs like these are likely
   why people complain about the docs so much.  try to just
   say "don't do this", as that is easier than trying to
   explain to use connection.invalidate() etc.

Change-Id: Id840c65a2f71583ced4dc82fd8690e7da4c4b10e
(cherry picked from commit b098d2a8b9c8a6fd1ddc5dce1eca7e70ace3f545)

3 years agodispose session outside of child proc
Mike Bayer [Fri, 11 Mar 2022 19:59:04 +0000 (14:59 -0500)] 
dispose session outside of child proc

disposing inside the child proc can interfere with the parent
process.  we likely never considered this.

Fixes: #7815
Change-Id: I6ad0e5840655ed99a9d30002eba280c8e44a5c2e
(cherry picked from commit 936f0b2fc226171a81df3ca66c269750e7e52436)

3 years agotake quickstart out of main TOC for now
Mike Bayer [Fri, 11 Mar 2022 19:10:17 +0000 (14:10 -0500)] 
take quickstart out of main TOC for now

looks kind of awkward and isn't reference

Change-Id: I4fb664f79b792a32c6695a9cae7b1845a3044271
(cherry picked from commit d866eec2adcdfa2dd01e4c12d11cc2702ab2ff5e)

3 years agofix section format headings, remove "Step: "
Mike Bayer [Fri, 11 Mar 2022 19:07:09 +0000 (14:07 -0500)] 
fix section format headings, remove "Step: "

Change-Id: I25a837cf866b152a30aa373d07f704e0cc11d497
(cherry picked from commit 575a5e44bae4e587ff19d4137e54a7888ee08e41)

3 years agoadd copybutton
Mike Bayer [Fri, 11 Mar 2022 18:40:16 +0000 (13:40 -0500)] 
add copybutton

works great, including for plain code plus prompt code
with SQL (copies only the prompt code when prompts are present).
added some styling to zzzeeksphinx

Change-Id: I1b94b0488689e875adfb90ec171e04f7e8022415
(cherry picked from commit 7a48471f6482576ac50abab35ce4fa64c1f633b4)

3 years agoORM quickstart
Mike Bayer [Fri, 11 Mar 2022 15:08:36 +0000 (10:08 -0500)] 
ORM quickstart

This is done in 1.4 style so it can be backported to 1.4.
Will put this up as is, we can work on it.   For 2.0, the
ORM mapping will be updated to mapped_column() style when
we do the full pass.

Change-Id: Icfdf81449973844dac244b3a107ce955a7d3b16c
(cherry picked from commit 86fbd4a2155c31cd79f7446456b03f4cd5249050)

3 years agoMerge "support adapt_on_names for with_polymorphic" into rel_1_4
mike bayer [Wed, 9 Mar 2022 15:37:18 +0000 (15:37 +0000)] 
Merge "support adapt_on_names for with_polymorphic" into rel_1_4

3 years agoadd note about slots=True for attrs
Mike Bayer [Tue, 8 Mar 2022 23:38:11 +0000 (18:38 -0500)] 
add note about slots=True for attrs

Fixes: #7802
Change-Id: Ic5fadd369a0b63309cd9c44798ee5395efdbab2b
(cherry picked from commit e790b11460ffaf8cc68b309ad47fe0e314b2c67f)