]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
2 years agoMerge "accomodate schema translate keys present or not present" into main
mike bayer [Tue, 27 Jun 2023 17:33:15 +0000 (17:33 +0000)] 
Merge "accomodate schema translate keys present or not present" into main

2 years agoaccomodate schema translate keys present or not present
Mike Bayer [Tue, 27 Jun 2023 14:17:36 +0000 (10:17 -0400)] 
accomodate schema translate keys present or not present

Adjusted the :paramref:`_sa.create_engine.schema_translate_map` feature
such that **all** schema names in the statement are now tokenized,
regardless of whether or not a specific name is in the immediate schema
translate map given, and to fallback to substituting the original name when
the key is not in the actual schema translate map at execution time.  These
two changes allow for repeated use of a compiled object with schema
schema_translate_maps that include or dont include various keys on each
run, allowing cached SQL constructs to continue to function at runtime when
schema translate maps with different sets of keys are used each time. In
addition, added detection of schema_translate_map dictionaries which gain
or lose a ``None`` key across calls for the same statement, which affects
compilation of the statement and is not compatible with caching; an
exception is raised for these scenarios.

Fixes: #10025
Change-Id: I6f5e0c8e067d1702a3647b6251af483669ad854b

2 years agoFix SQL syntax for CAST with explicit collation
Gord Thompson [Sat, 24 Jun 2023 22:05:42 +0000 (16:05 -0600)] 
Fix SQL syntax for CAST with explicit collation

Fixes: #9932
Change-Id: I557e00cfc0725e2f247103dea484a7e818592f7f

2 years agoadd option to create scalar object on none attribute set
Mike Bayer [Sat, 24 Jun 2023 01:57:41 +0000 (21:57 -0400)] 
add option to create scalar object on none attribute set

Added new option to :func:`.association_proxy`
:paramref:`.association_proxy.create_on_none_assignment`; when an
association proxy which refers to a scalar relationship is assigned the
value ``None``, and the referenced object is not present, a new object is
created via the creator.  This was apparently an undefined behavior in the
1.2 series that was silently removed.

Fixes: #10013
Change-Id: I3aae484b8cf5218588b1db63e691cd86214fbbad

2 years agoVersion 2.0.18 placeholder
Mike Bayer [Fri, 23 Jun 2023 15:00:47 +0000 (11:00 -0400)] 
Version 2.0.18 placeholder

2 years ago- 2.0.17 rel_2_0_17
Mike Bayer [Fri, 23 Jun 2023 14:47:57 +0000 (10:47 -0400)] 
- 2.0.17

2 years agoadd explicit warning re: mapped_column.default
Mike Bayer [Fri, 23 Jun 2023 14:45:12 +0000 (10:45 -0400)] 
add explicit warning re: mapped_column.default

Change-Id: I3ac7133323a02cb70e20de2fd96cc31842ead4f1
References: #9936
References: #10009

2 years agoMerge "expand "is_unnatural" to include all mapper inheritance paths" into main
mike bayer [Fri, 23 Jun 2023 13:59:12 +0000 (13:59 +0000)] 
Merge "expand "is_unnatural" to include all mapper inheritance paths" into main

2 years agoexpand "is_unnatural" to include all mapper inheritance paths
Mike Bayer [Thu, 22 Jun 2023 22:11:07 +0000 (18:11 -0400)] 
expand "is_unnatural" to include all mapper inheritance paths

Fixed issue in ORM loader strategy logic which further allows for long
chains of :func:`_orm.contains_eager` loader options across complex
inheriting polymorphic / aliased / of_type() relationship chains to take
proper effect in queries.

Fixes: #10006
Change-Id: If803a7709ba8fd341fedb3b9282e0930c95fb5cd

2 years agofix typo (#9996)
Seonbeom Kim [Thu, 22 Jun 2023 19:30:07 +0000 (04:30 +0900)] 
fix typo (#9996)

onpudate -> onupdate when onupdate is None

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

2 years agoMerge "add correct descriptor methods to dynamic/writeonly" into main
mike bayer [Wed, 21 Jun 2023 17:57:15 +0000 (17:57 +0000)] 
Merge "add correct descriptor methods to dynamic/writeonly" into main

2 years agoadd correct descriptor methods to dynamic/writeonly
Mike Bayer [Tue, 20 Jun 2023 14:11:14 +0000 (10:11 -0400)] 
add correct descriptor methods to dynamic/writeonly

Fixed typing issue which prevented :class:`_orm.WriteOnlyMapped` and
:class:`_orm.DynamicMapped` attributes from being used fully within ORM
queries.

Fixes: #9985
Change-Id: I33eef4d06fc84e85f2ea1a997a017ffce47df7d6

2 years agotrack state change within _connection_for_bind()
Mike Bayer [Mon, 19 Jun 2023 15:54:35 +0000 (11:54 -0400)] 
track state change within _connection_for_bind()

Additional hardening and documentation for the ORM :class:`_orm.Session`
"state change" system, which detects concurrent use of
:class:`_orm.Session` and :class:`_asyncio.AsyncSession` objects; an
additional check is added within the process to acquire connections from
the underlying engine, which is a critical section with regards to internal
connection management.

Change-Id: I6893c53e016218ff6cfb39709179ca4bf73a2414
Fixes: #9973
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

2 years agoTyping: url in create_mock_engine can be a string (#9980)
Shadab Zafar [Tue, 20 Jun 2023 18:51:19 +0000 (00:21 +0530)] 
Typing: url in create_mock_engine can be a string (#9980)

* Typing: url in create_mock_engine can be a string

Similar to create_engine

* run back on the code

Change-Id: Ie92aaa121e587c93f2d9c0b8c06f194685bb070e

---------

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
2 years agofix typo in validates docs (#9983)
Federico Caselli [Tue, 20 Jun 2023 17:52:06 +0000 (19:52 +0200)] 
fix typo in validates docs (#9983)

2 years agopg8000: Support range and multirange types
Tony Locke [Mon, 19 Jun 2023 20:32:18 +0000 (16:32 -0400)] 
pg8000: Support range and multirange types

The pg8000 dialect now supports RANGE and MULTIRANGE datatypes, using the
existing RANGE API described at :ref:`postgresql_ranges`.  Range and
multirange types are supported in the pg8000 driver from version 1.29.8.
Pull request courtesy Tony Locke.

Fixes: #9965
Closes: #9966
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9966
Pull-request-sha: b48dc3ef9cbb267fe945d08ca38240c68b716f79

Change-Id: I61778fe35f9edbf93f440136e6667847bcec4b9c

2 years agoMerge "default Enum name to None and don't remove given name" into main
mike bayer [Mon, 19 Jun 2023 14:31:53 +0000 (14:31 +0000)] 
Merge "default Enum name to None and don't remove given name" into main

2 years agodefault Enum name to None and don't remove given name
Mike Bayer [Thu, 15 Jun 2023 22:34:57 +0000 (18:34 -0400)] 
default Enum name to None and don't remove given name

Fixed issue in support for the :class:`.Enum` datatype in the
:paramref:`_orm.registry.type_annotation_map` first added as part of
:ticket:`8859` where using a custom :class:`.Enum` with fixed configuration
in the map would fail to transfer the :paramref:`.Enum.name` parameter,
which among other issues would prevent PostgreSQL enums from working if the
enum values were passed as individual values.  Logic has been updated so
that "name" is transferred over, but also that the default :class:`.Enum`
which is against the plain Python `enum.Enum` class or other "empty" enum
won't set a hardcoded name of ``"enum"`` either.

Fixes: #9963
Change-Id: I36526dcb5443579fcd604b0c02bd1f02ca85a977

2 years agofix typo: `async_attrs` to `awaitable_attrs` (#9961)
Alc-Alc [Sat, 17 Jun 2023 09:59:48 +0000 (15:29 +0530)] 
fix typo: `async_attrs` to `awaitable_attrs` (#9961)

Co-authored-by: Alc <alc@localhost>
2 years agoMerge "improve support for declared_attr returning ORMDescriptor" into main
mike bayer [Fri, 16 Jun 2023 12:20:09 +0000 (12:20 +0000)] 
Merge "improve support for declared_attr returning ORMDescriptor" into main

2 years agoimprove support for declared_attr returning ORMDescriptor
Mike Bayer [Thu, 15 Jun 2023 13:18:38 +0000 (09:18 -0400)] 
improve support for declared_attr returning ORMDescriptor

Fixed issue in ORM Annotated Declarative which prevented a
:class:`_orm.declared_attr` with or without
:attr:`_orm.declared_attr.directive` from being used on a mixin which did
not return a :class:`.Mapped` datatype, and instead returned a supplemental
ORM datatype such as :class:`.AssociationProxy`.  The Declarative runtime
would erroneously try to interpret this annotation as needing to be
:class:`.Mapped` and raise an error.

Fixed typing issue where using the :class:`.AssociationProxy` return type
from a :class:`_orm.declared_attr` function was disallowed.

Fixes: #9957
Change-Id: I797c5bbdb3d1e81a04ed21c6558ec349b970476f

2 years agoMerge "warn for other mapper property objects assigned twice" into main
mike bayer [Thu, 15 Jun 2023 14:35:33 +0000 (14:35 +0000)] 
Merge "warn for other mapper property objects assigned twice" into main

2 years agowarn for other mapper property objects assigned twice
Mike Bayer [Wed, 14 Jun 2023 14:51:43 +0000 (10:51 -0400)] 
warn for other mapper property objects assigned twice

was already in place for columns via other means

A warning is emitted when an ORM :func:`_orm.relationship` and other
:class:`.MapperProperty` objects are assigned to two different class
attributes at once; only one of the attributes will be mapped.  A warning
for this condition was already in place for :class:`_schema.Column` and
:class:`_orm.mapped_column` objects.

Fixes: #3532
Change-Id: Ib8057bdf229aa92137f9b8f61b26d4008181ead6

2 years agoMerge "Fixed regression with callables as daclasses defaults" into main
mike bayer [Wed, 14 Jun 2023 12:57:08 +0000 (12:57 +0000)] 
Merge "Fixed regression with callables as daclasses defaults" into main

2 years agoFixed regression with callables as daclasses defaults
Federico Caselli [Mon, 12 Jun 2023 20:55:15 +0000 (22:55 +0200)] 
Fixed regression with callables as daclasses defaults

Fixed regression introduced in 2.0.16 by :ticket:`9879` where passing a
callable to the :paramref:`_orm.mapped_column.default` parameter of
:class:`_orm.mapped_column` while also setting ``init=False`` would
interpret this value as a Dataclass default value which would be assigned
directly to new instances of the object directly, bypassing the default
generator taking place as the as the :paramref:`_schema.Column.default`
value generator on the underlying :class:`_schema.Column`.  This condition
is now detected so that the previous behavior is maintained, however a
deprecation warning for this ambiguous use is emitted; to populate the
default generator for a :class:`_schema.Column`, the
:paramref:`_orm.mapped_column.insert_default` parameter should be used,
which disambiguates from the :paramref:`_orm.mapped_column.default`
parameter whose name is fixed as per pep-681.

Fixes: #9936
Change-Id: I7e2c1c723e4711ec470336fcb4867f41c40f9d6b

2 years agofix typo in sphinx target introduced in bd290c4329b80c85475c6a76eec2fd6574f9781f
Federico Caselli [Tue, 13 Jun 2023 19:19:51 +0000 (21:19 +0200)] 
fix typo in sphinx target introduced in bd290c4329b80c85475c6a76eec2fd6574f9781f

Change-Id: Ie085696fca3ce44ad7af611246fc8be45abbc433

2 years agoMerge "various minor docs improvements" into main
mike bayer [Tue, 13 Jun 2023 13:54:50 +0000 (13:54 +0000)] 
Merge "various minor docs improvements" into main

2 years agoMerge branch 'origin/main'
Federico Caselli [Mon, 12 Jun 2023 22:32:23 +0000 (00:32 +0200)] 
Merge branch 'origin/main'

Change-Id: I6f3e8bbce3867bc44db9e45216876615210c1dfb

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

Change-Id: Id05669b22761acf36953aa1c89ee06d990ff3179

2 years agovarious minor docs improvements
Federico Caselli [Mon, 12 Jun 2023 20:08:19 +0000 (22:08 +0200)] 
various minor docs improvements

Change-Id: I5e7332047c03260792bf990aafd0ef4e15f5f082

2 years agoBump pypa/cibuildwheel from 2.13.0 to 2.13.1 (#9938)
dependabot[bot] [Mon, 12 Jun 2023 20:11:32 +0000 (22:11 +0200)] 
Bump pypa/cibuildwheel from 2.13.0 to 2.13.1 (#9938)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.13.0 to 2.13.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.13.0...v2.13.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoMerge "Align `AsyncSession` method annotations with `Session` equivalents" into main
Federico Caselli [Mon, 12 Jun 2023 20:10:57 +0000 (20:10 +0000)] 
Merge "Align `AsyncSession` method annotations with `Session` equivalents" into main

2 years agoAdd `_WILDCARD_TOKEN` special case in `_chop_path`
Matthew Martin [Sun, 11 Jun 2023 14:00:22 +0000 (10:00 -0400)] 
Add `_WILDCARD_TOKEN` special case in `_chop_path`

### Description
<!-- Describe your changes in detail -->

Add special case to `_chop_path` for initial `_WILDCARD_TOKEN` matching `_DEFAULT_TOKEN` to allow for a top level `undefer_group` load option with other load options. Fixes #9870.

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

-->

This pull request is:

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

**Have a nice day!**

Closes: #9931
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9931
Pull-request-sha: c073f0904f12909ff660beef6576f6476a725592

Change-Id: Ic1158b3b0306e9a1bba86ab0b9f07700a6352398

2 years agoAlign `AsyncSession` method annotations with `Session` equivalents
Janek Nouvertné [Sun, 11 Jun 2023 10:07:26 +0000 (06:07 -0400)] 
Align `AsyncSession` method annotations with `Session` equivalents

Fixes a few differences in the parameter signatures of `asyncio.ext.AsyncSession` that were misaligned with `orm.Session`. Fixes #9925

### Description

- Change the annotation of the `params` parameter of `.scalar`, `.scalars` and `.stream_scalars` from `_CoreSingleExecuteParams` to `_CoreAnyExecuteParams`
- Add named keyword arguments `bind_arguments` and `execution_options` to `.connection`

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

-->

This pull request is:

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

**Have a nice day!**

Closes: #9929
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9929
Pull-request-sha: 481f3ad94efab14f7a63a38c195810811b7ed90f

Change-Id: I84c5a68f5d95c903dd64928a23ad0cb796df778c

2 years agoVersion 2.0.17 placeholder
Mike Bayer [Sat, 10 Jun 2023 20:04:09 +0000 (16:04 -0400)] 
Version 2.0.17 placeholder

2 years ago- 2.0.16 rel_2_0_16
Mike Bayer [Sat, 10 Jun 2023 19:42:45 +0000 (15:42 -0400)] 
- 2.0.16

2 years agochangelog improvements
Mike Bayer [Sat, 10 Jun 2023 19:40:48 +0000 (15:40 -0400)] 
changelog improvements

Change-Id: Ic55b5ffd3aa5af803041fc0918e087499a798b40

2 years agodoc: Update connection example (#9926)
Inada Naoki [Sat, 10 Jun 2023 18:34:07 +0000 (03:34 +0900)] 
doc: Update connection example (#9926)

Row object is now namedtuple-like.

2 years agoMerge "feat: add `async_creator` argument to `create_async_engine`" into main
mike bayer [Fri, 9 Jun 2023 20:08:39 +0000 (20:08 +0000)] 
Merge "feat: add `async_creator` argument to `create_async_engine`" into main

2 years agoMerge "fix: allow escape value to be an empty string" into main
mike bayer [Fri, 9 Jun 2023 17:50:26 +0000 (17:50 +0000)] 
Merge "fix: allow escape value to be an empty string" into main

2 years agoMerge "ensure primary key values all present for ORM bulk UPDATE" into main
mike bayer [Fri, 9 Jun 2023 16:32:39 +0000 (16:32 +0000)] 
Merge "ensure primary key values all present for ORM bulk UPDATE" into main

2 years agofeat: add `async_creator` argument to `create_async_engine`
Jack Wotherspoon [Sun, 4 Jun 2023 08:59:23 +0000 (04:59 -0400)] 
feat: add `async_creator` argument to `create_async_engine`

Added new :paramref:`_asyncio.create_async_engine.async_creator` parameter
to :func:`.create_async_engine`, which accomplishes the same purpose as the
:paramref:`.create_engine.creator` parameter of :func:`.create_engine`.
This is a no-argument callable that provides a new asyncio connection,
using the asyncio database driver directly. The
:func:`.create_async_engine` function will wrap the driver-level connection
in the appropriate structures. Pull request curtesy of Jack Wotherspoon.

Fixes #8215
Closes: #9854
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9854
Pull-request-sha: 537073e71e745696f4adb86191b72dd3547b5c95

Change-Id: I184c59ee68436e910464b717f2cbb7e314c1c2cc

2 years agoensure primary key values all present for ORM bulk UPDATE
Mike Bayer [Thu, 8 Jun 2023 21:40:01 +0000 (17:40 -0400)] 
ensure primary key values all present for ORM bulk UPDATE

Fixed bug in new feature where ORM bulk UPDATE can be combined with a WHERE
clause, added in version 2.0.11 as part of :ticket:`9583`, where sending
dictionaries that did not include the primary key values for each row would
run through the bulk process and include "pk=NULL" for the rows, silently
failing.   An exception is now raised if primary key values for bulk UPDATE
are not supplied.

Additionally, document WHERE criteria feature as well as how to
invoke an UPDATE outside of "bulk orm by primary key"

Fixes: #9917
Change-Id: Ie8e0d604050f0dfbab77473020771383c087d14a

2 years agofix: allow escape value to be an empty string
Martin Caslavsky [Thu, 8 Jun 2023 21:34:38 +0000 (17:34 -0400)] 
fix: allow escape value to be an empty string

Fixed issue where the :paramref:`.ColumnOperators.like.escape` and similar
parameters did not allow an empty string as an argument that would be
passed through as the "escape" character; this is a supported syntax by
PostgreSQL.  Pull requset courtesy Martin Caslavsky.

Fixes: #9907
Closes: #9908
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9908
Pull-request-sha: d7ecc1778a07b17adfa58050b44f6e2945dd1448

Change-Id: I39adb765a1b9650fe891883ed0973df66adc4e81

2 years agoMerge "deprecate InstanceState.unloaded_expirable" into main
mike bayer [Thu, 8 Jun 2023 19:15:14 +0000 (19:15 +0000)] 
Merge "deprecate InstanceState.unloaded_expirable" into main

2 years agodeprecate InstanceState.unloaded_expirable
Mike Bayer [Thu, 8 Jun 2023 15:41:41 +0000 (11:41 -0400)] 
deprecate InstanceState.unloaded_expirable

The :attr:`_orm.InstanceState.unloaded_expirable` attribute is a synonym
for :attr:`_orm.InstanceState.unloaded`, and is now deprecated; this
attribute was always implementation-specific and should not have been
public.

Fixes: #9913
Change-Id: Iadc25b0a8add164f9d70e6e4fe57dcd083902927

2 years agoMerge "PG nulls not distinct support" into main
mike bayer [Wed, 7 Jun 2023 15:46:33 +0000 (15:46 +0000)] 
Merge "PG nulls not distinct support" into main

2 years agoGuard against mapped classes in map_imperatively.
Federico Caselli [Wed, 31 May 2023 20:36:00 +0000 (22:36 +0200)] 
Guard against mapped classes in map_imperatively.

Added a check to prevent invocation of
meth:`_orm.registry.map_imperatively` using a mapped class as
paramref:`_orm.registry.map_imperatively.local_table`.

Fixes: #9869
Change-Id: Id404f75bf0af69eea942ad71662593bdafbd92ce

2 years agoPG nulls not distinct support
pavelserchenia [Fri, 26 May 2023 11:16:54 +0000 (07:16 -0400)] 
PG nulls not distinct support

Added support for PostgreSQL 10 ``NULLS NOT DISTINCT`` feature of
unique indexes and unique constraint using the dialect option
postgresql_nulls_not_distinct``.
Updated the reflection logic to also correctly take this option
into account.

Fixes: #8240
Closes: #9834
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9834
Pull-request-sha: 825a4ff13a1f428470e184944a167c9d4c57e604

Change-Id: I6585fbb05ad32a131cf9ba25a59f7b229bce5b52

2 years agoskip sqlite file for this test
Mike Bayer [Tue, 6 Jun 2023 03:01:57 +0000 (23:01 -0400)] 
skip sqlite file for this test

the cursor not being consumed leaves the database locked until
the program exits.  i cant find any way to free up the file otherwise

Change-Id: Iaa723e217a9206c91e748cf9b0775a06209d599c

2 years agoMerge "add 3.12" into main
mike bayer [Mon, 5 Jun 2023 19:51:55 +0000 (19:51 +0000)] 
Merge "add 3.12" into main

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

Here we are pulling in a current fork of greenlet that works
for python 3.12.   It works though there is one issue with aiosqlite
that might be related.

a non-voting py312 job is added to gerrit / jenkins

Fixes: #9819
Change-Id: I91a51dcbad2902f7c4c7cec88ebbf42c2417b512

2 years agoMerge "use internal declarative creator for DeclarativeBaseNoMeta" into main
mike bayer [Mon, 5 Jun 2023 18:40:04 +0000 (18:40 +0000)] 
Merge "use internal declarative creator for DeclarativeBaseNoMeta" into main

2 years agoonce again note pydantic is never really going to work
Mike Bayer [Mon, 5 Jun 2023 16:26:43 +0000 (12:26 -0400)] 
once again note pydantic is never really going to work

In #9894 we see that pydantic's dataclass feature is doing an
end run around SQLAlchemy's collection mechanics that can't
be fixed without special steps, which we would surmise
is what SQLModel is doing here:

https://github.com/tiangolo/sqlmodel/blob/43a689d369f52b72aac60efd71111aba7d84714d/sqlmodel/main.py#L507

We don't do that, so note that we really are not supporting pydantic
directly; use SQLModel which was designed to resolve these issues.

Change-Id: I3e35e108546022c83d6c0ae73e32432cdc75d325

2 years agouse internal declarative creator for DeclarativeBaseNoMeta
Mike Bayer [Tue, 30 May 2023 18:54:42 +0000 (14:54 -0400)] 
use internal declarative creator for DeclarativeBaseNoMeta

Fixed issue where :class:`.DeclarativeBaseNoMeta` declarative base class
would not function with non-mapped mixins or abstract classes, raising an
``AttributeError`` instead.

Fixes: #9862
Change-Id: I91cfe663530a2eb712004b9fb09d3f0cefcaeef5

2 years agoMerge "Support dataclass default with init=False" into main
mike bayer [Mon, 5 Jun 2023 15:24:36 +0000 (15:24 +0000)] 
Merge "Support dataclass default with init=False" into main

2 years agoadd 058c230cea83811c3bebdd8259988c5c501f4f7e to ignore revs
Mike Bayer [Sun, 4 Jun 2023 14:40:52 +0000 (10:40 -0400)] 
add 058c230cea83811c3bebdd8259988c5c501f4f7e to ignore revs

Change-Id: I74eb858f8264f2b8bb8d64c280f2035cd2177690

2 years agoMerge "Update black to v23.3.0 and flake8 to v6" into main
mike bayer [Sun, 4 Jun 2023 14:35:14 +0000 (14:35 +0000)] 
Merge "Update black to v23.3.0 and flake8 to v6" into main

2 years agoSupport dataclass default with init=False
Federico Caselli [Sat, 3 Jun 2023 10:40:00 +0000 (12:40 +0200)] 
Support dataclass default with init=False

Fixed an issue where generating dataclasses fields that specified a
default`` value and set ``init=False`` would not work.
The dataclasses behavior in this case is to set the default
value on the class, that's not compatible with the descriptors used
by SQLAlchemy. To support this case the default is transformed to
a ``default_factory`` when generating the dataclass.

Fixes: #9879
Change-Id: I5151d388232eacd506a100ba18ce26970bf83cf3

2 years agoMerge "base _O around object, not Any" into main
mike bayer [Fri, 2 Jun 2023 17:57:51 +0000 (17:57 +0000)] 
Merge "base _O around object, not Any" into main

2 years agoAdd psycopg binary to extras (#9865)
Vlastimil Zíma [Wed, 31 May 2023 19:54:19 +0000 (21:54 +0200)] 
Add psycopg binary to extras (#9865)

2 years agorun format_docs_code.py on changes to self_referential.rst
Mike Bayer [Wed, 31 May 2023 13:00:31 +0000 (09:00 -0400)] 
run format_docs_code.py on changes to self_referential.rst

Change-Id: I801b9324fa4e390da0cb6081d5a754cd06314a50

2 years agoremove outdated docs section from psycopg dialect
Federico Caselli [Tue, 30 May 2023 20:23:14 +0000 (22:23 +0200)] 
remove outdated docs section from psycopg dialect

Fixes: #9858
Change-Id: I2348e5508714fb7cf9a509eaa57b9e011c72965b

2 years agoUpdate black to v23.3.0 and flake8 to v6
Federico Caselli [Tue, 30 May 2023 19:40:21 +0000 (21:40 +0200)] 
Update black to v23.3.0 and flake8 to v6

This change could be added to .git-blame-ignore-revs

Change-Id: I7ba10052b26bc3c178d23fb50a1123d0aae965ca

2 years agoupdate adjacency list docs / example for 2.0
Mike Bayer [Tue, 30 May 2023 18:27:32 +0000 (14:27 -0400)] 
update adjacency list docs / example for 2.0

References: #9859

2 years agoBump pypa/cibuildwheel from 2.12.3 to 2.13.0 (#9851)
dependabot[bot] [Mon, 29 May 2023 18:50:37 +0000 (20:50 +0200)] 
Bump pypa/cibuildwheel from 2.12.3 to 2.13.0 (#9851)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.12.3 to 2.13.0.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.12.3...v2.13.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoUpdate associationproxy.rst (#9848)
Peter Schutt [Mon, 29 May 2023 18:46:51 +0000 (04:46 +1000)] 
Update associationproxy.rst (#9848)

* Update associationproxy.rst

Missing import of `List` causes "Could not interpret annotation..." error.

* Update doc/build/orm/extensions/associationproxy.rst

---------

Co-authored-by: Federico Caselli <CaselIT@users.noreply.github.com>
2 years agobase _O around object, not Any
Mike Bayer [Mon, 29 May 2023 16:25:42 +0000 (12:25 -0400)] 
base _O around object, not Any

There were only a few trivial errors related to this
TypeVar being linked to object which were correctable at the
source.   It's not clear if there were more errors with older
versions of mypy and/or the codebase when this was first developed.

Change-Id: Ic07ba08e600574b6277ba8540504355e9d7b676c
References: #9835

2 years agoMerge "Improve PostgreSQL custom operators" into main
mike bayer [Sun, 28 May 2023 13:29:14 +0000 (13:29 +0000)] 
Merge "Improve PostgreSQL custom operators" into main

2 years agoMerge "tighten up overwritten attribute detection and use a deprecation" into main
mike bayer [Sun, 28 May 2023 13:27:05 +0000 (13:27 +0000)] 
Merge "tighten up overwritten attribute detection and use a deprecation" into main

2 years agoImprove PostgreSQL custom operators
Federico Caselli [Fri, 26 May 2023 22:36:04 +0000 (00:36 +0200)] 
Improve PostgreSQL custom operators

Unified the custom PostgreSQL operator definitions, since they are
shared among multiple different data types.

Use proper precedence on PostgreSQL specific operators, such as ``@>``.
Previously the precedence was wrong, leasing to wrong parenthesis when
rending against and ``ANY`` or ``ALL`` construct.

Fixes: #9041
Fixes: #9836
Change-Id: I1c1d8b4c2d58d53c51c2e6d4934ac1ed83bda5d3

2 years agoMerge "Improve PG reflection compat." into main
mike bayer [Sat, 27 May 2023 13:07:22 +0000 (13:07 +0000)] 
Merge "Improve PG reflection compat." into main

2 years agotighten up overwritten attribute detection and use a deprecation
Mike Bayer [Fri, 26 May 2023 14:51:02 +0000 (10:51 -0400)] 
tighten up overwritten attribute detection and use a deprecation

A deprecation warning is emitted whenever a property is added to a
:class:`_orm.Mapper` where an ORM mapped property were already configured,
or an attribute is already present on the class. Previously, there was a
non-deprecation warning for this case that did not emit consistently. The
logic for this warning has been improved so that it detects end-user
replacement of attribute while not having false positives for internal
Declarative and other cases where replacement of descriptors with new ones
is expected.

Fixes: #9841
Change-Id: I21ef25571466eeca3fedbec71612f7553fdbf2bf

2 years agoQueuePool is now default for SQLite
Seth [Fri, 26 May 2023 19:28:34 +0000 (15:28 -0400)] 
QueuePool is now default for SQLite

Closes: #9734
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9734
Pull-request-sha: f956a5ee0451f8580dbe4e9b28985e7456c6c8a1

Change-Id: I664ba214c02664515655521129f84ab2905201d5

2 years agoDocumentation fixes (#9747)
F.D.Castel [Fri, 26 May 2023 19:27:17 +0000 (16:27 -0300)] 
Documentation fixes (#9747)

* Fix typos.

* Adjust FAQ entries about SQLite connection pooling in SQLALchemy 2.0.

* Rephrase.

* Changes suggested by @zzzeek.

2 years agochange conn.execute to connection.execute (#9842)
Tim Ryan [Fri, 26 May 2023 19:26:00 +0000 (15:26 -0400)] 
change conn.execute to connection.execute (#9842)

makes code executable

2 years agoUpdate check constraint docs for MySQL support (#9803)
Leah Einhorn [Fri, 26 May 2023 19:25:07 +0000 (15:25 -0400)] 
Update check constraint docs for MySQL support (#9803)

This is now supported as of version 8.0.16
https://dev.mysql.com/doc/refman/8.0/en/create-table-check-constraints.html

2 years agoImprove PG reflection compat.
Federico Caselli [Thu, 25 May 2023 22:17:40 +0000 (00:17 +0200)] 
Improve PG reflection compat.

Cast ``NAME`` columns to ``TEXT`` when using ``ARRAY_AGG`` in PostgreSQL
reflection. This seems to improve compatibility with some PostgreSQL
derivatives that may not support aggregations on the ``NAME`` type.

Fixes: #9838
Change-Id: I88e12f7b6aad6cf123961d169f90e29760e953a8

2 years agoMerge "add reflection arguments, engine/conn bind to DeferredReflection.prepare"...
mike bayer [Wed, 24 May 2023 13:17:24 +0000 (13:17 +0000)] 
Merge "add reflection arguments, engine/conn bind to DeferredReflection.prepare" into main

2 years agoMerge "attempt to clarify sentinel mismatch message" into main
mike bayer [Wed, 24 May 2023 13:14:52 +0000 (13:14 +0000)] 
Merge "attempt to clarify sentinel mismatch message" into main

2 years agoadd reflection arguments, engine/conn bind to DeferredReflection.prepare
Mike Bayer [Wed, 24 May 2023 02:21:30 +0000 (22:21 -0400)] 
add reflection arguments, engine/conn bind to DeferredReflection.prepare

Improved :meth:`.DeferredReflection.prepare` to accept arbitrary ``**kw``
arguments that are passed to :meth:`_schema.MetaData.reflect`, allowing use
cases such as reflection of views as well as dialect-specific arguments to
be passed. Additionally, modernized the
:paramref:`.DeferredReflection.prepare.bind` argument so that either an
:class:`.Engine` or :class:`.Connection` are accepted as the "bind"
argument.

Fixes: #9828
Change-Id: Ie93cd1147611a92f07d05df8a39052f61ee692f2

2 years agoFix formatting of cache logging output
Gord Thompson [Tue, 23 May 2023 13:50:34 +0000 (07:50 -0600)] 
Fix formatting of cache logging output

Change-Id: I8434c026b568e429fb04044a4a1c7d12acc1750e

2 years agoattempt to clarify sentinel mismatch message
Mike Bayer [Mon, 22 May 2023 23:09:31 +0000 (19:09 -0400)] 
attempt to clarify sentinel mismatch message

Fixes: #9822
Change-Id: Idd5d62e14e3018da939a985a306591d6898a397f

2 years agorestore and test correct defaults for validates() keyword args
Mike Bayer [Mon, 22 May 2023 17:12:58 +0000 (13:12 -0400)] 
restore and test correct defaults for validates() keyword args

Fixed regression in the 2.0 series where the default value of
:paramref:`_orm.validates.include_backrefs` got changed to ``False`` for
the :func:`_orm.validates` function. This default is now restored to
``True``.

Fixes: #9820
Change-Id: I9b7257b7c6e94c12fc894c7b78e5c1cb92acad67

2 years agouse python highlight for model example in large collections
Mike Bayer [Sat, 20 May 2023 15:53:44 +0000 (11:53 -0400)] 
use python highlight for model example in large collections

apparently the pycon+sql highlight doesn't work with
class definitions for some reason?   seems like something
to be aware of...

Fixes: #9810
Change-Id: I5cfca5e0fb9d797ff4068526d05e181b4ff71ebf

2 years agoVersion 2.0.16 placeholder
Mike Bayer [Sat, 20 May 2023 01:00:30 +0000 (21:00 -0400)] 
Version 2.0.16 placeholder

2 years ago- 2.0.15 rel_2_0_15
Mike Bayer [Sat, 20 May 2023 00:16:18 +0000 (20:16 -0400)] 
- 2.0.15

2 years agotypos
Mike Bayer [Sat, 20 May 2023 00:15:03 +0000 (20:15 -0400)] 
typos

Change-Id: I9df3f466e790a3f321ed4a32cce5488e9cdf68be

2 years agoMerge "establish Uuid as emulated, pg.UUID as nativeforemulated" into main
mike bayer [Fri, 19 May 2023 23:52:09 +0000 (23:52 +0000)] 
Merge "establish Uuid as emulated, pg.UUID as nativeforemulated" into main

2 years agoestablish Uuid as emulated, pg.UUID as nativeforemulated
Mike Bayer [Fri, 19 May 2023 19:56:31 +0000 (15:56 -0400)] 
establish Uuid as emulated, pg.UUID as nativeforemulated

Repaired the base :class:`.Uuid` datatype for the PostgreSQL dialect to
make proper use of the PG-specific ``UUID`` internal datatype when
"native_uuid" is selected, so that PG driver behaviors are included. This
issue became apparent due to the insertmanyvalues improvement made as part
of :ticket:`9618`, where in a similar manner as that of :ticket:` 9739`
where the asyncpg driver is very sensitive to datatype casts being present
or not, the PostgreSQL driver-specific native ``UUID`` datatype must be
invoked when this generic type is used.

also consolidate imv tests for largebinary, uuid into
suite/test_insert.py

Fixes: #9808
Change-Id: Ibadfaff86ddf7db37145b4d003ef4802bd6e8f26

2 years agoMerge "use an ORM compile state for all statements with any ORM entities anywhere...
mike bayer [Fri, 19 May 2023 19:58:25 +0000 (19:58 +0000)] 
Merge "use an ORM compile state for all statements with any ORM entities anywhere" into main

2 years agouse an ORM compile state for all statements with any ORM entities anywhere
Mike Bayer [Fri, 19 May 2023 13:35:30 +0000 (09:35 -0400)] 
use an ORM compile state for all statements with any ORM entities anywhere

As more projects are using new-style "2.0" ORM querying, it's becoming
apparent that the conditional nature of "autoflush", being based on whether
or not the given statement refers to ORM entities, is becoming more of a
key behavior. Up until now, the "ORM" flag for a statement has been loosely
based around whether or not the statement returns rows that correspond to
ORM entities or columns; the original purpose of the "ORM" flag was to
enable ORM-entity fetching rules which apply post-processing to Core result
sets as well as ORM loader strategies to the statement.  For statements
that don't build on rows that contain ORM entities, the "ORM" flag was
considered to be mostly unnecessary.

It still may be the case that "autoflush" would be better taking effect for
*all* usage of :meth:`_orm.Session.execute` and related methods, even for
purely Core SQL constructs. However, this still could impact legacy cases
where this is not expected and may be more of a 2.1 thing. For now however,
the rules for the "ORM-flag" have been opened up so that a statement that
includes ORM entities or attributes anywhere within, including in the WHERE
/ ORDER BY / GROUP BY clause alone, within scalar subqueries, etc. will
enable this flag.  This will cause "autoflush" to occur for such statements
and also be visible via the :attr:`_orm.ORMExecuteState.is_orm_statement`
event-level attribute.

Fixes: #9805
Change-Id: Idcabefc8fedd14edcf603b90e26e5982c849a1fc

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

2 years agoVersion 2.0.15 placeholder
Mike Bayer [Thu, 18 May 2023 18:17:10 +0000 (14:17 -0400)] 
Version 2.0.15 placeholder

2 years ago- 2.0.14 rel_2_0_14
Mike Bayer [Thu, 18 May 2023 18:06:26 +0000 (14:06 -0400)] 
- 2.0.14

2 years agoMerge "Move try_cast() from mssql to base" into main
mike bayer [Thu, 18 May 2023 17:28:41 +0000 (17:28 +0000)] 
Merge "Move try_cast() from mssql to base" into main

2 years agotypo
Mike Bayer [Thu, 18 May 2023 16:45:42 +0000 (12:45 -0400)] 
typo

Change-Id: Ie10e4e5674110f254d805aad0a07d4e7c0ce7f18

2 years agoMove try_cast() from mssql to base
Nick Crews [Thu, 18 May 2023 12:01:18 +0000 (08:01 -0400)] 
Move try_cast() from mssql to base

Generalized the MSSQL :func:`_sql.try_cast` function into the
``sqlalchemy.`` import namespace so that it may be implemented by third
party dialects as well. Within SQLAlchemy, the :func:`_sql.try_cast`
function remains a SQL Server-only construct that will raise
:class:`.CompileError` if used with backends that don't support it.

:func:`_sql.try_cast` implements a CAST where un-castable conversions are
returned as NULL, instead of raising an error. Theoretically, the construct
could be implemented by third party dialects for Google BigQuery, DuckDB,
and Snowflake, and possibly others.

Pull request courtesy Nick Crews.

Fixes: #9752
Closes: #9753
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9753
Pull-request-sha: 2e81b8d2c9314ca2cc5807fc807c35fefbe6ad2c

Change-Id: Ib57999b5947a2e34d5d305e294ff99dc08b01111