]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
3 years agoMerge "apply literal value resolution to String" into main
mike bayer [Mon, 7 Feb 2022 17:50:56 +0000 (17:50 +0000)] 
Merge "apply literal value resolution to String" into main

3 years agoapply literal value resolution to String
Mike Bayer [Mon, 7 Feb 2022 17:08:51 +0000 (12:08 -0500)] 
apply literal value resolution to String

Python string values for which a SQL type is determined from the type of
the value, mainly when using :func:`_sql.literal`, will now apply the
:class:`_types.String` type, rather than the :class:`_types.Unicode`
datatype, for Python string values that test as "ascii only" using Python
``str.isascii()``. If the string is not ``isascii()``, the
:class:`_types.Unicode` datatype will be bound instead, which was used in
all string detection previously. This behavior **only applies to in-place
detection of datatypes when using ``literal()`` or other contexts that have
no existing datatype**, which is not usually the case under normal
:class:`_schema.Column` comparison operations, where the type of the
:class:`_schema.Column` being compared always takes precedence.

Use of the :class:`_types.Unicode` datatype can determine literal string
formatting on backends such as SQL Server, where a literal value (i.e.
using ``literal_binds``) will be rendered as ``N'<value>'`` instead of
``'value'``. For normal bound value handling, the :class:`_types.Unicode`
datatype also may have implications for passing values to the DBAPI, again
in the case of SQL Server, the pyodbc driver supports the use of
:ref:`setinputsizes mode <mssql_pyodbc_setinputsizes>` which will handle
:class:`_types.String` versus :class:`_types.Unicode` differently.

Fixes: #7551
Change-Id: I4f8de63e36532ae8ce4c630ee59211349ce95361

3 years agoMinor spacing fix (#7669)
spollard [Fri, 4 Feb 2022 22:23:20 +0000 (15:23 -0700)] 
Minor spacing fix (#7669)

3 years agoamend verbiage for #7667's changelog message
Mike Bayer [Fri, 4 Feb 2022 20:46:41 +0000 (15:46 -0500)] 
amend verbiage for #7667's changelog message

clarify this applies to async calling styles only.

Change-Id: I42286fe2651be13bd472fac981df9de276ed9bb1

3 years agoMerge "ensure exception raised for all stream w/ sync result" into main
mike bayer [Fri, 4 Feb 2022 20:42:15 +0000 (20:42 +0000)] 
Merge "ensure exception raised for all stream w/ sync result" into main

3 years agoMerge "fall back to SHOW VARIABLES for MySQL < 5.6" into main
mike bayer [Fri, 4 Feb 2022 20:37:41 +0000 (20:37 +0000)] 
Merge "fall back to SHOW VARIABLES for MySQL < 5.6" into main

3 years agoensure exception raised for all stream w/ sync result
Mike Bayer [Fri, 4 Feb 2022 14:04:49 +0000 (09:04 -0500)] 
ensure exception raised for all stream w/ sync result

Fixed issue where the :meth:`_asyncio.AsyncSession.execute` method failed
to raise an informative exception if the ``stream_results`` execution
option were used, which is incompatible with a sync-style
:class:`_result.Result` object. An exception is now raised in this scenario
in the same way one is already raised when using ``stream_results`` in
conjunction with the :meth:`_asyncio.AsyncConnection.execute` method.
Additionally, for improved stability with state-sensitive dialects such as
asyncmy, the cursor is now closed when this error condition is raised;
previously with the asyncmy dialect, the connection would go into an
invalid state with unconsumed server side results remaining.

Fixes: #7667
Change-Id: I6eb7affe08584889b57423a90258295f8b7085dc

3 years agofall back to SHOW VARIABLES for MySQL < 5.6
Mike Bayer [Fri, 4 Feb 2022 02:58:14 +0000 (21:58 -0500)] 
fall back to SHOW VARIABLES for MySQL < 5.6

Fixed regression caused by :ticket:`7518` where changing the syntax "SHOW
VARIABLES" to "SELECT @@" broke compatibility with MySQL versions older
than 5.6, including early 5.0 releases. While these are very old MySQL
versions, a change in compatibility was not planned, so version-specific
logic has been restored to fall back to "SHOW VARIABLES" for MySQL server
versions < 5.6.

includes unrelated orm/test_expire ordering issue , only showing
up on 1.4 / py2.7 but seems to be passing by luck otherwise

Fixes: #7518
Change-Id: Ia554080af742f2c3437f88cf3f7a4827b5e55da8

3 years agoMerge "Fix overlapping slots, base classes without slots" into main
mike bayer [Fri, 4 Feb 2022 17:11:27 +0000 (17:11 +0000)] 
Merge "Fix overlapping slots, base classes without slots" into main

3 years agoRemove duplicate word "other" in sentence (#7655)
Kurt McKee [Wed, 2 Feb 2022 19:46:40 +0000 (13:46 -0600)] 
Remove duplicate word "other" in sentence (#7655)

Spotted this while reading the docs.

Word wrapping makes it less obvious, but the sentence previously read "The phrase after "ON UPDATE" or "ON DELETE" may also ~~other~~ allow other phrases".

3 years agoFix overlapping slots, base classes without slots
Arie Bovenberg [Tue, 1 Feb 2022 20:08:19 +0000 (15:08 -0500)] 
Fix overlapping slots, base classes without slots

Some `__slots__` were not in order.

Fixes #7527

### Description

I'm fixing two types of slots mistakes:
- [x] remove overlapping slots (i.e. slots already defined on a base class)
- [x] fix broken inheritance (i.e. slots class inheriting from a non-slots class)
  - [x] slots added to base class `TransactionalContext`. It seemed to use two attributes, which I've added as slots.
  - [x] empty slots removed from `ORMOption`. Its base class explicitly makes use of `__dict__` so empty slots don't add anything.
  - [x] empty slots added to `PostLoader`. It doesn't appear to use any slots not already defined on its base classes.
  - [x] empty slots added to `IterateMappersMixin`. It doesn't appear to use any slots not already defined on its subclasses.
  - [x] empty slots added to `ImmutableContainer`. It doesn't use any fields.
  - [x] empty slots added to `OperatorType`. It's a protocol.
  - [x] empty slots added to `InternalTraversal`, `_HasTraversalDispatch`. They don't seem to use attributes on their own.

### Checklist

This pull request is:

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

**Have a nice day!**

Closes: #7589
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7589
Pull-request-sha: 70a9c4d46916b7c6907eb1d3ad4f7033ec964191

Change-Id: I6c6e3e69c3c34d0f3bdda7f0684849834fdd1863

3 years agofix typo in word 'establishing' (#7648)
Ben English [Mon, 31 Jan 2022 20:09:57 +0000 (15:09 -0500)] 
fix typo in word 'establishing' (#7648)

3 years agoadd pg14 to supported implementations
Mike Bayer [Mon, 31 Jan 2022 14:50:57 +0000 (09:50 -0500)] 
add pg14 to supported implementations

Fixes: #7647
Change-Id: I071f1a53714ebb0dc838fddc665640d46666318f

3 years agosplit out declarative varieties into the declarative mapping section
Mike Bayer [Sun, 30 Jan 2022 19:25:36 +0000 (14:25 -0500)] 
split out declarative varieties into the declarative mapping section

specific declarative styles like those for dataclasses and attrs
should be in the more reference-oriented "declarative_mapping"
section rather than the more introduction-oriented mapping_styles.

this will also make it easier for us to add still more ways of
mapping declaratively for 2.0.

Change-Id: I2700c2c2b34db9680f9cbe6ed6197add773a6a5d

3 years agoFix up Python logging metadata
Markus Gerstel [Wed, 26 Jan 2022 09:56:40 +0000 (04:56 -0500)] 
Fix up Python logging metadata

Adjusted the logging for key SQLAlchemy components including
:class:`_engine.Engine`, :class:`_engine.Connection` to establish an
appropriate stack level parameter, so that the Python logging tokens
``funcName`` and ``lineno`` when used in custom logging formatters will
report the correct information, which can be useful when filtering log
output; supported on Python 3.8 and above. Pull request courtesy Markus
Gerstel.

Fixes: #7612
Closes: #7615
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7615
Pull-request-sha: cf9567beb06680df320cb12dde1f15baa68e1eb5

Change-Id: Iff23c92ef3453ac93cbd0d190e7efbf8ea4457a2

3 years agoMerge "Add compiler support for PostgreSQL "NOT VALID" constraints." into main
mike bayer [Thu, 27 Jan 2022 14:19:02 +0000 (14:19 +0000)] 
Merge "Add compiler support for PostgreSQL "NOT VALID" constraints." into main

3 years agoAdd compiler support for PostgreSQL "NOT VALID" constraints.
Gilbert Gilb's [Sun, 23 Jan 2022 18:00:35 +0000 (13:00 -0500)] 
Add compiler support for PostgreSQL "NOT VALID" constraints.

Added compiler support for the PostgreSQL ``NOT VALID`` phrase when rendering
DDL for the :class:`.CheckConstraint`, :class:`.ForeignKeyConstraint`
and :class:`.ForeignKey` schema constructs.  Pull request courtesy
Gilbert Gilb's.

Fixes: #7600
Closes: #7601
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7601
Pull-request-sha: 78eecd55fd9fad07030d963f5fd6713c4af60e80

Change-Id: I84bfe84596856eeea2bcca45c04ad23d980a75ec

3 years agofix typing syntax in python < 3.9
Federico Caselli [Wed, 26 Jan 2022 18:44:14 +0000 (19:44 +0100)] 
fix typing syntax in python < 3.9

Change-Id: If4bca7299a333ff585de6e486ba84276cc75ab6d

3 years agoadd warning that the library is not released yet
Mike Bayer [Wed, 26 Jan 2022 13:15:16 +0000 (08:15 -0500)] 
add warning that the library is not released yet

Change-Id: I4f099f5ee5ea1e131c39d637263ebcdff70a484d
References: #7623
References: #7619

3 years agoMerge "restore set-as-superclass for OrderedSet" into main
mike bayer [Tue, 25 Jan 2022 17:51:57 +0000 (17:51 +0000)] 
Merge "restore set-as-superclass for OrderedSet" into main

3 years agorestore set-as-superclass for OrderedSet
Mike Bayer [Mon, 24 Jan 2022 23:13:05 +0000 (18:13 -0500)] 
restore set-as-superclass for OrderedSet

OrderedSet again subclasses set, spent some time
with the stubs at
https://github.com/python/typeshed/blob/master/stdlib/builtins.pyi#L887
to more deeply understand what they are doing here
so that we can type check fully.

Change-Id: Iec9b5ab43befd30e1f2c5cc40e59ab852dd28e75

3 years agojoin to existing mark expr with "and"
Mike Bayer [Tue, 25 Jan 2022 16:01:25 +0000 (11:01 -0500)] 
join to existing mark expr with "and"

ca48f461b2dcac2970829e4e0 considered an existing mark expression
plus legacy tags to be an error condition; however these can
be joined by "and" and will in our use case do the right thing.
The github action scripts make use of legacy tags.   We can change
that also but I want to just make sure this combination works
fully as well.

Change-Id: Ifc506de3dd961c01d68d594ec2f5b2c9a0bbad31

3 years agoMerge "replace test tags with pytest.mark" into main
mike bayer [Tue, 25 Jan 2022 14:59:43 +0000 (14:59 +0000)] 
Merge "replace test tags with pytest.mark" into main

3 years agoreplace test tags with pytest.mark
Mike Bayer [Tue, 25 Jan 2022 05:45:30 +0000 (00:45 -0500)] 
replace test tags with pytest.mark

replaced the __tags__ class attribute and the
--exclude-tags / --include-tags test runner options
with regular pytest.mark names
so that we can take advantage of mark expressions.
options --nomemory, --notimingintensive, --backend-only,
--exclude-tags, --include-tags remain as legacy but
make use of pytest mark for implemementation.

Added a "mypy" mark for the section of tests that are doing mypy
integration tests.

The __backend__ and __sparse_backend__ class attributes also
use pytest marks for their implementation, which also allows
the marks "backend" and "sparse_backend" to be used explicitly.

Also removed the no longer used "--cdecimal" option as this was
python 2 specific.

in theory, the usage of pytest marks could expand such that
the whole exclusions system would be based on it, but this
does not seem to have any advantage at the moment.

Change-Id: Ideeb57d9d49f0efc7fc0b6b923b31207ab783025

3 years agoreplace "e.g.::" with more context regarding attribute events example
Mike Bayer [Tue, 25 Jan 2022 14:14:32 +0000 (09:14 -0500)] 
replace "e.g.::" with more context regarding attribute events example

Fixes: #7613
Change-Id: I28a9577587399c41afd53fbd026003667654c3fc

3 years agomypy: sqlalchemy.util
Mike Bayer [Sun, 9 Jan 2022 16:49:02 +0000 (11:49 -0500)] 
mypy: sqlalchemy.util

Starting to set up practices and conventions to
get the library typed.

Key goals for typing are:

1. whole library can pass mypy without any strict
   turned on.
2. we can incrementally turn on some strict flags on a per-package/
   module basis, as here we turn on more strictness for sqlalchemy.util, exc,
   and log
3. mypy ORM plugin tests work fully without sqlalchemy2-stubs
   installed
4. public facing methods all have return types, major parameter
   signatures filled in also
5. Foundational elements like util etc. are typed enough so that
   we can use them in fully typed internals higher up the stack.

Conventions set up here:

1. we can use lots of config in setup.cfg to limit where mypy
   is throwing errors and how detailed it should be in different
   packages / modules.  We can use this to push up gerrits
   that will pass tests fully without everything being typed.
2. a new tox target pep484 is added.  this links to a new jenkins
   pep484 job that works across all projects (alembic, dogpile, etc.)

We've worked around some mypy bugs that will likely
be around for awhile, and also set up some core practices
for how to deal with certain things such as public_factory
modules (mypy won't accept a module from a callable at all,
so need to use simple type checking conditionals).

References: #6810
Change-Id: I80be58029896a29fd9f491aa3215422a8b705e12

3 years agoafter all that, use pytest warnings plugin
Mike Bayer [Sun, 23 Jan 2022 15:51:55 +0000 (10:51 -0500)] 
after all that, use pytest warnings plugin

The warnings plugin lets us set the filters up
in the config, and as our filter requirements are now
simple we can just set this up.

additionally pytest now recommends pyproject.toml, since
we fully include this now, let's move it there.

the pytest logging plugin seems to not be any problem either
at the moment, so re-enable that.  if it becomes apparent
whatever the problem was (which was probably that it was just
surprising, or something) we can disable it again and comment
what the reason was.

Change-Id: Ia9715533b01f72aa5fdcf6a27ce75b76f829fa43

3 years agoMerge "dont test squelched warnings against the filter" into main
mike bayer [Sun, 23 Jan 2022 15:06:41 +0000 (15:06 +0000)] 
Merge "dont test squelched warnings against the filter" into main

3 years agofix bullet indentation, clarify insert independent of DDL
Mike Bayer [Sun, 23 Jan 2022 14:41:52 +0000 (09:41 -0500)] 
fix bullet indentation, clarify insert independent of DDL

Change-Id: I3b6f2b7e23044148e837afdbe4fef66773e42777

3 years agodont test squelched warnings against the filter
Mike Bayer [Sun, 23 Jan 2022 14:28:22 +0000 (09:28 -0500)] 
dont test squelched warnings against the filter

I spent days on Ibcf09af25228d39ee5a943fda82d8a9302433726
reading it over and over again and noticed this slight inaccuracy
10 seconds after I merged it.

the assert_warns_message() and assert_warns() functions should
not consider a mismatched warning class as valid for a match.

Change-Id: Ib8944dd95bcec1a7e4963917a5f4829e2ba27732

3 years agoMerge "dont use exception catches for warnings; modernize xdist detection" into main
mike bayer [Sun, 23 Jan 2022 14:22:13 +0000 (14:22 +0000)] 
Merge "dont use exception catches for warnings; modernize xdist detection" into main

3 years agomake the autoincrement doc a lot more clear
Mike Bayer [Sun, 23 Jan 2022 14:14:00 +0000 (09:14 -0500)] 
make the autoincrement doc a lot more clear

I saw it saying "this parameter has no effect when
Identity is in use", which is not accurate, so I've expanded
this way out with bullets to make the current situation
as clear as possible.

Change-Id: I77001cc81cd90a6b867686e2975aed682e539347

3 years agodont use exception catches for warnings; modernize xdist detection
Mike Bayer [Fri, 21 Jan 2022 23:46:37 +0000 (18:46 -0500)] 
dont use exception catches for warnings; modernize xdist detection

Improvements to the test suite's integration with pytest such that the
"warnings" plugin, if manually enabled, will not interfere with the test
suite, such that third parties can enable the warnings plugin or make use
of the ``-W`` parameter and SQLAlchemy's test suite will continue to pass.
Additionally, modernized the detection of the "pytest-xdist" plugin so that
plugins can be globally disabled using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
without breaking the test suite if xdist were still installed. Warning
filters that promote deprecation warnings to errors are now localized to
SQLAlchemy-specific warnings, or within SQLAlchemy-specific sources for
general Python deprecation warnings, so that non-SQLAlchemy deprecation
warnings emitted from pytest plugins should also not impact the test suite.

Fixes: #7599
Change-Id: Ibcf09af25228d39ee5a943fda82d8a9302433726

3 years agoMerge "Skip PK returned as None for RETURNING, server side default" into main
mike bayer [Sat, 22 Jan 2022 14:32:52 +0000 (14:32 +0000)] 
Merge "Skip PK returned as None for RETURNING, server side default" into main

3 years agoSkip PK returned as None for RETURNING, server side default
Mike Bayer [Fri, 21 Jan 2022 15:19:02 +0000 (10:19 -0500)] 
Skip PK returned as None for RETURNING, server side default

Fixed regression where the ORM exception that is to be raised when an
INSERT silently fails to actually insert a row (such as from a trigger)
would not be reached, due to a runtime exception raised ahead of time due
to the missing primary key value, thus raising an uninformative exception
rather than the correct one. For 1.4 and above, a new ``FlushError`` is
added for this case that's raised earlier than the previous "null identity"
exception was for 1.3, as a situation where the number of rows actually
INSERTed does not match what was expected is a more critical situation in
1.4 as it prevents batching of multiple objects from working correctly.
This is separate from the case where a newly fetched primary key is
fetched as NULL, which continues to raise the existing "null identity"
exception.

Fixes: #7594
Change-Id: Ie8e181e3472f09f389cca757c5e58e61b15c7d79

3 years agoMerge "Remove dispose warning on async engines when running tests" into main
mike bayer [Sat, 22 Jan 2022 02:05:20 +0000 (02:05 +0000)] 
Merge "Remove dispose warning on async engines when running tests" into main

3 years agoRemove dispose warning on async engines when running tests
Federico Caselli [Wed, 19 Jan 2022 22:41:36 +0000 (23:41 +0100)] 
Remove dispose warning on async engines when running tests

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

3 years agoAdd new infrastructure to support greater use of __slots__
Mike Bayer [Tue, 18 Jan 2022 22:00:16 +0000 (17:00 -0500)] 
Add new infrastructure to support greater use of __slots__

* Changed AliasedInsp to use __slots__
* Migrated all of strategy_options to use __slots__ for objects.
  Adds new infrastructure to traversals to support shallow
  copy, to dict and from dict based on internal traversal
  attributes.  Load / _LoadElement then leverage this to
  provide clone / generative / getstate without the need
  for __dict__ or explicit attribute lists.

Doing this change revealed that there are lots of things that
trigger off of whether or not a class has a __visit_name__ attribute.
so to suit that we've gone back to having Visitable, which is
a better name than Traversible at this point  (I think
Traversible is mis-spelled too).

Change-Id: I13d04e494339fac9dbda0b8e78153418abebaf72
References: #7527

3 years agotypo
Mike Bayer [Fri, 21 Jan 2022 01:30:24 +0000 (20:30 -0500)] 
typo

Change-Id: Id3f1a99813be14dbfa721e6b0a6081eca4a90c05

3 years agoMerge "Added support for ``FILESTREAM`` in MSSQL." into main
mike bayer [Fri, 21 Jan 2022 01:26:14 +0000 (01:26 +0000)] 
Merge "Added support for ``FILESTREAM`` in MSSQL." into main

3 years agoMerge "re-enable tests for asyncmy; fix Binary" into main
mike bayer [Fri, 21 Jan 2022 01:26:02 +0000 (01:26 +0000)] 
Merge "re-enable tests for asyncmy; fix Binary" into main

3 years agoMerge "The parameter `as_uuid` of `UUID` now defaults to `True`." into main
mike bayer [Thu, 20 Jan 2022 23:06:00 +0000 (23:06 +0000)] 
Merge "The parameter `as_uuid` of `UUID` now defaults to `True`." into main

3 years agoMerge "repair broken truediv test suite; memusage" into main
mike bayer [Thu, 20 Jan 2022 23:04:24 +0000 (23:04 +0000)] 
Merge "repair broken truediv test suite; memusage" into main

3 years agore-enable tests for asyncmy; fix Binary
Mike Bayer [Thu, 20 Jan 2022 20:21:17 +0000 (15:21 -0500)] 
re-enable tests for asyncmy; fix Binary

Fixed regression in asyncmy dialect caused by :ticket:`7567` where removal
of the PyMySQL dependency broke binary columns, due to the asyncmy dialect
not being properly included within CI tests.

Also repairs mariadbconnector isolation level for 2.0.

basically tox config was failing to include additional
drivers.

Fixes: #7593
Change-Id: Iefc1061c24c75fcb9ca1a02d0b5e5f43970ade17

3 years agoAdded support for ``FILESTREAM`` in MSSQL.
Federico Caselli [Wed, 19 Jan 2022 22:31:13 +0000 (23:31 +0100)] 
Added support for ``FILESTREAM`` in MSSQL.

Fixes: #7243
Change-Id: I99880f429dbaac525bdf7d44438aaab6bc8d0ca6

3 years agoMerge "repair mapper sort" into main
mike bayer [Thu, 20 Jan 2022 22:44:00 +0000 (22:44 +0000)] 
Merge "repair mapper sort" into main

3 years agorestore empty list logic to ARRAY of ENUM parsing
Mike Bayer [Thu, 20 Jan 2022 20:01:47 +0000 (15:01 -0500)] 
restore empty list logic to ARRAY of ENUM parsing

Fixed regression where the change in :ticket:`7148` to repair ENUM handling
in PostgreSQL broke the use case of an empty ARRAY of ENUM, preventing rows
that contained an empty array from being handled correctly when fetching
results.

Fixes: #7590
Change-Id: I43a35ef25281a6e0a26b698efebef6ba12a63e8c

3 years agorepair mapper sort
Mike Bayer [Thu, 20 Jan 2022 14:31:42 +0000 (09:31 -0500)] 
repair mapper sort

Fixed issue in :meth:`_orm.Session.bulk_save_mappings` where the sorting
that takes place when the ``preserve_order`` parameter is set to False
would sort partially on ``Mapper`` objects, which is rejected in Python
3.11.

Also uses typing_extensions for NotRequired as this symbol
does not seem to be in Python 3.11.0a4 yet.

For interim 3.11 support, adds the git main build of greenlet
for Python 3.11

Fixes: #7591
Change-Id: I24a62f2322ad7dac5d8e4a00853f8a9408877c9c

3 years agorepair broken truediv test suite; memusage
Mike Bayer [Thu, 20 Jan 2022 17:26:36 +0000 (12:26 -0500)] 
repair broken truediv test suite; memusage

the truediv test suite didn't have __backend__ so wasn't running
for every DB except in the main build.  Repaired this as well
as truediv support to preserve the right-hand side type
when casting to numeric, if the right type is already a
numeric type.

also fixed a memusage test that relies on savepoints so was
not running under gerrit runs.

Change-Id: I3be223fdf697af9c1ed61b70d621f57cbbb7a92b

3 years agoMerge "Added missing method ``invalidate` in the `AsyncSession`" into main
mike bayer [Thu, 20 Jan 2022 14:45:39 +0000 (14:45 +0000)] 
Merge "Added missing method ``invalidate` in the `AsyncSession`" into main

3 years agocherry-pick changelog update for 1.4.31
Mike Bayer [Wed, 19 Jan 2022 23:18:13 +0000 (18:18 -0500)] 
cherry-pick changelog update for 1.4.31

3 years agocherry-pick changelog from 1.4.30
Mike Bayer [Wed, 19 Jan 2022 23:18:12 +0000 (18:18 -0500)] 
cherry-pick changelog from 1.4.30

3 years agoAdded missing method ``invalidate` in the `AsyncSession`
Federico Caselli [Wed, 19 Jan 2022 21:10:09 +0000 (22:10 +0100)] 
Added missing method ``invalidate` in the `AsyncSession`

Fixes: #7524
Change-Id: I20387e6700015c44f23bd2d05347bdce802196c0

3 years agoMerge "Add AdaptedConnection.run_async" into main
mike bayer [Wed, 19 Jan 2022 21:58:46 +0000 (21:58 +0000)] 
Merge "Add AdaptedConnection.run_async" into main

3 years agoThe parameter `as_uuid` of `UUID` now defaults to `True`.
Federico Caselli [Wed, 19 Jan 2022 21:29:03 +0000 (22:29 +0100)] 
The parameter `as_uuid` of `UUID` now defaults to `True`.

Fixes: #7225
Change-Id: Iddb78bf47ac733300bd12db50e16199cc22e9476

3 years agoAdd AdaptedConnection.run_async
Mike Bayer [Wed, 19 Jan 2022 19:31:52 +0000 (14:31 -0500)] 
Add AdaptedConnection.run_async

Added new method :meth:`.AdaptedConnection.run_async` to the DBAPI
connection interface used by asyncio drivers, which allows methods to be
called against the underlying "driver" connection directly within a
sync-style function where the ``await`` keyword can't be used, such as
within SQLAlchemy event handler functions. The method is analogous to the
:meth:`_asyncio.AsyncConnection.run_sync` method which translates
async-style calls to sync-style. The method is useful for things like
connection-pool on-connect handlers that need to invoke awaitable methods
on the driver connection when it's first created.

Fixes: #7580
Change-Id: I03c98a72bda0234deb19c00095b31a36f19bf36d

3 years agotypo
Mike Bayer [Wed, 19 Jan 2022 19:48:51 +0000 (14:48 -0500)] 
typo

Change-Id: I65cdd4cefdfacb1506c8e32a11c44ff650cd15b6

3 years agoMerge "reject methods as lambda SQL callables" into main
mike bayer [Wed, 19 Jan 2022 02:41:07 +0000 (02:41 +0000)] 
Merge "reject methods as lambda SQL callables" into main

3 years agoMerge "enhance double-aliased table logic to handle more cases" into main
mike bayer [Wed, 19 Jan 2022 02:39:05 +0000 (02:39 +0000)] 
Merge "enhance double-aliased table logic to handle more cases" into main

3 years agoreject methods as lambda SQL callables
Mike Bayer [Tue, 18 Jan 2022 22:19:24 +0000 (17:19 -0500)] 
reject methods as lambda SQL callables

Added an informative error message when a method object is passed to a SQL
construct. Previously, when such a callable were passed, as is a common
typographical error when dealing with method-chained SQL constructs, they
were interpreted as "lambda SQL" targets to be invoked at compilation time,
which would lead to silent failures. As this feature was not intended to be
used with methods, method objects are now rejected.

Fixes: #7032
Change-Id: If714715bd8c11557ab769ee3b1a24264b0b06acc

3 years agoenhance double-aliased table logic to handle more cases
Mike Bayer [Sun, 16 Jan 2022 15:21:45 +0000 (10:21 -0500)] 
enhance double-aliased table logic to handle more cases

Fixed ORM regression where calling the :func:`_orm.aliased` function
against an existing :func:`_orm.aliased` construct would fail to produce
correct SQL if the existing construct were against a fixed table. The fix
allows that the original :func:`_orm.aliased` construct is disregarded if
it were only against a table that's now being replaced. It also allows for
correct behavior when constructing a :func:`_orm.aliased` without a
selectable argument against a :func:`_orm.aliased` that's against a
subuquery, to create an alias of that subquery (i.e. to change its name).

The nesting behavior of :func:`_orm.aliased` remains in place for the case
where the outer :func:`_orm.aliased` object is against a subquery which in
turn refers to the inner :func:`_orm.aliased` object. This is a relatively
new 1.4 feature that helps to suit use cases that were previously served by
the deprecated ``Query.from_self()`` method.

Fixes: #7576
Change-Id: Ia9ca606f6300e38b6040eb6fc7facfe97c8cf057

3 years agodetect map_imperatively() called twice
Mike Bayer [Tue, 18 Jan 2022 16:02:57 +0000 (11:02 -0500)] 
detect map_imperatively() called twice

Fixed issue where calling upon :meth:`_orm.regsitry.map_imperatively` more
than once for the same class would produce an unexpected error, rather than
an informative error that the target class is already mapped. This behavior
differed from that of the :func:`_orm.mapper` function which does report an
informative message already.

For 2.0, this change also cleans up the logic that detects against
`Mapper()` or `_mapper()` being invoked directly.  1.4's backport will
take on a different format as `mapper()` is still public API in that
release.

Fixes: #7579
Change-Id: Ie74a1a2e97f8b6a81ac1942040edd8cae82f4bd8

3 years agoupdate zimports to 0.4.2
Mike Bayer [Sat, 15 Jan 2022 16:38:32 +0000 (11:38 -0500)] 
update zimports to 0.4.2

Will handle imports with "# type: ignore" comments
as well as specific noqa codes.  also works in python 3.10

Change-Id: I8937aeb109c29e003dd32a4251dbd786534681bf

3 years agoMerge "fix(mypy): Placeholder vars should have fullname set." into main
mike bayer [Sat, 15 Jan 2022 14:08:38 +0000 (14:08 +0000)] 
Merge "fix(mypy): Placeholder vars should have fullname set." into main

3 years agoMerge "Fixes(#7561) Add support for postgres.UUID literal_binds compilation" into...
mike bayer [Sat, 15 Jan 2022 14:07:56 +0000 (14:07 +0000)] 
Merge "Fixes(#7561) Add support for postgres.UUID literal_binds compilation" into main

3 years agofix(mypy): Placeholder vars should have fullname set.
Jaen Saul [Fri, 19 Nov 2021 20:12:44 +0000 (22:12 +0200)] 
fix(mypy): Placeholder vars should have fullname set.

Otherwise the dmypy daemon will crash on an incremental re-run.

Fixes: #7347
Closes: #7348
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7348
Pull-request-sha: 79eefa3417e09a8f9defaeafdb9f76d323385238

Change-Id: Id2133e837ee5dcf43461af51458e296353bdad6c

3 years agoMerge "remove dbapi_proxy module" into main
mike bayer [Sat, 15 Jan 2022 00:13:34 +0000 (00:13 +0000)] 
Merge "remove dbapi_proxy module" into main

3 years agoMerge "track item schema names to identify name collisions w/ default schema" into...
mike bayer [Fri, 14 Jan 2022 23:00:59 +0000 (23:00 +0000)] 
Merge "track item schema names to identify name collisions w/ default schema" into main

3 years agoMerge "Initial ORM typing layout" into main
mike bayer [Fri, 14 Jan 2022 22:54:54 +0000 (22:54 +0000)] 
Merge "Initial ORM typing layout" into main

3 years agoremove dbapi_proxy module
Mike Bayer [Fri, 14 Jan 2022 22:42:44 +0000 (17:42 -0500)] 
remove dbapi_proxy module

This module was not documented nor part of any test suite,
and it's unlikely it was working correctly.   It's not likely
that this module was ever used after the first year or so
of SQLAlchemy, and it's stayed around because it is so
obscure that I never remembered to remove it.

Change-Id: I0ed9030438982e935add87c51abbfff50e7382be
References: #7257

3 years agoMerge "initial reorganize for static typing" into main
mike bayer [Fri, 14 Jan 2022 22:00:11 +0000 (22:00 +0000)] 
Merge "initial reorganize for static typing" into main

3 years agotrack item schema names to identify name collisions w/ default schema
Mike Bayer [Fri, 17 Dec 2021 23:04:47 +0000 (18:04 -0500)] 
track item schema names to identify name collisions w/ default schema

Added an additional lookup step to the compiler which will track all FROM
clauses which are tables, that may have the same name shared in multiple
schemas where one of the schemas is the implicit "default" schema; in this
case, the table name when referring to that name without a schema
qualification will be rendered with an anonymous alias name at the compiler
level in order to disambiguate the two (or more) names. The approach of
schema-qualifying the normally unqualified name with the server-detected
"default schema name" value was also considered, however this approach
doesn't apply to Oracle nor is it accepted by SQL Server, nor would it work
with multiple entries in the PostgreSQL search path. The name collision
issue resolved here has been identified as affecting at least Oracle,
PostgreSQL, SQL Server, MySQL and MariaDB.

Fixes: #7471
Change-Id: Id65e7ca8c43fe8d95777084e8d5ec140ebcd784d

3 years agoFixes(#7561) Add support for postgres.UUID literal_binds compilation
José Duarte [Thu, 13 Jan 2022 22:20:06 +0000 (17:20 -0500)] 
Fixes(#7561) Add support for postgres.UUID literal_binds compilation

Added string rendering to the :class:`.postgresql.UUID` datatype, so that
stringifying a statement with "literal_binds" that uses this type will
render an appropriate string value for the PostgreSQL backend. Pull request
courtesy José Duarte.

Fixes: #7561
Closes: #7563
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7563
Pull-request-sha: cf6fe73265342d7884a940c4b3a34c9552113ec3

Change-Id: I4b162bdcdce2293a90683e36da54e4a891a3c684

3 years agoInitial ORM typing layout
Mike Bayer [Sun, 9 Jan 2022 16:49:02 +0000 (11:49 -0500)] 
Initial ORM typing layout

introduces:

1. new mapped_column() helper
2. DeclarativeBase helper
3. declared_attr has been re-typed
4. rework of Mapped[] to return InstrumentedAtribute for
   class get, so works without Mapped itself having expression
   methods
5. ORM constructs now generic on [_T]

also includes some early typing work, most of which will
be in later commits:

1. URL and History become typing.NamedTuple
2. come up with type-checking friendly way of type
   checking cy extensions, where type checking will be applied
   to the py versions, just needed to come up with a succinct
   conditional pattern for the imports

References: #6810
References: #7535
References: #7562
Change-Id: Ie5d9a44631626c021d130ca4ce395aba623c71fb

3 years agoRemove pymysql in asyncmy
long2ice [Fri, 14 Jan 2022 08:50:26 +0000 (03:50 -0500)] 
Remove pymysql in asyncmy

Removed unnecessary dependency on PyMySQL from the asyncmy dialect. Pull
request courtesy long2ice.

Fixes: #7567
Closes: #7568
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7568
Pull-request-sha: 48cbb3e3c249e431dfd91e88fcb3284af83671e5

Change-Id: Iad5048eaa5de6ad6666b2120df6608fd1bf50e02

3 years agoinitial reorganize for static typing
Mike Bayer [Sun, 2 Jan 2022 22:35:43 +0000 (17:35 -0500)] 
initial reorganize for static typing

start applying foundational annotations to key
elements.

two main elements addressed here:

1. removal of public_factory() and replacement with
   explicit functions.  this just works much better with
   typing.

2. typing support for column expressions and operators.
   The biggest part of this involves stubbing out all the
   ColumnOperators methods under ColumnElement in a
   TYPE_CHECKING section.  Took me a while to see this
   method vs. much more complicated things I thought
   I needed.

Also for this version implementing #7519, ColumnElement
types against the Python type and not TypeEngine.  it is
hoped this leads to easier transferrence between ORM/Core
as well as eventual support for result set typing.
Not clear yet how well this approach will work and what
new issues it may introduce.

given the current approach we now get full, rich typing for
scenarios like this:

from sqlalchemy import column, Integer, String, Boolean

c1 = column('a', String)

c2 = column('a', Integer)

expr1 = c2.in_([1, 2, 3])

expr2 = c2 / 5

expr3 = -c2

expr4_a = ~(c2 == 5)

expr4_b = ~column('q', Boolean)

expr5 = c1 + 'x'

expr6 = c2 + 10

Fixes: #7519
Fixes: #6810
Change-Id: I078d9f57955549f6f7868314287175f6c61c44cb

3 years agoMerge "remove internal use of metaclasses" into main
mike bayer [Tue, 11 Jan 2022 19:02:22 +0000 (19:02 +0000)] 
Merge "remove internal use of metaclasses" into main

3 years agoMerge "implement second-level type resolution for literals" into main
mike bayer [Tue, 11 Jan 2022 18:11:13 +0000 (18:11 +0000)] 
Merge "implement second-level type resolution for literals" into main

3 years agoMerge "change state.load_options to a tuple" into main
mike bayer [Tue, 11 Jan 2022 18:08:00 +0000 (18:08 +0000)] 
Merge "change state.load_options to a tuple" into main

3 years agoremove internal use of metaclasses
Mike Bayer [Mon, 10 Jan 2022 21:48:05 +0000 (16:48 -0500)] 
remove internal use of metaclasses

All but one metaclass used internally can now
be replaced using __init_subclass__().  Within this
patch we remove:

* events._EventMeta
* sql.visitors.TraversibleType
* sql.visitors.InternalTraversibleType
* testing.fixtures.FindFixture
* testing.fixtures.FindFixtureDeclarative
* langhelpers.EnsureKWArgType
* sql.functions._GenericMeta
* sql.type_api.VisitableCheckKWArg (was a mixture of TraversibleType
  and EnsureKWArgType)

The remaining internal class is MetaOptions used by the
sql.Options object which is in turn currently mostly for
ORM internal use, as this type implements class level overrides
for the ``+`` operator.

For declarative, removing DeclarativeMeta in place of
an `__init_subclass__()` class would not be fully feasible as
it would break backwards compatibility with applications that
refer to this class explicitly, but also DeclarativeMeta intercepts
class-level attribute set and delete operations which is a widely
used pattern.   An option for declarative base to use
`__init_subclass__()` should be provided but this is out of
scope for this particular change.

Change-Id: I8aa898c7ab59d887739037d34b1cbab36521ab78
References: #6810

3 years agoremove non-working mssql description_encoding param
Mike Bayer [Tue, 11 Jan 2022 14:46:19 +0000 (09:46 -0500)] 
remove non-working mssql description_encoding param

the description_encoding concept has been fully
removed in 2.0, but this logic was plainly broken
in any case.   The same non-working logic exists in
1.4 as well, where description_encoding as a concept
is not removed, though it is likely that there are no
real-world use cases for it.

Change-Id: Icaf47f4740e3f57063b614a1d4136e0d89f40621

3 years agochange state.load_options to a tuple
Mike Bayer [Tue, 11 Jan 2022 03:11:50 +0000 (22:11 -0500)] 
change state.load_options to a tuple

having this be an immutable sequence is safer
and possibly lower overhead.

The change here went in with no issues save
for tests that asserted it was a set.
InstanceState.load_options is only referred
towards when the object is first loaded, and then
within the logic that emits an object refresh
as well as within a lazy loader.   it's only
accessed as a whole collection.

Fixes: #7558
Change-Id: Id1adbec0f93bcfbfc934ec9cd39e71e74727845d

3 years agoimplement second-level type resolution for literals
Mike Bayer [Wed, 5 Jan 2022 17:20:46 +0000 (12:20 -0500)] 
implement second-level type resolution for literals

Added additional rule to the system that determines ``TypeEngine``
implementations from Python literals to apply a second level of adjustment
to the type, so that a Python datetime with or without tzinfo can set the
``timezone=True`` parameter on the returned :class:`.DateTime` object, as
well as :class:`.Time`. This helps with some round-trip scenarios on
type-sensitive PostgreSQL dialects such as asyncpg, psycopg3 (2.0 only).

For 1.4 specifically, the backport improves support for asyncpg handling of
TIME WITH TIMEZONE, which was not fully implemented. 2.0's reworked
PostgreSQL architecture had this handled already.

Fixes: #7537
Change-Id: Icdb07db85af5f7f39f1c1ef855fe27609770094b

3 years agoensure with_options not switched to a list
Mike Bayer [Mon, 10 Jan 2022 19:59:59 +0000 (14:59 -0500)] 
ensure with_options not switched to a list

Fixed regression which appeared in 1.4.23 which could cause loader options
to be mis-handled in some cases, in particular when using joined table
inheritance in combination with the ``polymorphic_load="selectin"`` option
as well as relationship lazy loading, leading to a ``TypeError``.

Fixes: #7557
Change-Id: Id38619692f94308fd5f567a02337efef7a3a7544

3 years agoMerge "Fix various source comment/doc typos" into main
mike bayer [Fri, 7 Jan 2022 16:42:18 +0000 (16:42 +0000)] 
Merge "Fix various source comment/doc typos" into main

3 years agohappy new year 2022
Mike Bayer [Thu, 6 Jan 2022 19:18:36 +0000 (14:18 -0500)] 
happy new year 2022

Change-Id: I49abf2607e0eb0623650efdf0091b1fb3db737ea

3 years agoMerge "Add oracle docker instructions to readme unittest" into main
mike bayer [Thu, 6 Jan 2022 19:15:42 +0000 (19:15 +0000)] 
Merge "Add oracle docker instructions to readme unittest" into main

3 years agoMerge "Remove all remaining removed_in_20 warnings slated for removal" into main
mike bayer [Thu, 6 Jan 2022 19:15:06 +0000 (19:15 +0000)] 
Merge "Remove all remaining removed_in_20 warnings slated for removal" into main

3 years agoMerge "Remove redundant code for EOL Python <= 3.6" into main
Federico Caselli [Thu, 6 Jan 2022 19:06:23 +0000 (19:06 +0000)] 
Merge "Remove redundant code for EOL Python <= 3.6" into main

3 years agofix(dialects.mysql): repeatedly exported DECIMAL
sudoii [Thu, 6 Jan 2022 17:20:31 +0000 (12:20 -0500)] 
fix(dialects.mysql): repeatedly exported DECIMAL

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

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

This is a typo, DECIMAL has been exported repeatedly, so this fix does not need to be tested.

https://github.com/sqlalchemy/sqlalchemy/blob/21ee595ba9ef3e7abc8982fac7bf488c904cf9c9/lib/sqlalchemy/dialects/mysql/__init__.py#L68
https://github.com/sqlalchemy/sqlalchemy/blob/21ee595ba9ef3e7abc8982fac7bf488c904cf9c9/lib/sqlalchemy/dialects/mysql/__init__.py#L71

```
# Intercepted code block
# sqlalchemy/lib/sqlalchemy/dialects/mysql/__init__.py

__all__ = (
    "BIGINT",
    "BINARY",
    "BIT",
    "BLOB",
    "BOOLEAN",
    "CHAR",
    "DATE",
    "DATETIME",
    "DECIMAL",   # Line 68
    "DOUBLE",
    "ENUM",
    "DECIMAL",   # Line 71
```

### 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: #7543
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7543
Pull-request-sha: 889d05c444264bf1b6d11386459d3360cc529d27

Change-Id: I0898af68548b3131388e50d906f216a2c4af4486

3 years agoRemove redundant code for EOL Python <= 3.6
Hugo van Kemenade [Thu, 6 Jan 2022 17:14:33 +0000 (12:14 -0500)] 
Remove redundant code for EOL Python <= 3.6

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

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

There's a few bits and pieces of code to support Python <= 3.6 which are no longer needed and can be removed, to slightly simplify the codebase.

### 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: #7544
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7544
Pull-request-sha: 282b4a91282902a57807aa2541b75b272b547127

Change-Id: I9ddf15fcf72551d52e3f027f337c7fee4aa9083b

3 years agofix incorrect with_parent() example
Mike Bayer [Thu, 6 Jan 2022 14:24:08 +0000 (09:24 -0500)] 
fix incorrect with_parent() example

The lead example for the with_parent() function
docstring was backwards, based on the standard User/Address
mapping used in the documentation.

Fixes: #7540
Change-Id: Iaff7dc6fdd0c323509231ae5f3122ed76a420915

3 years agoAdd oracle docker instructions to readme unittest
Federico Caselli [Thu, 6 Jan 2022 11:32:55 +0000 (12:32 +0100)] 
Add oracle docker instructions to readme unittest

Change-Id: I6538171b0fa73b25aeb2b1acaca4867cde56c537

3 years agoRemove all remaining removed_in_20 warnings slated for removal
Mike Bayer [Mon, 3 Jan 2022 18:49:26 +0000 (13:49 -0500)] 
Remove all remaining removed_in_20 warnings slated for removal

Finalize all remaining removed-in-2.0 changes so that we
can begin doing pep-484 typing without old things
getting in the way (we will also have to do public_factory).

note there are a few "moved_in_20()" and "became_legacy_in_20()"
warnings still in place.  The SQLALCHEMY_WARN_20 variable
is now removed.

Also removed here are the legacy "in place mutators" for Select
statements, and some keyword-only argument signatures in Core
have been added.

Also in the big change department, the ORM mapper() function
is removed entirely; the Mapper class is otherwise unchanged,
just the public-facing API function.  Mappers are now always
given a registry in which to participate, however the
argument signature of Mapper is not changed. ideally "registry"
would be the first positional argument.

Fixes: #7257
Change-Id: Ic70c57b9f1cf7eb996338af5183b11bdeb3e1623

3 years agoMerge "Fix AttributeError typo in setup.py that prevented fallback pure python build...
Federico Caselli [Wed, 5 Jan 2022 21:59:52 +0000 (21:59 +0000)] 
Merge "Fix AttributeError typo in setup.py that prevented fallback pure python build if the compilation fails" into main

3 years agoFix AttributeError typo in setup.py that prevented fallback
Federico Caselli [Wed, 5 Jan 2022 20:31:31 +0000 (21:31 +0100)] 
Fix AttributeError typo in setup.py that prevented fallback
pure python build if the compilation fails

Fixes: #7539
Change-Id: I4bf7905eb7a5337213ce922d005d2fffb8b9079c

3 years agoUpdate Black's target-version to py37
Hugo van Kemenade [Wed, 5 Jan 2022 17:41:32 +0000 (12:41 -0500)] 
Update Black's target-version to py37

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

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

Black's `target-version` was still set to `['py27', 'py36']`. Set it to `[py37]` instead.

Also update Black and other pre-commit hooks and re-format with Black.

### 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
- [ ] 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: #7536
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7536
Pull-request-sha: b3aedf5570d7e0ba6c354e5989835260d0591b08

Change-Id: I8be85636fd2c9449b07a8626050c8bd35bd119d5

3 years agoMerge "implement python_impl to custom_op for basic ORM evaluator extensibility"...
mike bayer [Tue, 4 Jan 2022 22:32:48 +0000 (22:32 +0000)] 
Merge "implement python_impl to custom_op for basic ORM evaluator extensibility" into main

3 years agoimplement python_impl to custom_op for basic ORM evaluator extensibility
Mike Bayer [Tue, 4 Jan 2022 19:04:15 +0000 (14:04 -0500)] 
implement python_impl to custom_op for basic ORM evaluator extensibility

Added new parameter :paramref:`_sql.Operators.op.python_impl`, available
from :meth:`_sql.Operators.op` and also when using the
:class:`_sql.Operators.custom_op` constructor directly, which allows an
in-Python evaluation function to be provided along with the custom SQL
operator. This evaluation function becomes the implementation used when the
operator object is used given plain Python objects as operands on both
sides, and in particular is compatible with the
``synchronize_session='evaluate'`` option used with
:ref:`orm_expression_update_delete`.

Fixes: #3162
Change-Id: If46ba6a0e303e2180a177ba418a8cafe9b42608e

3 years agoupdate stale documentation on Mapper class
Mike Bayer [Tue, 4 Jan 2022 20:38:15 +0000 (15:38 -0500)] 
update stale documentation on Mapper class

don't get into details here that have changed,
point to the main narrative documentation instead.

Change-Id: I5bc0829f6ff282ca104f18deb9ec9857b6e1c8ac