Commit Graph

8193 Commits

Author SHA1 Message Date
Federico Caselli 61443aa62b Implement ScalarValue
Added :class:`_expression.ScalarValues` that can be used as a column
element allowing using :class:`_expression.Values` inside IN clauses
or in conjunction with ``ANY`` or ``ALL`` collection aggregates.
This new class is generated using the method
:meth:`_expression.Values.scalar_values`.
The :class:`_expression.Values` instance is now coerced to a
:class:`_expression.ScalarValues` when used in a ``IN`` or ``NOT IN``
operation.

Fixes: #6289
Change-Id: Iac22487ccb01553684b908e54d01c0687fa739f1
2022-11-26 18:49:06 -05:00
Mike Bayer 5cc3825da3 add new variation helper
I'm using a lot of @testing.combinations with either
a boolean True/False, or a series of string names, each indicating
some case to switch on.  I want a descriptive name in the test
run (not True/False) and I don't want to compare strings.

So make a new helper around @combinations that provides an
object interface that has booleans inside of it, prints nicely
in the test output, raises an error if you name the case
incorrectly.

Before:

test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-False-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-False-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-False-name] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-True-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-True-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-True-name] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-False-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-False-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-False-name] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-True-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-True-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-True-name] PASSED

After:

test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-deferred-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-deferred-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-deferred-name] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-not_deferred-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-not_deferred-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-not_deferred-name] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-deferred-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-deferred-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-deferred-name] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-not_deferred-both] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-not_deferred-key] PASSED
test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-not_deferred-name] PASSED

Change-Id: Idde87632581ee69e0f47360966758583dfd8baab
2022-11-26 17:24:04 -05:00
Federico Caselli 25c2b7dd10 Add new script to sync test files adding future annotation
Create a new test file test_tm_future_annotations_sync.py that's obtained
from test_tm_future_annotations.py by using the new script sync_test_files.
This files includes the ``from __future__ import annotations``

It also turns out we had some bugs in there and we can also support some
additional typing things

Change-Id: Iac005df206d45a55345d9d88d67a80ce799d449f
2022-11-26 19:25:37 +01:00
Mike Bayer 34e29f7b22 sort for addresess relationship in new merge test
saw a random failure under py2 on 1.4, will backport

Change-Id: I3e2b037bf4211be44e28f85f5e51ffdc218eeb5a
2022-11-26 10:14:02 -05:00
Mike Bayer df3bd8d297 add "merge" to viewonly cascades; propagate NO_RAISE when merging
Fixed bug where :meth:`_orm.Session.merge` would fail to preserve the
current loaded contents of relationship attributes that were indicated with
the :paramref:`_orm.relationship.viewonly` parameter, thus defeating
strategies that use :meth:`_orm.Session.merge` to pull fully loaded objects
from caches and other similar techniques. In a related change, fixed issue
where an object that contains a loaded relationship that was nonetheless
configured as ``lazy='raise'`` on the mapping would fail when passed to
:meth:`_orm.Session.merge`; checks for "raise" are now suspended within
the merge process assuming the :paramref:`_orm.Session.merge.load`
parameter remains at its default of ``True``.

Overall, this is a behavioral adjustment to a change introduced in the 1.4
series as of 🎫`4994`, which took "merge" out of the set of cascades
applied by default to "viewonly" relationships. As "viewonly" relationships
aren't persisted under any circumstances, allowing their contents to
transfer during "merge" does not impact the persistence behavior of the
target object. This allows :meth:`_orm.Session.merge` to correctly suit one
of its use cases, that of adding objects to a :class:`.Session` that were
loaded elsewhere, often for the purposes of restoring from a cache.

Fixes: #8862
Change-Id: I8731c7810460e6a71f8bf5e8ded59142b9b02956
2022-11-24 11:50:48 -05:00
mike bayer 3b6a5fb05c Merge "ensure implicit_returning is checked on a Table instance" into main 2022-11-22 23:30:36 +00:00
Mike Bayer ab84559ca0 ensure implicit_returning is checked on a Table instance
Fixed regression where flushing a mapped class that's mapped against a
subquery, such as a direct mapping or some forms of concrete table
inheritance, would fail if the :paramref:`_orm.Mapper.eager_defaults`
parameter were used.

mapper.local_table can still be a non-table instance.
correct the check first added in 466ed5b53a.

Fixes: #8812
Change-Id: I1bb2b83c31b910fbd96fcd3ac43e789b657aebf7
2022-11-22 14:06:09 -05:00
mike bayer cbc42334b1 Merge "fix optionalized forms for dict[]" into main 2022-11-22 16:07:49 +00:00
Mike Bayer 509ffeedef fix optionalized forms for dict[]
Fixed a suite of issues involving :class:`.Mapped` use with dictionary
types, such as ``Mapped[dict[str, str] | None]``, would not be correctly
interpreted in Declarative ORM mappings. Support to correctly
"de-optionalize" this type including for lookup in type_annotation_map has
been fixed.

Fixes: #8777
Change-Id: Iaba90791dea341d00eaff788d40b0a4e48dab02e
2022-11-22 09:49:02 -05:00
mike bayer 4f0da8f07a Merge "Fix inferred type of async_sessionmaker" into main 2022-11-21 21:24:11 +00:00
mike bayer 5ff55f7078 Merge "add common base class for all SQL col expression objects" into main 2022-11-21 21:23:12 +00:00
Sam Bull e43e240a00 Fix inferred type of async_sessionmaker
Improved the typing for :class:`.sessionmaker` and
:class:`.asyncsessionmaker`, so that the default type of their return value
will be :class:`.Session` or :class:`.AsyncSession`, without the need to
type this explicitly. Previously, Mypy would not automaticaly infer these
return types from its generic base.

As part of this change, arguments for :class:`.Session`,
:class:`.AsyncSession`, :class:`.sessionmaker` and
:class:`.asyncsessionmaker` beyond the initial "bind" argument have been
made keyword-only, which includes parameters that have always been
documented as keyword arguments, such as :paramref:`.Session.autoflush`,
:paramref:`.Session.class_`, etc.

Pull request courtesy Sam Bull.

Closes: #8842
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8842
Pull-request-sha: fa6d1a8468

Change-Id: Iaaabc4572a87489d61617d970f62b9b50db4fac7
2022-11-21 12:01:56 -05:00
Mike Bayer caa9293e2e add common base class for all SQL col expression objects
Added a new type :class:`.SQLColumnExpression` which may be indicated in
user code to represent any SQL column oriented expression, including both
those based on :class:`.ColumnElement` as well as on ORM
:class:`.QueryableAttribute`. This type is a real class, not an alias, so
can also be used as the foundation for other objects.

Fixes: #8847
Change-Id: I3161bdff1c9f447793fce87864e1774a90cd4146
2022-11-21 11:55:23 -05:00
Mike Bayer ece524c005 fall back to eval() for names that have dots
Fixed regression in 2.0.0b3 caused by 🎫`8759` where indicating the
:class:`.Mapped` name using a qualified name such as
``sqlalchemy.orm.Mapped`` would fail to be recognized by Declarative as
indicating the :class:`.Mapped` construct.

Fixes: #8853
Change-Id: Iddb6efaae864d4545e80c54658244670f81ef6cc
2022-11-21 08:52:12 -05:00
mike bayer 1fd68ac20a Merge "Issue #8765: implement missing methods on PG Range" into main 2022-11-17 14:37:57 +00:00
mike bayer 60cc662861 Merge "Try running pyupgrade on the code" into main 2022-11-17 14:35:10 +00:00
Mike Bayer 200e70b974 accommodate NULL format_type()
Made an adjustment to how the PostgreSQL dialect considers column types
when it reflects columns from a table, to accommodate for alternative
backends which may return NULL from the PG ``format_type()`` function.

Fixes: #8748
Change-Id: I6178287aac567210a76afaa5805b825daa7fa4db
2022-11-16 20:11:18 -05:00
Federico Caselli 4eb4ceca36 Try running pyupgrade on the code
command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>"
pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not
exists in sqlalchemy fixtures

Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
2022-11-16 23:03:04 +01:00
mike bayer 3fc6c40ea7 Merge "perf improvements related to corresponding_column (2)" into main 2022-11-16 00:03:08 +00:00
mike bayer 073553be44 Merge "don't invoke fromclause.c when creating an annotated" into main 2022-11-16 00:01:33 +00:00
Lele Gaifax bc696220bb Issue #8765: implement missing methods on PG Range
### Description
This PR implements missing methods on the PG `Range` class, as described by issue #8765.

### Checklist
This pull request is:

- [ ] A documentation / typographical error fix
- [ ] A short code fix
- [x] A new feature implementation

Closes: #8766
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8766
Pull-request-sha: 21c0df86cc

Change-Id: I86fabd966ad1f14a3a86132be741df46965b9aa9
2022-11-15 15:27:34 -05:00
Mike Bayer d5be2cc139 perf improvements related to corresponding_column (2)
commit two of two. this reorganizes ColumnCollection
to build a new index up front that's used to optimize
the corresponding_column() method.

Additional performance enhancements within ORM-enabled SQL statements,
specifically targeting callcounts within the construction of ORM
statements, using combinations of :func:`_orm.aliased` with
:func:`_sql.union` and similar "compound" constructs, in addition to direct
performance improvements to the ``corresponding_column()`` internal method
that is used heavily by the ORM by constructs like :func:`_orm.aliased` and
similar.

Fixes: #8796
Change-Id: I4a76788007d5a802b9a4081e6a0f6e4b52497b50
2022-11-15 14:16:06 -05:00
Mike Bayer 93dc7ea150 don't invoke fromclause.c when creating an annotated
The ``aliased()`` constructor calls upon ``__clause_element__()``,
which internally annotates a ``FromClause``, like a subquery.
This became expensive as ``AnnotatedFromClause`` has for
many years called upon ``element.c`` so that the full ``.c``
collection is transferred to the Annotated.

Taking this out proved to be challenging. A straight remove
seemed to not break any tests except for the one that
tested the exact condition.  Nevertheless this seemed
"spooky" so I instead moved the get of ``.c`` to be in a
memoized proxy method.   However, that then exposed
a recursion issue related to loader_criteria; so the
source of that behavior, which was an accidental behavioral
artifact, is now made into an explcicit option that
loader_criteria uses directly.

The accidental behavioral artifact in question is still
kind of strange since I was not able to fully trace out
how it works, but the end result is that fixing the
artifact to be "correct" causes loader_criteria, within
the particular test for #7491, creates a select/
subquery structure with a cycle in it, so compilation fails
with recursion overflow.
The "solution" is to cause the artifact to occur in this
case, which is that the ``AnnotatedFromClause`` will have a
different ``.c`` collection than its element, which is a
subquery.  It's not totally clear how a cycle is generated
when this is not done.

This is commit one of two, which goes through
some hoops to make essentially a one-line change.

The next commit will rework ColumnCollection to optimize
the corresponding_column() method significantly.

Fixes: #8796
Change-Id: Id58ae6554db62139462c11a8be7313a3677456ad
2022-11-15 13:46:02 -05:00
Mike Bayer eea0f44bbd add informative exception context for literal render
An informative re-raise is now thrown in the case where any "literal
bindparam" render operation fails, indicating the value itself and
the datatype in use, to assist in debugging when literal params
are being rendered in a statement.

Fixes: #8800
Change-Id: Id658f8b03359312353ddbb0c7563026239579f7b
2022-11-14 10:28:40 -05:00
Federico Caselli 9f4ac8d155 Repair test in 32bit python builds.
Change-Id: I8287f3e1a975534c8a01a41c9dcc7e5e9f08bb52
2022-11-12 20:15:26 +01:00
mike bayer 6b140afe7d Merge "ensure anon_map is passed for most annotated traversals" into main 2022-11-11 21:30:43 +00:00
Mike Bayer 1d8833a9c1 ensure anon_map is passed for most annotated traversals
We can cache the annotated cache key for Table, but
for selectables it's not safe, as it fails to pass the
anon_map along and creates many redudant structures in
observed test scenario.  It is likely safe for a
Column that's mapped to a Table also, however this is
not implemented here.   Will have to see if that part
needs adjusting.

Fixed critical memory issue identified in cache key generation, where for
very large and complex ORM statements that make use of lots of ORM aliases
with subqueries, cache key generation could produce excessively large keys
that were orders of magnitude bigger than the statement itself. Much thanks
to Rollo Konig Brock for their very patient, long term help in finally
identifying this issue.

Also within TypeEngine objects, when we generate elements
for instance variables, skip the None elements at least.
this also saves on tuple complexity.

Fixes: #8790
Change-Id: I448ddbfb45ae0a648815be8dad4faad7d1977427
2022-11-11 15:25:35 -05:00
Mike Bayer 8e91cfe529 establish consistency for RETURNING column labels
The RETURNING clause now renders columns using the routine as that of the
:class:`.Select` to generate labels, which will include disambiguating
labels, as well as that a SQL function surrounding a named column will be
labeled using the column name itself. This is a more comprehensive change
than a similar one made for the 1.4 series that adjusted the function label
issue only.

includes 1.4's changelog for the backported version which also
fixes an Oracle issue independently of the 2.0 series.

Fixes: #8770
Change-Id: I2ab078a214a778ffe1720dbd864ae4c105a0691d
2022-11-11 16:20:00 +00:00
Mike Bayer e3a8d19891 work around Python 3.11 IntEnum issue; update FastIntFlag
in [1], Python 3.11 seems to have changed the behavior of
IntEnum.  We didn't notice this because we have our own
workaround class already, but typing did.   Ensure we remain
compatible with IntFlag.

This change also modifies FastIntFlag to no longer use
global symbols; this is unnecessary as we assign FastIntFlag
members explicitly.  Use of ``symbol()`` should probably
be phased out.

[1] https://github.com/python/cpython/issues/99304
Fixes: #8783

Change-Id: I8ae2e871ff1467ae5ca1f63e66b5dae45d4a6c93
2022-11-10 12:19:02 -05:00
Mike Bayer ebb54e80a5 try to support mypy 0.990
mypy introduces a crash we need to work around, also
some new rules.  It also has either a behavioral change
regarding how output is rendered in relationship to
files being within sys.path or not, so work around
that for test_mypy_plugin_py3k.py

References: https://github.com/python/mypy/issues/14027
Change-Id: I689c7fe27dc52abee932de9e0fb23b2a2eba76fa
2022-11-09 15:02:29 -05:00
Mike Bayer 4e0fc0b75a adjust update/delete test for non-ordering
this test sometimes has different ordering when running under
CI

Change-Id: I6dc3e24c6e23dc00a0ee5ba53e489ad813f12c58
2022-11-08 18:28:13 -05:00
Mike Bayer 9febc1a53e gc.collect() in order to ensure GeneratorExit raised on pypy
Fixes: #8762
Change-Id: Ibf656748ae6a54282ba58e91215e0f7a279b171a
2022-11-05 10:26:36 -04:00
mike bayer 4eb99ef08c Merge "support renamed symbols in annotation scans" into main 2022-11-04 18:37:56 +00:00
Mike Bayer c0b8bdcaf0 support renamed symbols in annotation scans
Added support in ORM declarative annotations for class names specified for
:func:`_orm.relationship`, as well as the name of the :class:`_orm.Mapped`
symbol itself, to be different names than their direct class name, to
support scenarios such as where :class:`_orm.Mapped` is imported as
``from sqlalchemy.orm import Mapped as M``, or where related class names
are imported with an alternate name in a similar fashion. Additionally, a
target class name given as the lead argument for :func:`_orm.relationship`
will always supersede the name given in the left hand annotation, so that
otherwise un-importable names that also don't match the class name can
still be used in annotations.

Fixes: #8759
Change-Id: I74a00de7e1a45bf62dad50fd385bb75cf343f9f3
2022-11-04 13:38:06 -04:00
Mike Bayer 7b6259c0f3 resolve synonyms in dictionary form of Session.get()
Improved "dictionary mode" for :meth:`_orm.Session.get` so that synonym
names which refer to primary key attribute names may be indicated in the
named dictionary.

Fixes: #8753
Change-Id: I56112564a5c23b51b26e01c64087cbf4399cd951
2022-11-04 12:49:49 -04:00
Mike Bayer b96321ae79 Support result.close() for all iterator patterns
This change contains new features for 2.0 only as well as some
behaviors that will be backported to 1.4.

For 1.4 and 2.0:

Fixed issue where the underlying DBAPI cursor would not be closed when
using :class:`_orm.Query` with :meth:`_orm.Query.yield_per` and direct
iteration, if a user-defined exception case were raised within the
iteration process, interrupting the iterator. This would lead to the usual
MySQL-related issues with server side cursors out of sync.

For 1.4 only:

A similar scenario can occur when using :term:`2.x` executions with direct
use of :class:`.Result`, in that case the end-user code has access to the
:class:`.Result` itself and should call :meth:`.Result.close` directly.
Version 2.0 will feature context-manager calling patterns to address this
use case.  However within the 1.4 scope, ensured that ``.close()`` methods
are available on all :class:`.Result` implementations including
:class:`.ScalarResult`, :class:`.MappingResult`.

For 2.0 only:

To better support the use case of iterating :class:`.Result` and
:class:`.AsyncResult` objects where user-defined exceptions may interrupt
the iteration, both objects as well as variants such as
:class:`.ScalarResult`, :class:`.MappingResult`,
:class:`.AsyncScalarResult`, :class:`.AsyncMappingResult` now support
context manager usage, where the result will be closed at the end of
iteration.

Corrected various typing issues within the engine and async engine
packages.

Fixes: #8710
Change-Id: I3166328bfd3900957eb33cbf1061d0495c9df670
2022-11-03 18:42:52 -04:00
mike bayer 9bae9a931a Merge "Improve typings of execution options" into main 2022-11-03 20:16:05 +00:00
mike bayer a5eed23c06 Merge "Implement contains_value(), issubset() and issuperset() on PG Range" into main 2022-11-03 20:11:58 +00:00
Lele Gaifax e8124b29b0 Implement contains_value(), issubset() and issuperset() on PG Range
Added new methods :meth:`_postgresql.Range.contains` and
:meth:`_postgresql.Range.contained_by` to the new :class:`.Range` data
object, which mirror the behavior of the PostgreSQL ``@>`` and ``<@``
operators, as well as the
:meth:`_postgresql.AbstractRange.comparator_factory.contains` and
:meth:`_postgresql.AbstractRange.comparator_factory.contained_by` SQL
operator methods. Pull request courtesy Lele Gaifax.

Fixes: #8706
Closes: #8707
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8707
Pull-request-sha: 3a74a0d93e

Change-Id: Ief81ca5c31448640b26dfbc3defd4dde1d51e366
2022-11-03 09:30:38 -04:00
Federico Caselli d10b62f54e Improve typings of execution options
Fixes: #8605
Change-Id: I4aec83b9f321462427c3f4ac941c3b272255c088
2022-11-02 21:38:31 -04:00
Mike Bayer 32b2b31da2 use simple decimal query to detect decimal char
Fixed issue where the ``nls_session_parameters`` view queried on first
connect in order to get the default decimal point character may not be
available depending on Oracle connection modes, and would therefore raise
an error.  The approach to detecting decimal char has been simplified to
test a decimal value directly, instead of reading system views, which
works on any backend / driver.

Fixes: #8744
Change-Id: I39825131c13513798863197d0c180dd5a18b32dc
2022-11-01 17:05:52 -04:00
Mike Bayer 66f3533de8 evaluate types in terms of the class in which they appear
Fixed issues within the declarative typing resolver (i.e. which resolves
``ForwardRef`` objects) where types that were declared for columns in one
particular source file would raise ``NameError`` when the ultimate mapped
class were in another source file.  The types are now resolved in terms
of the module for each class in which the types are used.

Fixes: #8742
Change-Id: I236f94484ea79d47392a6201e671eeb89c305fd8
2022-10-31 12:56:21 -04:00
mike bayer af9d3ab9b8 Merge "ensure pool.reset event always called for reset" into main 2022-10-30 21:49:24 +00:00
Mike Bayer b4261c45ab ensure pool.reset event always called for reset
Added new parameter :paramref:`.PoolEvents.reset.reset_state` parameter to
the :meth:`.PoolEvents.reset` event, with deprecation logic in place that
will continue to accept event hooks using the previous set of arguments.
This indicates various state information about how the reset is taking
place and is used to allow custom reset schemes to take place with full
context given.

Within this change a fix that's also backported to 1.4 is included which
re-enables the :meth:`.PoolEvents.reset` event to continue to take place
under all circumstances, including when :class:`.Connection` has already
"reset" the connection.

The two changes together allow custom reset schemes to be implemented using
the :meth:`.PoolEvents.reset` event, instead of the
:meth:`.PoolEvents.checkin` event (which continues to function as it always
has).

Change-Id: Ie17c4f55d02beb6f570b9de6b3044baffa7d6df6
Fixes: #8717
2022-10-30 15:43:19 -04:00
Mike Bayer 99e7afb4b2 fix test for same mapper to use "isa"
Fixed issue in joined eager loading where an assertion fail would occur
with a particular combination of outer/inner joined eager loads in
conjunction with an inherited subclass mapper as the middle target.

Fixes: #8738
Change-Id: I4909e7518302cbb82046e0425abbbdc8eb1c0146
2022-10-30 09:41:51 -04:00
mike bayer ed7bef7004 Merge "use only object_id() function for temp tables" into main 2022-10-29 01:36:19 +00:00
Mike Bayer 28541188ae ensure _ORMJoin transfers parententity from left side
Fixed bug involving :class:`.Select` constructs which used a combination of
:meth:`.Select.select_from` with an ORM entity followed by
:meth:`.Select.join` against the entity sent in
:meth:`.Select.select_from`, as well as using plain
:meth:`.Select.join_from`, which when combined with a columns clause that
didn't explicitly include that entity would then cause "automatic WHERE
criteria" features such as the IN expression required for a single-table
inheritance subclass, as well as the criteria set up by the
:func:`_orm.with_loader_criteria` option, to not be rendered for that
entity. The correct entity is now transferred to the :class:`.Join` object
that's generated internally, so that the criteria against the left
side entity is correctly added.

Fixes: #8721
Change-Id: I8266430063e2c72071b7262fdd5ec5079fbcba3e
2022-10-28 16:09:20 +00:00
mike bayer 2833aa2afb Merge "apply basic escaping to anon_labels unconditionally" into main 2022-10-28 13:59:05 +00:00
mike bayer 718d9570f2 Merge "ensure inherited mapper attrs not interpreted as plain dataclass fields" into main 2022-10-28 13:57:40 +00:00
Mike Barry 59f2d0c961 use only object_id() function for temp tables
Fixed issue with :meth:`.Inspector.has_table` when used against a temporary
table for the SQL Server dialect would fail an invalid object name error on
some Azure variants, due to an unnecessary information schema query that is
not supported on those server versions. Pull request courtesy Mike Barry.

the patch also fills out test support for has_table()
against temp tables, temp views, adding to the has_table() support just
added for views in #8700.

Fixes: #8714
Closes: #8716
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8716
Pull-request-sha: e2ac7a52e2

Change-Id: Ia73e4e9e977a2d6b7e100abd2f81a8c8777dc9bb
2022-10-28 13:08:49 +00:00