]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoreinvent xdist hooks in terms of pytest fixtures
Mike Bayer [Sun, 10 Jan 2021 18:44:14 +0000 (13:44 -0500)] 
reinvent xdist hooks in terms of pytest fixtures

To allow the "connection" pytest fixture and others work
correctly in conjunction with setup/teardown that expects
to be external to the transaction, remove and prevent any usage
of "xdist" style names that are hardcoded by pytest to run
inside of fixtures, even function level ones.   Instead use
pytest autouse fixtures to implement our own
r"setup|teardown_test(?:_class)?" methods so that we can ensure
function-scoped fixtures are run within them.   A new more
explicit flow is set up within plugin_base and pytestplugin
such that the order of setup/teardown steps, which there are now
many, is fully documented and controllable.   New granularity
has been added to the test teardown phase to distinguish
between "end of the test" when lock-holding structures on
connections should be released to allow for table drops,
vs. "end of the test plus its teardown steps" when we can
perform final cleanup on connections and run assertions
that everything is closed out.

From there we can remove most of the defensive "tear down everything"
logic inside of engines which for many years would frequently dispose
of pools over and over again, creating for a broken and expensive
connection flow.  A quick test shows that running test/sql/ against
a single Postgresql engine with the new approach uses 75% fewer new
connections, creating 42 new connections total, vs. 164 new
connections total with the previous system.

As part of this, the new fixtures metadata/connection/future_connection
have been integrated such that they can be combined together
effectively.  The fixture_session(), provide_metadata() fixtures
have been improved, including that fixture_session() now strongly
references sessions which are explicitly torn down before
table drops occur afer a test.

Major changes have been made to the
ConnectionKiller such that it now features different "scopes" for
testing engines and will limit its cleanup to those testing
engines corresponding to end of test, end of test class, or
end of test session.   The system by which it tracks DBAPI
connections has been reworked, is ultimately somewhat similar to
how it worked before but is organized more clearly along
with the proxy-tracking logic.  A "testing_engine" fixture
is also added that works as a pytest fixture rather than a
standalone function.  The connection cleanup logic should
now be very robust, as we now can use the same global
connection pools for the whole suite without ever disposing
them, while also running a query for PostgreSQL
locks remaining after every test and assert there are no open
transactions leaking between tests at all.  Additional steps
are added that also accommodate for asyncio connections not
explicitly closed, as is the case for legacy sync-style
tests as well as the async tests themselves.

As always, hundreds of tests are further refined to use the
new fixtures where problems with loose connections were identified,
largely as a result of the new PostgreSQL assertions,
many more tests have moved from legacy patterns into the newest.

An unfortunate discovery during the creation of this system is that
autouse fixtures (as well as if they are set up by
@pytest.mark.usefixtures) are not usable at our current scale with pytest
4.6.11 running under Python 2.  It's unclear if this is due
to the older version of pytest or how it implements itself for
Python 2, as well as if the issue is CPU slowness or just large
memory use, but collecting the full span of tests takes over
a minute for a single process when any autouse fixtures are in
place and on CI the jobs just time out after ten minutes.
So at the moment this patch also reinvents a small version of
"autouse" fixtures when py2k is running, which skips generating
the real fixture and instead uses two global pytest fixtures
(which don't seem to impact performance) to invoke the
"autouse" fixtures ourselves outside of pytest.
This will limit our ability to do more with fixtures
until we can remove py2k support.

py.test is still observed to be much slower in collection in the
4.6.11 version compared to modern 6.2 versions, so add support for new
TOX_POSTGRESQL_PY2K and TOX_MYSQL_PY2K environment variables that
will run the suite for fewer backends under Python 2.  For Python 3
pin pytest to modern 6.2 versions where performance for collection
has been improved greatly.

Includes the following improvements:

Fixed bug in asyncio connection pool where ``asyncio.TimeoutError`` would
be raised rather than :class:`.exc.TimeoutError`.  Also repaired the
:paramref:`_sa.create_engine.pool_timeout` parameter set to zero when using
the async engine, which previously would ignore the timeout and block
rather than timing out immediately as is the behavior with regular
:class:`.QueuePool`.

For asyncio the connection pool will now also not interact
at all with an asyncio connection whose ConnectionFairy is
being garbage collected; a warning that the connection was
not properly closed is emitted and the connection is discarded.
Within the test suite the ConnectionKiller is now maintaining
strong references to all DBAPI connections and ensuring they
are released when tests end, including those whose ConnectionFairy
proxies are GCed.

Identified cx_Oracle.stmtcachesize as a major factor in Oracle
test scalability issues, this can be reset on a per-test basis
rather than setting it to zero across the board.  the addition
of this flag has resolved the long-standing oracle "two task"
error problem.

For SQL Server, changed the temp table style used by the
"suite" tests to be the double-pound-sign, i.e. global,
variety, which is much easier to test generically.  There
are already reflection tests that are more finely tuned
to both styles of temp table within the mssql test
suite.  Additionally, added an extra step to the
"dropfirst" mechanism for SQL Server that will remove
all foreign key constraints first as some issues were
observed when using this flag when multiple schemas
had not been torn down.

Identified and fixed two subtle failure modes in the
engine, when commit/rollback fails in a begin()
context manager, the connection is explicitly closed,
and when "initialize()" fails on the first new connection
of a dialect, the transactional state on that connection
is still rolled back.

Fixes: #5826
Fixes: #5827
Change-Id: Ib1d05cb8c7cf84f9a4bfd23df397dc23c9329bfe

4 years agoMerge "Remove special rule for TypeDecorator of TypeDecorator"
mike bayer [Thu, 7 Jan 2021 20:58:55 +0000 (20:58 +0000)] 
Merge "Remove special rule for TypeDecorator of TypeDecorator"

4 years agoUpdate connect args for pymysql 1.0.0; aiomysql fixes
Mike Bayer [Thu, 7 Jan 2021 17:20:51 +0000 (12:20 -0500)] 
Update connect args for pymysql 1.0.0; aiomysql fixes

Fixed deprecation warnings that arose as a result of the release of PyMySQL
1.0, including deprecation warnings for the "db" and "passwd" parameters
now replaced with "database" and "password".

For the 1.4 version of this patch, we are also changing tox.ini
to refer to a local branch of aiomysql that fixes pymysql
compatibility issues.

Fixes: #5821
Change-Id: I93876b52b2d96b52308f22aeb4f244ac5766a82f

4 years agorepair transaction scope in test_nullPKsOK_BtoA for mssql
Mike Bayer [Thu, 7 Jan 2021 16:01:31 +0000 (11:01 -0500)] 
repair transaction scope in test_nullPKsOK_BtoA for mssql

In the bound metadata removal we also mixed use of
connection/engine in this test which is causing a hang
on SQL Server.

Change-Id: Ibbee06654d0d549968db5e0bf9daa5bef27cdbe1

4 years agorepair ORM tests that use deferrable FKs
Mike Bayer [Wed, 6 Jan 2021 17:50:22 +0000 (12:50 -0500)] 
repair ORM tests that use deferrable FKs

after the bound metadata merge the unitofwork.TransactionTest
became deprecations.AutocommitClosesOnFail and was found to
be not actually running correctly on SQLite.  This test
should only run on a backend that has deferrable FKs,
which includes PostgreSQL; so add that to requirements.  this
in turn requires clarification of test_naturalpks that the
"deferrable FKs" req there is more about Oracle and its lack
of ON UPDATE cascades.

Change-Id: I867a164679274940803852c1af0920da74683bfa

4 years agoMerge "remove more bound metadata"
mike bayer [Wed, 6 Jan 2021 15:25:21 +0000 (15:25 +0000)] 
Merge "remove more bound metadata"

4 years agoremove more bound metadata
Mike Bayer [Mon, 4 Jan 2021 20:18:25 +0000 (15:18 -0500)] 
remove more bound metadata

in Iae6ab95938a7e92b6d42086aec534af27b5577d3 I missed
that the "bind" was being stuck onto the MetaData in
TablesTest, which led thousands of ORM tests to still use
bound metadata.  Keep looking for bound metadata.

standardize all ORM tests on a single means of getting a
Session when the Session API isn't the thing we are directly
testing, using a new function fixture_session() that replaces
create_session() and uses modern defaults.

Change-Id: Iaf71206e9ee568151496d8bc213a069504bf65ef

4 years agoRemove special rule for TypeDecorator of TypeDecorator
Mike Bayer [Tue, 5 Jan 2021 13:48:36 +0000 (08:48 -0500)] 
Remove special rule for TypeDecorator of TypeDecorator

Removing this check for "TypeDecorator" in impl seems to not
break anything and allows TypeDecorator.with_variant() to
work correctly.   The line has been traced back to 2007 and
does not appear to have relevance today.

Fixed bug where making use of the :meth:`.TypeEngine.with_variant` method
on a :class:`.TypeDecorator` type would fail to take into account the
dialect-specific mappings in use, due to a rule in :class:`.TypeDecorator`
that was instead attempting to check for chains of :class:`.TypeDecorator`
instances.

Fixes: #5816
Change-Id: Ic86d9d985810e3050f15972b4841108acca2fa3e

4 years agoCheck for column expr in Oracle RETURNING check
Mike Bayer [Mon, 4 Jan 2021 22:05:46 +0000 (17:05 -0500)] 
Check for column expr in Oracle RETURNING check

Fixed regression in Oracle dialect introduced by :ticket:`4894` in
SQLAlchemy 1.3.11 where use of a SQL expression in RETURNING for an UPDATE
would fail to compile, due to a check for "server_default" when an
arbitrary SQL expression is not a column.

Fixes: #5813
Change-Id: I1977bb49bc971399195015ae45e761f774f4008d

4 years agohappy new year
Mike Bayer [Mon, 4 Jan 2021 14:47:43 +0000 (09:47 -0500)] 
happy new year

Change-Id: Ic5bb19ca8be3cb47c95a0d3315d84cb484bac47c

4 years agoremove metadata.bind use from test suite
Mike Bayer [Mon, 21 Dec 2020 15:22:43 +0000 (10:22 -0500)] 
remove metadata.bind use from test suite

importantly this means we can remove bound metadata from
the fixtures that are used by Alembic's test suite.

hopefully this is the last one that has to happen to allow
Alembic to be fully 1.4/2.0.

Start moving from @testing.provide_metadata to a pytest
metadata fixture.  This does not seem to have any negative
effects even though TablesTest uses a "self.metadata" attribute.

Change-Id: Iae6ab95938a7e92b6d42086aec534af27b5577d3

4 years agoCache asyngpg prepared statements
Mike Bayer [Fri, 1 Jan 2021 18:21:55 +0000 (13:21 -0500)] 
Cache asyngpg prepared statements

Enhanced the performance of the asyncpg dialect by caching the asyncpg
PreparedStatement objects on a per-connection basis. For a test case that
makes use of the same statement on a set of pooled connections this appears
to grant a 10-20% speed improvement.  The cache size is adjustable and may
also be disabled.

Unfortunately the caching gets more complicated when there are
schema changes present.  An invalidation scheme is now also added
to accommodate for prepared statements as well as asyncpg cached OIDs.
However, the exception raises cannot be prevented if DDL has changed
database structures that were cached for a particular asyncpg
connection.  Logic is added to clear the caches when these errors occur.

Change-Id: Icf02aa4871eb192f245690f28be4e9f9c35656c6

4 years agoMerge "Repair async test refactor"
mike bayer [Sun, 3 Jan 2021 00:52:41 +0000 (00:52 +0000)] 
Merge "Repair async test refactor"

4 years agoRepair async test refactor
Mike Bayer [Sat, 2 Jan 2021 15:55:21 +0000 (10:55 -0500)] 
Repair async test refactor

in I4940d184a4dc790782fcddfb9873af3cca844398 we reworked how async
tests run but apparently the async tests in test/ext/asyncio
are reporting success without being run.   This patch pushes
pytestplugin further so that it won't instrument any test
or function overall that declares itself async. This removes
the need for the __async_wrap__ flag and also allows us to
use a more strict "run_async_test" function that always
runs the asyncio event loop from the top.

Also start working asyncio into main testing suite.

Change-Id: If7144e951a9db67eb7ea73b377f81c4440d39819

4 years agoMerge "Further attempts to repair SQL server temp table issue"
mike bayer [Sat, 2 Jan 2021 23:26:25 +0000 (23:26 +0000)] 
Merge "Further attempts to repair SQL server temp table issue"

4 years agoFurther attempts to repair SQL server temp table issue
Mike Bayer [Sat, 2 Jan 2021 16:55:52 +0000 (11:55 -0500)] 
Further attempts to repair SQL server temp table issue

Still having non-reproducible failures where "user_tmp" cannot
be dropped.   try isolating the table name around config.ident

Change-Id: I17e0a9674b22d246f0d52943b850e8f6de223305

4 years agoMerge "Support casting to ``FLOAT`` in MySQL and MariaDb."
mike bayer [Fri, 1 Jan 2021 21:17:49 +0000 (21:17 +0000)] 
Merge "Support casting to ``FLOAT`` in MySQL and MariaDb."

4 years agoSupport casting to ``FLOAT`` in MySQL and MariaDb.
Federico Caselli [Wed, 30 Dec 2020 19:36:27 +0000 (20:36 +0100)] 
Support casting to ``FLOAT`` in MySQL and MariaDb.

Fixes: #5808
Change-Id: I8106ddcf681eec3cb3a67d853586702f6e844b9d

4 years agoSupport testing of async drivers without fallback mode
Federico Caselli [Sun, 16 Aug 2020 08:48:57 +0000 (10:48 +0200)] 
Support testing of async drivers without fallback mode

Change-Id: I4940d184a4dc790782fcddfb9873af3cca844398

4 years agoSupport TypeDecorator.get_dbapi_type() for setinpusizes
Mike Bayer [Wed, 30 Dec 2020 18:56:20 +0000 (13:56 -0500)] 
Support TypeDecorator.get_dbapi_type() for setinpusizes

Adjusted the "setinputsizes" logic relied upon by the cx_Oracle, asyncpg
and pg8000 dialects to support a :class:`.TypeDecorator` that includes
an override the :meth:`.TypeDecorator.get_dbapi_type()` method.

Change-Id: I5aa70abf0d9a9e2ca43309f2dd80b3fcd83881b9

4 years agoMerge "disambiguate SQL server temp table constraint names"
mike bayer [Wed, 30 Dec 2020 03:33:20 +0000 (03:33 +0000)] 
Merge "disambiguate SQL server temp table constraint names"

4 years agodisambiguate SQL server temp table constraint names
Mike Bayer [Wed, 30 Dec 2020 02:06:15 +0000 (21:06 -0500)] 
disambiguate SQL server temp table constraint names

This seems to be raising errors lately which was not the
case earlier, however SQL Server seems to produce name conflicts
for named constraints against temp tables in different databases.
I can raise the error every time here running two tests
from ComponentReflectionTest with -n2.  Unknown why the issue
is happening now and didn't occur for several months.

https://www.arbinada.com/en/node/1645 has some background.

Change-Id: I8854dfd88503fb855a7e12622ebe97c08915e5bb

4 years agoAdd support for AsyncSession.get()
Mike Bayer [Sun, 27 Dec 2020 21:55:13 +0000 (16:55 -0500)] 
Add support for AsyncSession.get()

Fixes: #5802
Change-Id: If59dbac4d4638563b7dcbc7bb2cb0df0a0144a2e

4 years agoMerge "Improve async session docs."
mike bayer [Sun, 27 Dec 2020 20:29:51 +0000 (20:29 +0000)] 
Merge "Improve async session docs."

4 years agoMerge "narrow the check for double-paren exprs in mysql create_index"
mike bayer [Sat, 26 Dec 2020 21:43:13 +0000 (21:43 +0000)] 
Merge "narrow the check for double-paren exprs in mysql create_index"

4 years agoimplement sessionmaker.begin(), scalar() for async session
Mike Bayer [Sat, 26 Dec 2020 16:46:42 +0000 (11:46 -0500)] 
implement sessionmaker.begin(), scalar() for async session

Added :meth:`_asyncio.AsyncSession.scalar` as well as support for
:meth:`_orm.sessionmaker.begin` to work as an async context manager with
:class:`_asyncio.AsyncSession`.  Also added
:meth:`_asyncio.AsyncSession.in_transaction` accessor.

Fixes: #5796
Fixes: #5797
Change-Id: Id3d431421df0f8c38f356469a50a946ba9c38513

4 years agonarrow the check for double-paren exprs in mysql create_index
Mike Bayer [Sat, 26 Dec 2020 16:16:51 +0000 (11:16 -0500)] 
narrow the check for double-paren exprs in mysql create_index

Fixed regression from SQLAlchemy 1.3.20 caused by the fix for
:ticket:`5462` which adds double-parenthesis for MySQL functional
expressions in indexes, as is required by the backend, this inadvertently
extended to include arbitrary :func:`_sql.text` expressions as well as
Alembic's internal textual component,  which are required by Alembic for
arbitrary index expressions which don't imply double parenthesis.  The
check has been narrowed to include only binary/ unary/functional
expressions directly.

Fixes: #5800
Change-Id: I40f83c6f9dd04b984d0c86eba632a588570709a1

4 years agoImprove async session docs.
Federico Caselli [Wed, 23 Dec 2020 21:18:36 +0000 (22:18 +0100)] 
Improve async session docs.

Mention that the context manager is only for convenience, that it's equivalent
to calling ``close()``

Change-Id: Ic186167cc3d4bbd7a24701dd6169ed0d515c5dc5

4 years agoAdd ORMExecuteState mapper accessors
Mike Bayer [Wed, 23 Dec 2020 15:43:51 +0000 (10:43 -0500)] 
Add ORMExecuteState mapper accessors

Added :attr:`_orm.ORMExecuteState.bind_mapper` and
:attr:`_orm.ORMExecuteState.all_mappers` accessors to
:class:`_orm.ORMExecuteState` event object, so that handlers can respond to
the target mapper and/or mapped class or classes involved in an ORM
statement execution.

Change-Id: I2cfe3d422ce5df2559105d53a51135a583359bd9

4 years agoFix issues with JSON and float/numeric
Gord Thompson [Sun, 20 Dec 2020 17:20:10 +0000 (10:20 -0700)] 
Fix issues with JSON and float/numeric

Decimal accuracy and behavior has been improved when extracting floating
point and/or decimal values from JSON strings using the
:meth:`_sql.sqltypes.JSON.Comparator.as_float` method, when the numeric
value inside of the JSON string has many significant digits; previously,
MySQL backends would truncate values with many significant digits and SQL
Server backends would raise an exception due to a DECIMAL cast with
insufficient significant digits.   Both backends now use a FLOAT-compatible
approach that does not hardcode significant digits for floating point
values. For precision numerics, a new method
:meth:`_sql.sqltypes.JSON.Comparator.as_numeric` has been added which
accepts arguments for precision and scale, and will return values as Python
``Decimal`` objects with no floating point conversion assuming the DBAPI
supports it (all but pysqlite).

Fixes: #5788
Change-Id: I6eb51fe172a389548dd6e3c65efec9f1f538012e

4 years agoMerge "Allow Declarative to extract class attr from field"
mike bayer [Sat, 19 Dec 2020 19:56:14 +0000 (19:56 +0000)] 
Merge "Allow Declarative to extract class attr from field"

4 years agoMerge "Repair mssql dep tests; have __only_on__ imply __backend__"
mike bayer [Sat, 19 Dec 2020 18:51:31 +0000 (18:51 +0000)] 
Merge "Repair mssql dep tests; have __only_on__ imply __backend__"

4 years agoMerge "Repair and cover adaption call w/ ORM having()"
mike bayer [Sat, 19 Dec 2020 18:50:02 +0000 (18:50 +0000)] 
Merge "Repair and cover adaption call w/ ORM having()"

4 years agoAllow Declarative to extract class attr from field
Mike Bayer [Thu, 3 Dec 2020 19:35:30 +0000 (14:35 -0500)] 
Allow Declarative to extract class attr from field

Added an alternate resolution scheme to Declarative that will extract the
SQLAlchemy column or mapped property from the "metadata" dictionary of a
dataclasses.Field object.  This allows full declarative mappings to be
combined with dataclass fields.

Fixes: #5745
Change-Id: I1165bc025246a4cb9fc099b1b7c46a6b0f799b23

4 years agoRepair and cover adaption call w/ ORM having()
esoh [Sat, 19 Dec 2020 02:59:31 +0000 (21:59 -0500)] 
Repair and cover adaption call w/ ORM having()

Fixed 1.4 regression where the use of :meth:`_orm.Query.having` in
conjunction with queries with internally adapted SQL elements (common in
inheritance scenarios) would fail due to an incorrect function call. Pull
request courtesy esoh.

Fixes: #5781
Closes: #5782
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5782
Pull-request-sha: 5d37b0be0db68ec2a4dfea552ee47bcb3ef6778c

Change-Id: I123b2c0a4a23b7c7c72929dec79801726afc71ee

4 years agoRepair mssql dep tests; have __only_on__ imply __backend__
Mike Bayer [Sat, 19 Dec 2020 15:59:42 +0000 (10:59 -0500)] 
Repair mssql dep tests; have __only_on__ imply __backend__

CI missed a few SQL Server tests because we run mssql-backendonly
in the gerrit job.   As there was a test that was "only on"
mssql but didn't have backendonly, it never got run and then
fails in master where we run mssql fully.

Any suite that has an __only_on__ is inherently specific to
a backend, so if present this should imply __backend__ so that
it definitely runs when we have that backend present.

This in turn meant we had to fix a few sqlite_file tests that
weren't cleaning up or sharing well as they suddenly became
backend tests under sqlite_file.  Added a sqlite_file cleanup
to test class cleanup for now.

Change-Id: I9de1ceabd6596547a65c59059a55b7e5156103fd

4 years agoImprove type detection for Values / Tuple
Mike Bayer [Fri, 18 Dec 2020 17:22:12 +0000 (12:22 -0500)] 
Improve type detection for Values / Tuple

Fixed issue in new :class:`_sql.Values` construct where passing tuples of
objects would fall back to per-value type detection rather than making use
of the :class:`_schema.Column` objects passed directly to
:class:`_sql.Values` that tells SQLAlchemy what the expected type is. This
would lead to issues for objects such as enumerations and numpy strings
that are not actually necessary since the expected type is given.

note this changes NullType() to raise CompileError for
literal_processor; NullType() does not imply the actual value
NULL as much as it does "unknown type" so this should make failure
modes more clear.

Fixes: #5785
Change-Id: Ifbf5e78373102380b301098f30e15011efa98b5e

4 years agoMerge "test fixes for oracle 18c"
mike bayer [Fri, 18 Dec 2020 21:38:25 +0000 (21:38 +0000)] 
Merge "test fixes for oracle 18c"

4 years agocherry-pick changelog update for 1.3.23
Mike Bayer [Fri, 18 Dec 2020 21:11:56 +0000 (16:11 -0500)] 
cherry-pick changelog update for 1.3.23

4 years agocherry-pick changelog from 1.3.22
Mike Bayer [Fri, 18 Dec 2020 21:11:56 +0000 (16:11 -0500)] 
cherry-pick changelog from 1.3.22

4 years agotest fixes for oracle 18c
Mike Bayer [Fri, 18 Dec 2020 15:46:20 +0000 (10:46 -0500)] 
test fixes for oracle 18c

Change-Id: I4968aa3bde3c4d11d7fe84f18b4a846ba357d16a

4 years agoGracefully degrade on v$transaction not readable
Mike Bayer [Fri, 18 Dec 2020 14:28:06 +0000 (09:28 -0500)] 
Gracefully degrade on v$transaction not readable

Fixed regression which occured due to [ticket:5755] which implemented
isolation level support for Oracle.   It has been reported that many Oracle
accounts don't actually have permission to query the ``v$transaction``
view so this feature has been altered to gracefully fallback when it fails
upon database connect, where the dialect will assume "READ COMMITTED" is
the default isolation level as was the case prior to SQLAlchemy 1.3.21.
However, explicit use of the :meth:`_engine.Connection.get_isolation_level`
method must now necessarily raise an exception, as Oracle databases with
this restriction explicitly disallow the user from reading the current
isolation level.

Fixes: #5784
Change-Id: Iefc82928744f3c944c18ae8000eb3c9e52e523bc

4 years agocherry-pick changelog update for 1.3.22
Mike Bayer [Thu, 17 Dec 2020 17:35:20 +0000 (12:35 -0500)] 
cherry-pick changelog update for 1.3.22

4 years agocherry-pick changelog from 1.3.21
Mike Bayer [Thu, 17 Dec 2020 17:35:20 +0000 (12:35 -0500)] 
cherry-pick changelog from 1.3.21

4 years agoMerge "Improved PEP-484 for AsyncSession.run_sync"
mike bayer [Thu, 17 Dec 2020 15:20:56 +0000 (15:20 +0000)] 
Merge "Improved PEP-484 for AsyncSession.run_sync"

4 years agolambda refactor post-production fixes
Mike Bayer [Thu, 17 Dec 2020 15:14:18 +0000 (10:14 -0500)] 
lambda refactor post-production fixes

comments from 77c9534dcaf3723f7b2baf42442eda3e1d8c3332
addressed

Change-Id: I09ae6429ecc89f6fd0949d7d5f1fb4d977e91ad4

4 years agoMajor revisals to lambdas
Mike Bayer [Sat, 12 Dec 2020 23:56:58 +0000 (18:56 -0500)] 
Major revisals to lambdas

1. Improve coercions._deep_is_literal to check sequences
for clause elements, thus allowing a phrase like
lambda: col.in_([literal("x"), literal("y")]) to be handled

2. revise closure variable caching completely.   All variables
entering must be part of a closure cache key or rejected.
only objects that can be resolved to HasCacheKey or FunctionType
are accepted; all other types are rejected.  This adds a high
degree of strictness to lambdas and will make them a little more
awkward to use in some cases, however prevents several classes
of critical issues:

a. previously, a lambda that had an expression derived from
some kind of state, like "self.x", or "execution_context.session.foo"
would produce a closure cache key from "self" or "execution_context",
objects that can very well be per-execution and would therefore
cause a AnalyzedFunction objects to overflow. (memory won't leak
as it looks like an LRUCache is already used for these)

b. a lambda, such as one used within DeferredLamdaElement, that
produces different SQL expressions based on the arguments
(which is in fact what it's supposed to do), however it would
through the use of conditionals produce different bound parameter
combinations, leading to literal parameters not tracked properly.
These are now rejected as uncacheable whereas previously they would
again be part of the closure cache key, causing an overflow of
AnalyizedFunction objects.

3. Ensure non-mapped mixins are handled correctly by
with_loader_criteria().

4. Fixed bug in lambda SQL system where we are not supposed to allow a Python
function to be embedded in the lambda, since we can't predict a bound value
from it.   While there was an error condition added for this, it was not
tested and wasn't working; an informative error is now raised.

5. new docs for lambdas

6. consolidated changelog for all of these

Fixes: #5760
Fixes: #5765
Fixes: #5766
Fixes: #5768
Fixes: #5770
Change-Id: Iedaa636c3225fad496df23b612c516c8ab247ab7

4 years agoImproved PEP-484 for AsyncSession.run_sync
Michael Oliver [Wed, 16 Dec 2020 16:49:07 +0000 (11:49 -0500)] 
Improved PEP-484 for AsyncSession.run_sync

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

### Description
<!-- Describe your changes in detail -->
I don't think this needs any test added.

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

Fixes: #5777
**Have a nice day!**

Closes: #5778
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5778
Pull-request-sha: 618ddc84d27b9b67f9ae78fd457f94feff1ce160

Change-Id: Id46f70ddc14e8f8d7e402a4b3ce7e934509bef24

4 years agoCheck explicitly for mapped class as secondary
Mike Bayer [Tue, 15 Dec 2020 14:45:48 +0000 (09:45 -0500)] 
Check explicitly for mapped class as secondary

Added a comprehensive check and an informative error message for the case
where a mapped class, or a string mapped class name, is passed to
:paramref:`_orm.relationship.secondary`.  This is an extremely common error
which warrants a clear message.

Additionally, added a new rule to the class registry resolution such that
with regards to the :paramref:`_orm.relationship.secondary` parameter, if a
mapped class and its table are of the identical string name, the
:class:`.Table` will be favored when resolving this parameter.   In all
other cases, the class continues to be favored if a class and table
share the identical name.

Fixes: #5774
Change-Id: I65069d79c1c3897fbd1081a8e1edf3b63b497223

4 years agofix some pep8 warnings
Mike Bayer [Tue, 15 Dec 2020 16:22:37 +0000 (11:22 -0500)] 
fix some pep8 warnings

somehow the change in 4beecfb90 merged with failing
pep8.   Fix those and also fix hardcoded "basepython" version.

Change-Id: Id38674661e038499aef76770e9799517e3613933

4 years agoUse .expression accessor for hybrid example
Mike Bayer [Tue, 15 Dec 2020 13:52:15 +0000 (08:52 -0500)] 
Use .expression accessor for hybrid example

hybrids since 1.1 use InstrumentedAttribute at the expression
level, so this doc needed to illustrate how to get at the
SQL expression.  Also added a docstring for
QueryableAttribute.expression.

Fixes: #5773
Change-Id: I4941d245ec947999abfa8e13f047e06a0bd47e5b

4 years agoMerge "Emit deprecation warnings for plain text under Session"
mike bayer [Mon, 14 Dec 2020 17:44:33 +0000 (17:44 +0000)] 
Merge "Emit deprecation warnings for plain text under Session"

4 years agoEmit deprecation warning for general DDLElement.bind argument
Mike Bayer [Mon, 14 Dec 2020 15:36:57 +0000 (10:36 -0500)] 
Emit deprecation warning for general DDLElement.bind argument

Change-Id: I8ab1fd98340cb30aa43075508b3a0b9feffa290c

4 years agoMerge "Support IF EXISTS/IF NOT EXISTS for DDL constructs"
mike bayer [Mon, 14 Dec 2020 16:35:56 +0000 (16:35 +0000)] 
Merge "Support IF EXISTS/IF NOT EXISTS for DDL constructs"

4 years agoMerge "Emit 2.0 deprecation warning for sub-transactions"
mike bayer [Mon, 14 Dec 2020 15:38:21 +0000 (15:38 +0000)] 
Merge "Emit 2.0 deprecation warning for sub-transactions"

4 years agoSupport IF EXISTS/IF NOT EXISTS for DDL constructs
RamonWill [Wed, 21 Oct 2020 12:24:27 +0000 (08:24 -0400)] 
Support IF EXISTS/IF NOT EXISTS for DDL constructs

Added parameters :paramref:`_ddl.CreateTable.if_not_exists`,
:paramref:`_ddl.CreateIndex.if_not_exists`,
:paramref:`_ddl.DropTable.if_exists` and
:paramref:`_ddl.DropIndex.if_exists` to the :class:`_ddl.CreateTable`,
:class:`_ddl.DropTable`, :class:`_ddl.CreateIndex` and
:class:`_ddl.DropIndex` constructs which result in "IF NOT EXISTS" / "IF
EXISTS" DDL being added to the CREATE/DROP. These phrases are not accepted
by all databases and the operation will fail on a database that does not
support it as there is no similarly compatible fallback within the scope of
a single DDL statement.  Pull request courtesy Ramon Williams.

Fixes: #2843
Closes: #5663
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5663
Pull-request-sha: 748b8472345d96efb446e2a444fbe020b313669f

Change-Id: I6a2b1f697993ed49c31584f0a31887fb0a868ed3

4 years agoEmit 2.0 deprecation warning for sub-transactions
Mike Bayer [Fri, 11 Dec 2020 20:33:22 +0000 (15:33 -0500)] 
Emit 2.0 deprecation warning for sub-transactions

The nesting pattern will be removed in 2.0, so the use of the
MarkerTransaction should emit a 2.0 deprecation warning
unconditionally.

Change-Id: I96aed22c4e5db9b59e9b28a7f2d1283cd99a9cb6

4 years agoRemove autoload=True references
Gord Thompson [Sat, 12 Dec 2020 16:29:12 +0000 (09:29 -0700)] 
Remove autoload=True references

Remove references to deprecated ``autoload=True`` in docs and code samples.
Also remove test/dialect/test_firebird.py and test/dialect/test_sybase.py
as those tests have already been incorporated into the external dialects.

Change-Id: I9788c27c971e3b2357f4cfa2d4698a6af727b073

4 years agoMerge "Fixes for lambda expressions and relationship loaders"
mike bayer [Sat, 12 Dec 2020 04:04:53 +0000 (04:04 +0000)] 
Merge "Fixes for lambda expressions and relationship loaders"

4 years agoFixes for lambda expressions and relationship loaders
Mike Bayer [Sat, 12 Dec 2020 00:01:12 +0000 (19:01 -0500)] 
Fixes for lambda expressions and relationship loaders

Fixed bug in lambda SQL feature, used by ORM
:meth:`_orm.with_loader_criteria` as well as available generally in the SQL
expression language, where assigning a boolean value True/False to a
variable would cause the query-time expression calculation to fail, as it
would produce a SQL expression not compatible with a bound value.

Fixed issue where the :attr:`_orm.ORMExecuteState.is_relationship_load`
parameter would not be set correctly for many lazy loads, all
selectinloads, etc.  The flag is essential in order to test if options
should be added to statements or if they would already have been propagated
via relationship loads.

Fixes: #5763
Fixes: #5764
Change-Id: I66aafbef193f892ff75ede0670698647b7475482

4 years agoMerge "Send deterministic ordering into unit of work topological"
mike bayer [Sat, 12 Dec 2020 02:53:44 +0000 (02:53 +0000)] 
Merge "Send deterministic ordering into unit of work topological"

4 years agoSend deterministic ordering into unit of work topological
Mike Bayer [Mon, 30 Nov 2020 17:50:51 +0000 (12:50 -0500)] 
Send deterministic ordering into unit of work topological

Improved the unit of work topological sorting system such that the
toplogical sort is now deterministic based on the sorting of the input set,
which itself is now sorted at the level of mappers, so that the same inputs
of affected mappers should produce the same output every time, among
mappers / tables that don't have any dependency on each other. This further
reduces the chance of deadlocks as can be observed in a flush that UPDATEs
among multiple, unrelated tables such that row locks are generated.

topological.sort() has been made "deterministic" in all cases by
using a separate list + set.

Fixes: #5735
Change-Id: I073103df414dba549e46605b394f8ccae6e80d0e

4 years agoEmit deprecation warnings for plain text under Session
Mike Bayer [Wed, 9 Dec 2020 16:39:45 +0000 (11:39 -0500)] 
Emit deprecation warnings for plain text under Session

Deprecation warnings are emitted under "SQLALCHEMY_WARN_20" mode when
passing a plain string to :meth:`_orm.Session.execute`.

It was also considered to have DDL string expressions to include
this as well, however this leaves us with no backwards-compatible
way of handling reflection of elemens, such as an Index() which
reflects "postgresql_where='x > 5'", there's no place for a rule
that will turn those into text() within the reflection process
that would be separate from when the user passes postgresql_where
to the Index.  Not worth it right now.

Fixes: #5754
Change-Id: I8673a79f0e87de0df576b655f39dad0351725ca8

4 years agoMerge "correct for "autocommit" deprecation warning"
mike bayer [Fri, 11 Dec 2020 19:39:04 +0000 (19:39 +0000)] 
Merge "correct for "autocommit" deprecation warning"

4 years agocorrect for "autocommit" deprecation warning
Mike Bayer [Sun, 15 Nov 2020 21:58:50 +0000 (16:58 -0500)] 
correct for "autocommit" deprecation warning

Ensure no autocommit warnings occur internally or
within tests.

Also includes fixes for SQL Server full text tests
which apparently have not been working at all for a long
time, as it used long removed APIs.  CI has not had
fulltext running for some years and is now installed.

Change-Id: Id806e1856c9da9f0a9eac88cebc7a94ecc95eb96

4 years agoMerge "Revise attribute refresh for with_loader_criteria, related"
mike bayer [Fri, 11 Dec 2020 18:20:20 +0000 (18:20 +0000)] 
Merge "Revise attribute refresh for with_loader_criteria, related"

4 years agoMerge "add aiomysql support"
mike bayer [Fri, 11 Dec 2020 16:52:48 +0000 (16:52 +0000)] 
Merge "add aiomysql support"

4 years agoRevise attribute refresh for with_loader_criteria, related
Mike Bayer [Fri, 11 Dec 2020 15:34:44 +0000 (10:34 -0500)] 
Revise attribute refresh for with_loader_criteria, related

Added new attribute :attr:`_orm.ORMExecuteState.is_column_load` to indicate
that a :meth:`_orm.SessionEvents.do_orm_execute` handler that a particular
operation is a primary-key-directed column attribute load, such as from an
expiration or a deferred attribute, and that WHERE criteria or additional
loader options should not be added to the query.   This has been added to
the examples which illustrate the :func:`_orm.with_loader_criteria` option.

The :func:`_orm.with_loader_criteria` option has been modified so that it
will never apply its criteria to the SELECT statement for an ORM refresh
operation, such as that invoked by :meth:`_orm.Session.refresh` or whenever
an expired attribute is loaded.   These queries are only against the
primary key row of the object that is already present in memory so there
should not be additional criteria added.

Added doc caveats for using lambdas.

Added test coverage for most ORMExecuteState flags and fixed a few
basic access issues.

Change-Id: I6707e4cf0dc95cdfb8ce93e5ca22ead86074baa7
References: #5760
Fixes: #5761
Fixes: #5762
4 years agoadd aiomysql support
Mike Bayer [Fri, 4 Dec 2020 21:26:44 +0000 (16:26 -0500)] 
add aiomysql support

This is a re-gerrit of the original gerrit
merged in Ia8ad3efe3b50ce75a3bed1e020e1b82acb5f2eda
Reverted due to ongoing issues.

Fixes: #5747
Change-Id: I2b57e76b817eed8f89457a2146b523a1cab656a8

4 years agoMerge "Implement Oracle SERIALIZABLE + real read of isolation level"
mike bayer [Wed, 9 Dec 2020 18:10:53 +0000 (18:10 +0000)] 
Merge "Implement Oracle SERIALIZABLE + real read of isolation level"

4 years agoImplement Oracle SERIALIZABLE + real read of isolation level
Mike Bayer [Wed, 9 Dec 2020 03:07:48 +0000 (22:07 -0500)] 
Implement Oracle SERIALIZABLE + real read of isolation level

There's some significant awkwardness in that we can't
read the level unless a transaction is started, which normally
does not occur unless DML is emitted.  The implementation
uses the local_transaction_id function to start a transaction.
It is not known what the performance impact of this might
have, however by default the function is called only once
on first connect and later only if the get_isolation_level()
method is used.

Fixes: #5755
Change-Id: I0453a6b0a49420826707f660931002ba2338fbf0

4 years agoMerge "Fixed compile for mssql dialect"
mike bayer [Wed, 9 Dec 2020 15:26:15 +0000 (15:26 +0000)] 
Merge "Fixed compile for mssql dialect"

4 years agoFixed compile for mssql dialect
Gord Thompson [Tue, 8 Dec 2020 20:23:02 +0000 (15:23 -0500)] 
Fixed compile for mssql dialect

Fixed string compilation when both mssql_include and mssql_where are used

Fixes: #5751
Closes: #5752
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5752
Pull-request-sha: aa57ad5d93cd69bf7728d864569c31c7e59b54fb

Change-Id: I1201170affd9911c252df5c9b841e538bb577085

4 years agoMerge "Implement `TypeEngine.as_generic`"
mike bayer [Wed, 9 Dec 2020 14:33:27 +0000 (14:33 +0000)] 
Merge "Implement `TypeEngine.as_generic`"

4 years agoRevert "Merge "add aiomysql support""
Mike Bayer [Wed, 9 Dec 2020 13:52:57 +0000 (08:52 -0500)] 
Revert "Merge "add aiomysql support""

This reverts commit 23343f87f3297ad31d7315ac0e5312db10ef7592, reversing
changes made to c5831b1abd98c46ef7eab7ee82ead18756aea112.

The crashes that occur in jenkins have not been solved and are
now impacting master.   I am not able to reproduce the failure,
including running on the CI machines directly, and a few runs
where I sat there for 20 minutes and watched, it didn't happen.
it is the ultimate heisenbug.

Additionally, there's a reference to "arraysize" that doesn't
exist in fetchmany() and there seem to be no tests that exercise
this for any DBAPI which is also a major bug to be fixed.

References: #5747

4 years agoImplement `TypeEngine.as_generic`
Gord Thompson [Mon, 7 Dec 2020 23:37:29 +0000 (18:37 -0500)] 
Implement `TypeEngine.as_generic`

Added :meth:`_types.TypeEngine.as_generic` to map dialect-specific types,
such as :class:`sqlalchemy.dialects.mysql.INTEGER`, with the "best match"
generic SQLAlchemy type, in this case :class:`_types.Integer`.  Pull
request courtesy Andrew Hannigan.

Abstract away how we check for "overridden methods" so it is more
clear what the intent is and that the methodology can be
independently tested.

Fixes: #5659
Closes: #5714
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5714
Pull-request-sha: 91afb9a0ba3bfa81a1ded80c025989213cf6e4eb

Change-Id: Ic54d6690ecc10dc69e6e72856d5620036cea472a

4 years agoMerge "add aiomysql support"
mike bayer [Tue, 8 Dec 2020 21:17:37 +0000 (21:17 +0000)] 
Merge "add aiomysql support"

4 years agoMerge "Detect non compatible execution in async mode"
mike bayer [Tue, 8 Dec 2020 18:04:25 +0000 (18:04 +0000)] 
Merge "Detect non compatible execution in async mode"

4 years agoDetect non compatible execution in async mode
Federico Caselli [Thu, 3 Dec 2020 22:53:47 +0000 (23:53 +0100)] 
Detect non compatible execution in async mode

The SQLAlchemy async mode now detects and raises an informative
error when an non asyncio compatible :term:`DBAPI` is used.
Using a standard ``DBAPI`` with async SQLAlchemy will cause
it to block like any sync call, interrupting the executing asyncio
loop.

Change-Id: I9aed87dc1b0df53e8cb2109495237038aa2cb2d4

4 years agoadd aiomysql support
Mike Bayer [Fri, 4 Dec 2020 21:26:44 +0000 (16:26 -0500)] 
add aiomysql support

Fixes: #5747
Change-Id: Ia8ad3efe3b50ce75a3bed1e020e1b82acb5f2eda

4 years agoMerge "Replace ``OrderedDict`` with a normal ``dict`` in python 3.7+"
mike bayer [Mon, 7 Dec 2020 22:43:02 +0000 (22:43 +0000)] 
Merge "Replace ``OrderedDict`` with a normal ``dict`` in python 3.7+"

4 years agoMerge "update docs that reference the deprecated `from_engine` inspection"
mike bayer [Mon, 7 Dec 2020 20:47:36 +0000 (20:47 +0000)] 
Merge "update docs that reference the deprecated `from_engine` inspection"

4 years agoReplace ``OrderedDict`` with a normal ``dict`` in python 3.7+
Federico Caselli [Wed, 2 Dec 2020 22:43:44 +0000 (23:43 +0100)] 
Replace ``OrderedDict`` with a normal ``dict`` in python 3.7+

References: #5735

Change-Id: I0a73f727fb6820d32eca590b1e8afbfe2872adb8

4 years agoMerge "fix non-ascii quotes in sqlite on update feature"
mike bayer [Mon, 7 Dec 2020 19:06:15 +0000 (19:06 +0000)] 
Merge "fix non-ascii quotes in sqlite on update feature"

4 years agofix non-ascii quotes in sqlite on update feature
Mike Bayer [Mon, 7 Dec 2020 18:40:48 +0000 (13:40 -0500)] 
fix non-ascii quotes in sqlite on update feature

Fixed a SQLite source file that had non-ascii characters inside of its
docstring without a source encoding, introduced within the "INSERT..ON
CONFLICT" feature, which would cause failures under Python 2.

Change-Id: Ie789d2ce554d24643a453b60bb11da9b69106c19

4 years agoupdate docs that reference the deprecated `from_engine` inspection
jonathan vanasco [Wed, 2 Dec 2020 19:42:02 +0000 (14:42 -0500)] 
update docs that reference the deprecated `from_engine` inspection

Change-Id: I8db8752722f3ac7c410b39970224204caa9d4b72

4 years agoPass through plain selectable to .alias()
Mike Bayer [Mon, 7 Dec 2020 15:08:06 +0000 (10:08 -0500)] 
Pass through plain selectable to .alias()

Fixed regression where creating an :class:`_orm.aliased` construct against
a plain selectable and including a name would raise an assertionerror.

Fixes: #5750
Change-Id: I98fbc7c7bd2c88f0600fc507275eb8b1bb76d8df

4 years agoAdd Optional type modifier to fields with default value of None in dataclass example... 5746/head
Michael Oliver [Fri, 4 Dec 2020 09:08:53 +0000 (09:08 +0000)] 
Add Optional type modifier to fields with default value of None in dataclass example. This keeps mypy/pep484 static type checkers happy

4 years agoindicate classically mapped relationship in the dataclass example
Mike Bayer [Thu, 3 Dec 2020 18:01:52 +0000 (13:01 -0500)] 
indicate classically mapped relationship in the dataclass example

Change-Id: Id1e3fb660c2aff107aa4a180ba565ee88fa6f56e
References: #5027

4 years agoMerge "Reflect decimal points in MariaDB non-quoted numeric defaults"
mike bayer [Thu, 3 Dec 2020 17:39:43 +0000 (17:39 +0000)] 
Merge "Reflect decimal points in MariaDB non-quoted numeric defaults"

4 years agoMerge "Fix documentation link in query with_for_update"
mike bayer [Thu, 3 Dec 2020 17:38:43 +0000 (17:38 +0000)] 
Merge "Fix documentation link in query with_for_update"

4 years agoReflect decimal points in MariaDB non-quoted numeric defaults
Mike Bayer [Thu, 3 Dec 2020 16:17:08 +0000 (11:17 -0500)] 
Reflect decimal points in MariaDB non-quoted numeric defaults

Fixed issue where reflecting a server default on MariaDB only that
contained a decimal point in the value would fail to be reflected
correctly, leading towards a reflected table that lacked any server
default.

Fixes: #5744
Change-Id: Ifc5960928685a906558ba84ed6f59eecb3b1c358

4 years agoMerge "Properly render ``cycle=False`` and ``order=False``"
mike bayer [Thu, 3 Dec 2020 15:08:42 +0000 (15:08 +0000)] 
Merge "Properly render ``cycle=False`` and ``order=False``"

4 years agocapitalize author name 5742/head
toh995 [Thu, 3 Dec 2020 02:28:55 +0000 (18:28 -0800)] 
capitalize author name

4 years agoFix documentation link in query with_for_update
Federico Caselli [Wed, 2 Dec 2020 21:09:59 +0000 (22:09 +0100)] 
Fix documentation link in query with_for_update

Change-Id: I4e9a97905d42686c911da81a25f023519328a8a3

4 years agomodernize contains_eager() docs
Mike Bayer [Wed, 2 Dec 2020 14:26:18 +0000 (09:26 -0500)] 
modernize contains_eager() docs

Along with other loader options that are likely
to require usage of populate_existing(), make sure
contains_eager() documentation makes it absolutely
clear that already-loaded collections are not overwritten.
consolidate contains_eager() documentation into the narrative docs.

Additionally, remove the "arbitrary statements" section, this is
not a useful case and seems to be left over.

Fixes: #5740
Change-Id: I10e320882990f511eefebcc88cfcc2277e553b50

4 years agoMerge remote-tracking branch 'origin/pr/5733' into master
Mike Bayer [Wed, 2 Dec 2020 03:48:40 +0000 (22:48 -0500)] 
Merge remote-tracking branch 'origin/pr/5733' into master

Change-Id: I7ae5498618fbe9e63440a59243a31f2633777bbd

4 years agoMake sure asyncpgfallback has __slots__
Mike Bayer [Wed, 2 Dec 2020 01:55:06 +0000 (20:55 -0500)] 
Make sure asyncpgfallback has __slots__

the test suite failed to find that we started accessing
a non-existent slot "_isolation_setting" added by me in
9b779611f9, as the test suite makes use of the
AsyncAdaptFallback_asyncpg_connection subclass, which didn't
include __slots__ and therefore didn't catch that
_isolation_setting wasn't added to slots.

Fixes: #5739
Change-Id: Ibbbedc2ee0f1d1c9d91ba7898d755812deccb380

4 years agoProperly render ``cycle=False`` and ``order=False``
Federico Caselli [Tue, 1 Dec 2020 22:47:13 +0000 (23:47 +0100)] 
Properly render ``cycle=False`` and ``order=False``

These get rendered as ``NO CYCLE`` and ``NO ORDER`` in
:class:`_sql.Sequence` and :class:`_sql.Identity` objects.

Fixes: #5738
Change-Id: Ia9ccb5481a104cb32d3b517e99efd5e730c84946

4 years agoPass along other keyword args in _EventsHold.populate
Mike Bayer [Tue, 1 Dec 2020 21:03:35 +0000 (16:03 -0500)] 
Pass along other keyword args in _EventsHold.populate

Fixed bug involving the ``restore_load_context`` option of ORM events such
as :meth:`_orm.InstanceEvents.load` such that the flag would not be carried
along to subclasses which were mapped after the event handler were first
established.

Fixes: #5737
Change-Id: Ie65fbeac7ab223d24993cff0b34094d4928ff113