]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoFixed reflection of identity columns in tables
Federico Caselli [Thu, 25 Mar 2021 20:08:21 +0000 (21:08 +0100)] 
Fixed reflection of identity columns in tables
with mixed case names in PostgreSQL.

Fixes: #6129
Change-Id: I50480cec03fcb44a668c9b0f9c72950803b771d9

4 years agoMerge "support as_declarative, as_declarative_base"
mike bayer [Thu, 25 Mar 2021 19:58:38 +0000 (19:58 +0000)] 
Merge "support as_declarative, as_declarative_base"

4 years agosupport as_declarative, as_declarative_base
Mike Bayer [Tue, 23 Mar 2021 22:49:28 +0000 (18:49 -0400)] 
support as_declarative, as_declarative_base

Added support for the Mypy extension to correctly interpret a declarative
base class that's generated using the :func:`_orm.as_declarative` function
as well as the :meth:`_orm.registry.as_declarative_base` method.

Change-Id: I227f4abebe157a7df3f8772893bbea6669cc8555

4 years agoMerge "Allow dropping a schema with a sequence shared by more than one table."
mike bayer [Thu, 25 Mar 2021 15:28:32 +0000 (15:28 +0000)] 
Merge "Allow dropping a schema with a sequence shared by more than one table."

4 years agodon't rely on pk-only group_by
Mike Bayer [Thu, 25 Mar 2021 14:37:12 +0000 (10:37 -0400)] 
don't rely on pk-only group_by

Fixed the test test_aliased_stmt_includes_unnamed_fn
recently added in c1c999c01d to include the additional
column in the GROUP BY statement, allowing this statement
to succeed on SQL Server which seems to not support "group by pk only"
syntax.

Change-Id: I42184d77c9017ebdb76ac5a9ae1f8128561243ec

4 years agoAccept **kw in annotated._clone() method
Mike Bayer [Thu, 25 Mar 2021 12:40:16 +0000 (08:40 -0400)] 
Accept **kw in annotated._clone() method

Fixed bug where combinations of the new "relationship with criteria"
feature could fail in conjunction with features that make use of the new
"lambda SQL" feature, including loader strategies such as selectinload and
lazyload, for more complicated scenarios such as polymorphic loading.

Fixes: #6131
Change-Id: I915dead6596866ae5fd1a7f593a90bce4b61d1af

4 years agoMerge "Use class-local metadata for declarative base"
mike bayer [Thu, 25 Mar 2021 11:39:13 +0000 (11:39 +0000)] 
Merge "Use class-local metadata for declarative base"

4 years agoUse class-local metadata for declarative base
Mike Bayer [Wed, 24 Mar 2021 21:43:06 +0000 (17:43 -0400)] 
Use class-local metadata for declarative base

Fixed regression where the ``.metadata`` attribute on a per class level
would not be honored, breaking the use case of per-class-hierarchy
:class:`.schema.MetaData` for abstract declarative classes and mixins.

Fixes: #6128
Change-Id: I5c15436b5c5171105dc1a0192fa744daf79a344d

4 years agoMerge "Repair pysqlcipher and use sqlcipher3"
mike bayer [Thu, 25 Mar 2021 00:25:46 +0000 (00:25 +0000)] 
Merge "Repair pysqlcipher and use sqlcipher3"

4 years agoMerge "Restore ResultProxy name to sqlalchemy.engine"
mike bayer [Wed, 24 Mar 2021 23:07:51 +0000 (23:07 +0000)] 
Merge "Restore ResultProxy name to sqlalchemy.engine"

4 years agoRepair pysqlcipher and use sqlcipher3
Mike Bayer [Wed, 24 Mar 2021 15:33:04 +0000 (11:33 -0400)] 
Repair pysqlcipher and use sqlcipher3

The ``pysqlcipher`` dialect now imports the ``sqlcipher3`` module
for Python 3 by default.    Regressions have been repaired such that
the connection routine was not working.

To better support the post-connection steps of the pysqlcipher
dialect, a new hook Dialect.on_connect_url() is added, which
supersedes Dialect.on_connect() and is passed the URL object.
The dialect now pulls the passphrase and other cipher args
from the URL directly without including them in the
"connect" args.  This will allow any user-defined extensibility
to connecting to work as it would for other dialects.

The commit also builds upon the extended routines in
sqlite/provisioning.py to better support running tests against
multiple simultaneous SQLite database files.  Additionally enables
backend for test_sqlite which was skipping everything
for aiosqlite too, fortunately everything there is passing.

Fixes: #5848
Change-Id: I43f53ebc62298a84a4abe149e1eb699a027b7915

4 years agoMerge "Support __visit_name__ on PropComparator to work in cloning"
mike bayer [Wed, 24 Mar 2021 19:30:06 +0000 (19:30 +0000)] 
Merge "Support __visit_name__ on PropComparator to work in cloning"

4 years agoSupport __visit_name__ on PropComparator to work in cloning
Mike Bayer [Wed, 24 Mar 2021 16:15:53 +0000 (12:15 -0400)] 
Support __visit_name__ on PropComparator to work in cloning

Repaired support so that the :meth:`_sql.Select.params` method can work
correctly with a :class:`_sql.Select` object that includes joins across ORM
relationship structures, which is a new feature in 1.4.

Fixes: #6124
Change-Id: Ia92fc33c3acbe66910e9e3bf00af9100de19b2b8

4 years agoMerge "Add support for aiosqlite"
mike bayer [Wed, 24 Mar 2021 16:52:07 +0000 (16:52 +0000)] 
Merge "Add support for aiosqlite"

4 years agoopen up window functions (ha ha) for mysql / mariadb
Mike Bayer [Wed, 24 Mar 2021 16:00:16 +0000 (12:00 -0400)] 
open up window functions (ha ha) for mysql / mariadb

MySQL 8 and MariaDB 10.2 support window functions so this
should be turned on.

Change-Id: Ic1fdd328f1f0def7dfc8451385c16ea81902074c

4 years agoAdd support for aiosqlite
Federico Caselli [Sat, 6 Feb 2021 14:17:20 +0000 (15:17 +0100)] 
Add support for aiosqlite

Added support for the aiosqlite database driver for use with the
SQLAlchemy asyncio extension.

Fixes: #5920
Change-Id: Id11a320516a44e886a6f518d2866a0f992413e55

4 years agoRestore ResultProxy name to sqlalchemy.engine
Mike Bayer [Tue, 23 Mar 2021 21:51:34 +0000 (17:51 -0400)] 
Restore ResultProxy name to sqlalchemy.engine

Fixes: #6118
Fixes: #6119
Change-Id: I7aad2be6572ad6d0bf982f4d6dc63a71485d73fa

4 years agoMerge "Use compat.exec_()"
mike bayer [Tue, 23 Mar 2021 18:48:56 +0000 (18:48 +0000)] 
Merge "Use compat.exec_()"

4 years agoMerge "Remove internal use of string attr in loader option"
mike bayer [Tue, 23 Mar 2021 18:28:33 +0000 (18:28 +0000)] 
Merge "Remove internal use of string attr in loader option"

4 years agoUse compat.exec_()
Martin Häcker [Tue, 23 Mar 2021 15:46:18 +0000 (11:46 -0400)] 
Use compat.exec_()

Fixed a bug where python 2.7.5 (default on CentOS 7) wasn't able to import
sqlalchemy, because on this version of Python ``exec "statement"`` and
``exec("statement")`` do not behave the same way.  The compatibility
``exec_()`` function was used instead.

Fixes: #6069
Closes: #6112
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6112
Pull-request-sha: 4e951f9278eb462d1432a92b7bad93b973e4e2a5

Change-Id: I34e00250e874368e83c3e992be80e989a3c4f054

4 years agoMerge "Adjust derivation rules for table vs. subquery against a join"
mike bayer [Tue, 23 Mar 2021 17:48:07 +0000 (17:48 +0000)] 
Merge "Adjust derivation rules for table vs. subquery against a join"

4 years agoRemove internal use of string attr in loader option
Mike Bayer [Tue, 23 Mar 2021 02:56:36 +0000 (22:56 -0400)] 
Remove internal use of string attr in loader option

Fixed issue where a "removed in 2.0" warning were generated internally by
the relationship loader mechanics.

This changeset started the effort of converting all string usage
in the test suite, however this is a much longer job as the
use of strings in loader options is widespread.  In particular
I'm not totally comfortable with strings not being accepted
in obvious spots like Load(User).load_only("x", "y", "z"), which
points to a new string expecting functionality that's not
what's there now.  However at the moment it seems like we need
to continue removing all support for strings and then figure out
"immediate strings from an explicit class" later.

Fixes: #6115
Change-Id: I6b314d135d2bc049fd66500914b772c1fe60b5b3

4 years agoAdjust derivation rules for table vs. subquery against a join
Mike Bayer [Tue, 16 Mar 2021 23:46:40 +0000 (19:46 -0400)] 
Adjust derivation rules for table vs. subquery against a join

Fixed bug where ORM queries using a correlated subquery in conjunction with
:func:`_orm.column_property` would fail to correlate correctly to an
enclosing subquery or to a CTE when :meth:`_sql.Select.correlate_except`
were used in the property to control correlation, in cases where the
subquery contained the same selectables as ones within the correlated
subquery that were intended to not be correlated.

This is achieved by adding a limiting factor to ClauseAdapter
which is to explicitly pass the selectables we will be adapting
"from", which is then used by AliasedClass to limit "from"
to the mappers represented by the AliasedClass.

This did cause one test where an alias for a contains_eager()
was missing to suddenly fail, and the test was corrected, however
there may be some very edge cases like that one where the tighter
criteria causes an existing use case that's relying on the more
liberal aliasing to require modifications.

Fixes: #6060
Change-Id: I8342042641886e1a220beafeb94fe45ea7aadb33

4 years agowarn / document for Query.with_polymorphic() with with_loader_criteria()
Mike Bayer [Tue, 23 Mar 2021 14:23:23 +0000 (10:23 -0400)] 
warn / document for Query.with_polymorphic() with with_loader_criteria()

These are illustrated as not working in #6111.  As this is
a highly complex and legacy method, encourage users to
migrate off of it before using with_loader_criteria().

Fixes: #6111
Change-Id: I63c8187020c631d83259ea2200b66eabf74a0d0d

4 years agoadd missing changelog
Mike Bayer [Tue, 23 Mar 2021 13:27:46 +0000 (09:27 -0400)] 
add missing changelog

changelog was missing from a782160de2e66ad6f6cb2630d

Change-Id: Ibca54a4ab6145e7f96b9790574966d8c21598c88

Fixes: #6109
4 years agoMerge remote-tracking branch 'origin/pr/6110'
Mike Bayer [Mon, 22 Mar 2021 16:58:05 +0000 (12:58 -0400)] 
Merge remote-tracking branch 'origin/pr/6110'

Change-Id: I59db5f0ff57b2df07d9cd9c4582db3ac34f42dc8

4 years agoMerge remote-tracking branch 'origin/pr/6108'
Mike Bayer [Mon, 22 Mar 2021 16:18:32 +0000 (12:18 -0400)] 
Merge remote-tracking branch 'origin/pr/6108'

Change-Id: I033fe688b00db6202a24fd8fbc050ebe8f06b6aa

4 years agoAdd support for Boolean, Enum
Mike Bayer [Sun, 21 Mar 2021 21:10:18 +0000 (17:10 -0400)] 
Add support for Boolean, Enum

Fixed bug in Mypy plugin where the Python type detection
for the :class:`_sqltypes.Boolean` column type would produce
an exception; additionally implemented support for :class:`_sqltypes.Enum`,
including detection of a string-based enum vs. use of Python ``enum.Enum``.

Fixes: #6109
Change-Id: I25e546ea2f50d90be2d6fec303976d82849a3d31

4 years agoearler -> earlier 6110/head
mgjo5899 [Sun, 21 Mar 2021 20:40:44 +0000 (15:40 -0500)] 
earler -> earlier

4 years ago✏️ Fix minor typos in "Migrating to SQLAlchemy 2.0" 6108/head
Sebastián Ramírez [Sun, 21 Mar 2021 19:34:37 +0000 (20:34 +0100)] 
✏️ Fix minor typos in "Migrating to SQLAlchemy 2.0"

4 years agoMerge "fix __all__"
mike bayer [Sun, 21 Mar 2021 16:50:48 +0000 (16:50 +0000)] 
Merge "fix __all__"

4 years agofix __all__
Mike Bayer [Sat, 20 Mar 2021 18:34:10 +0000 (14:34 -0400)] 
fix __all__

sqlalchemy.engine had an oddly restrictive __all__ for some reason.
Add missing symbols to session.__all__

Change-Id: I017fa1c2a93f559f2ccc366f88660266c50e9ca6

4 years agoVersion 1.4.3 placeholder
Mike Bayer [Fri, 19 Mar 2021 23:10:55 +0000 (19:10 -0400)] 
Version 1.4.3 placeholder

4 years agoAllow dropping a schema with a sequence shared by more than one table.
Federico Caselli [Thu, 18 Mar 2021 22:38:09 +0000 (23:38 +0100)] 
Allow dropping a schema with a sequence shared by more than one table.

Fixes: #6071
Change-Id: I5c4483abf075622cccb73cb4c4f8c873174b4e32

4 years ago- 1.4.2 rel_1_4_2
Mike Bayer [Fri, 19 Mar 2021 22:59:47 +0000 (18:59 -0400)] 
- 1.4.2

4 years agoMerge "Import inspector in engine init"
mike bayer [Fri, 19 Mar 2021 22:58:39 +0000 (22:58 +0000)] 
Merge "Import inspector in engine init"

4 years agoImport inspector in engine init
Federico Caselli [Fri, 19 Mar 2021 21:37:07 +0000 (22:37 +0100)] 
Import inspector in engine init

Change-Id: I7e57c472869fdf68e2313ed5642272fc700390c9

4 years agoempty deferred mapper configs at start of deferred reflection test
Mike Bayer [Fri, 19 Mar 2021 21:57:58 +0000 (17:57 -0400)] 
empty deferred mapper configs at start of deferred reflection test

Change-Id: I905899281c478cbb7b73e1b31e97716372498157

4 years agoMerge "Add documentation for connecting to Azure SQL instances with managed identities"
mike bayer [Fri, 19 Mar 2021 20:13:15 +0000 (20:13 +0000)] 
Merge "Add documentation for connecting to Azure SQL instances with managed identities"

4 years agoUse tuple for function package names
Mike Bayer [Fri, 19 Mar 2021 18:52:59 +0000 (14:52 -0400)] 
Use tuple for function package names

Fixed issue where using a ``func`` that includes dotted packagenames would
fail to be cacheable by the SQL caching system due to a Python list of
names that needed to be a tuple.

Fixes: #6101
Change-Id: I1d4bb5bf230b83596c59b6a04aa498f18ecd9613

4 years agoMerge "support callable mapped attributes in dataclass mixins"
mike bayer [Fri, 19 Mar 2021 18:46:01 +0000 (18:46 +0000)] 
Merge "support callable mapped attributes in dataclass mixins"

4 years agosupport callable mapped attributes in dataclass mixins
Mike Bayer [Fri, 19 Mar 2021 16:55:43 +0000 (12:55 -0400)] 
support callable mapped attributes in dataclass mixins

Added support for the :class:`_orm.declared_attr` object to work in the
context of dataclass fields.

Fixes: #6100
Change-Id: Ifaf4a6482c866d6cfee99d8bc2c6294d923460d7

4 years agoCorrect for coercion from list args to positional for case
Mike Bayer [Fri, 19 Mar 2021 14:34:31 +0000 (10:34 -0400)] 
Correct for coercion from list args to positional for case

Fixed regression in the :func:`_sql.case` construct, where the "dictionary"
form of argument specification failed to work correctly if it were passed
positionally, rather than as a "whens" keyword argument.

Fixes: #6097
Change-Id: I4138f54309a08c8e4e63cfafc211176e0b9a76c7

4 years agoMerge "Deannoate functions before matching .__class__"
mike bayer [Fri, 19 Mar 2021 12:23:48 +0000 (12:23 +0000)] 
Merge "Deannoate functions before matching .__class__"

4 years agoMerge "Ensure ClauseAdapter treats FunctionElement as a ColumnElement"
mike bayer [Fri, 19 Mar 2021 05:23:26 +0000 (05:23 +0000)] 
Merge "Ensure ClauseAdapter treats FunctionElement as a ColumnElement"

4 years agoDeannoate functions before matching .__class__
Mike Bayer [Fri, 19 Mar 2021 05:18:06 +0000 (01:18 -0400)] 
Deannoate functions before matching .__class__

Fixed regression where the SQL compilation of a :class:`.Function` would
not work correctly if the object had been "annotated", which is an internal
memoization process used mostly by the ORM. In particular it could affect
ORM lazy loads which make greater use of this feature in 1.4.

Fixes: #6095
Change-Id: I7a6527df651f440a04d911ba78ee0b0dd4436dcd

4 years agoEnsure ClauseAdapter treats FunctionElement as a ColumnElement
Mike Bayer [Thu, 18 Mar 2021 23:34:32 +0000 (19:34 -0400)] 
Ensure ClauseAdapter treats FunctionElement as a ColumnElement

Fixed regression where use of an unnamed SQL expression such as a SQL
function would raise a column targeting error if the query itself were
using joinedload for an entity and was also being wrapped in a subquery by
the joinedload eager loading process.

Fixes: #6086
Change-Id: I22cf4d6974685267c4f903bd7639be8271c6c1ef

4 years agoMerge "repair legacy_last_joined_entity for no onclause"
mike bayer [Fri, 19 Mar 2021 01:45:31 +0000 (01:45 +0000)] 
Merge "repair legacy_last_joined_entity for no onclause"

4 years agorepair legacy_last_joined_entity for no onclause
Mike Bayer [Thu, 18 Mar 2021 21:46:24 +0000 (17:46 -0400)] 
repair legacy_last_joined_entity for no onclause

Fixed regression where the :meth:`_orm.Query.filter_by` method would fail
to locate the correct source entity if the :meth:`_orm.Query.join` method
had been used targeting an entity without any kind of ON clause.

Fixes: #6092
Change-Id: I38d9099844f842f314c6673bd922467242409cdb

4 years agoMerge "check for MemberExpr looking for column argument"
mike bayer [Thu, 18 Mar 2021 21:14:53 +0000 (21:14 +0000)] 
Merge "check for MemberExpr looking for column argument"

4 years agocheck for MemberExpr looking for column argument
Mike Bayer [Thu, 18 Mar 2021 19:26:05 +0000 (15:26 -0400)] 
check for MemberExpr looking for column argument

Fixed issue in MyPy extension which crashed on detecting the type of a
:class:`.Column` if the type were given with a module prefix like
``sa.Integer()``.

Fixes: sqlalchemy/sqlalchemy2-stubs/#2
Change-Id: I71f53a6ced501ae144e28ce255cf3f50ea2b2e84

4 years agoMerge "Adjust dataclass rules to account for field w/ default"
mike bayer [Thu, 18 Mar 2021 19:47:02 +0000 (19:47 +0000)] 
Merge "Adjust dataclass rules to account for field w/ default"

4 years agoAdjust dataclass rules to account for field w/ default
Mike Bayer [Thu, 18 Mar 2021 19:07:03 +0000 (15:07 -0400)] 
Adjust dataclass rules to account for field w/ default

Fixed issue in new ORM dataclasses functionality where dataclass fields on
an abstract base or mixin that contained column or other mapping constructs
would not be mapped if they also included a "default" key within the
dataclasses.field() object.

Fixes: #6093
Change-Id: I628086ceb48ab1dd0702f239cd12be74074f58f1

4 years agoMerge "Raise at Core / ORM concrete inh level for label overlap"
mike bayer [Thu, 18 Mar 2021 18:44:24 +0000 (18:44 +0000)] 
Merge "Raise at Core / ORM concrete inh level for label overlap"

4 years agoAdd documentation for connecting to Azure SQL instances with managed identities
Alex Lowe [Mon, 15 Mar 2021 18:50:45 +0000 (14:50 -0400)] 
Add documentation for connecting to Azure SQL instances with managed identities

Fixes: #6031
Closes: #6032
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6032
Pull-request-sha: 00abfffd198a4c0e81bb5d15219dd4e40670ce94

Change-Id: Id67b21e6d2cc93f88d78e291e3bc8f87463377a6

4 years agoRaise at Core / ORM concrete inh level for label overlap
Mike Bayer [Thu, 18 Mar 2021 15:59:16 +0000 (11:59 -0400)] 
Raise at Core / ORM concrete inh level for label overlap

Fixed regression where the :class:`.ConcreteBase` would fail to map at all
when a mapped column name overlapped with the discriminator column name,
producing an assertion error. The use case here did not function correctly
in 1.3 as the polymorphic union would produce a query that ignored the
discriminator column entirely, while emitting duplicate column warnings. As
1.4's architecture cannot easily reproduce this essentially broken behavior
of 1.3 at the ``select()`` level right now, the use case now raises an
informative error message instructing the user to use the
``.ConcreteBase._concrete_discriminator_name`` attribute to resolve the
conflict. To assist with this configuration,
``.ConcreteBase._concrete_discriminator_name`` may be placed on the base
class only where it will be automatically used by subclasses; previously
this was not the case.

Fixes: #6090
Change-Id: I8b7d01e4c9ea0dc97f30b8cd658b3505b24312a7

4 years agoMerge "Restore Query.selectable"
mike bayer [Thu, 18 Mar 2021 16:04:45 +0000 (16:04 +0000)] 
Merge "Restore Query.selectable"

4 years agoRestore Query.selectable
Mike Bayer [Thu, 18 Mar 2021 14:27:28 +0000 (10:27 -0400)] 
Restore Query.selectable

Fixes: #6088
Change-Id: Id014fbd081c0659d1939d059779780798cc8c1dd

4 years agoRename column name that used a reserved word
Federico Caselli [Wed, 17 Mar 2021 20:28:44 +0000 (21:28 +0100)] 
Rename column name that used a reserved word

Rename column name used by a reflection query that used
a reserved word in some postgresql compatible databases.

Fixes: #6082
Change-Id: Ie81983316b72601a2e34543fa5ee95371e68aaf5

4 years agofix typo
Mike Bayer [Wed, 17 Mar 2021 19:07:50 +0000 (15:07 -0400)] 
fix typo

Change-Id: I7afb81cfa4f8041181c24666bb9acd71ff45692b

4 years agoVersion 1.4.2 placeholder
Mike Bayer [Wed, 17 Mar 2021 18:59:43 +0000 (14:59 -0400)] 
Version 1.4.2 placeholder

4 years ago- 1.4.1 rel_1_4_1
Mike Bayer [Wed, 17 Mar 2021 18:52:41 +0000 (14:52 -0400)] 
- 1.4.1

4 years agochangelog updates
Mike Bayer [Wed, 17 Mar 2021 18:50:27 +0000 (14:50 -0400)] 
changelog updates

Change-Id: I16aa216023b295501c675de420a722178b2121fb

4 years agoMerge remote-tracking branch 'origin/pr/6078'
Mike Bayer [Wed, 17 Mar 2021 18:32:21 +0000 (14:32 -0400)] 
Merge remote-tracking branch 'origin/pr/6078'

Change-Id: Ie02f8201f712b3fe673d4f15c5d82cab8395a87b

4 years agoMerge "Use explicit names for mapper _get_clause parameters"
mike bayer [Wed, 17 Mar 2021 18:28:30 +0000 (18:28 +0000)] 
Merge "Use explicit names for mapper _get_clause parameters"

4 years agoUse explicit names for mapper _get_clause parameters
Mike Bayer [Wed, 17 Mar 2021 15:04:58 +0000 (11:04 -0400)] 
Use explicit names for mapper _get_clause parameters

Fixed a critical regression in the relationship lazy loader where the SQL
criteria used to fetch a related many-to-one object could go stale in
relation to other memoized structures within the loader if the mapper had
configuration changes, such as can occur when mappers are late configured
or configured on demand, producing a comparison to None and returning no
object. Huge thanks to Alan Hamlett for their help tracking this down late
into the night.

The primary change is that mapper._get_clause() uses a fixed name
for its bound parameters, which is memoized under a lambda statement
in the case of many-to-one lazy loading.  This has implications for some other
logic namely the .compare() used by loader strategies to determine
use_get needed to be adjusted.

This change also repairs the lambda module's behavior of removing
the "required" flag from bound parameters, which caused this issue
to also fail silently rather than issuing an error for a required
bind parameter.

Fixes: #6055
Change-Id: I19e1aba9207a049873e0f13c19bad7541e223cfd

4 years agoMerge "Provide special row proxies for count and index"
mike bayer [Wed, 17 Mar 2021 17:02:21 +0000 (17:02 +0000)] 
Merge "Provide special row proxies for count and index"

4 years agowork around formatting issue with the :param: tag
Mike Bayer [Wed, 17 Mar 2021 16:39:27 +0000 (12:39 -0400)] 
work around formatting issue with the :param: tag

Fixes: #6075
Change-Id: Ia3f6109e3a038ddcf513d3e887b4cad0f776f0a6

4 years agoMerge "Ensure entity or None returned from _entity_from_pre_ent_zero()"
mike bayer [Wed, 17 Mar 2021 16:31:19 +0000 (16:31 +0000)] 
Merge "Ensure entity or None returned from _entity_from_pre_ent_zero()"

4 years agoProvide special row proxies for count and index
Mike Bayer [Wed, 17 Mar 2021 12:39:45 +0000 (08:39 -0400)] 
Provide special row proxies for count and index

The Python ``namedtuple()`` has the behavior such that the names ``count``
and ``index`` will be served as tuple values if the named tuple includes
those names; if they are absent, then their behavior as methods of
``collections.abc.Sequence`` is maintained. Therefore the
:class:`_result.Row` and :class:`_result.LegacyRow` classes have been fixed
so that they work in this same way, maintaining the expected behavior for
database rows that have columns named "index" or "count".

Fixes: #6074
Change-Id: I49a093da02f33f231d22ed5999c09fcaa3a68601

4 years agoFix typo in sqlalchemy2-stubs pypi link 6078/head
Charles-Axel Dein [Wed, 17 Mar 2021 13:26:24 +0000 (14:26 +0100)] 
Fix typo in sqlalchemy2-stubs pypi link

4 years agoEnsure entity or None returned from _entity_from_pre_ent_zero()
Mike Bayer [Wed, 17 Mar 2021 12:59:09 +0000 (08:59 -0400)] 
Ensure entity or None returned from _entity_from_pre_ent_zero()

Fixed regression where the :meth:`_orm.Query.exists` method would fail to
create an expression if the entity list of the :class:`_orm.Query` were
an arbitrary SQL column expression.

Fixes: #6076
Change-Id: I292dd5f527b2cbc1b76ca765b4ea321ef8535709

4 years agoMerge "Fix typo in Session.identity_key"
mike bayer [Wed, 17 Mar 2021 03:21:58 +0000 (03:21 +0000)] 
Merge "Fix typo in Session.identity_key"

4 years agoAdded back ``items`` and ``values`` to ``ColumnCollection`` class.
Federico Caselli [Tue, 16 Mar 2021 22:56:28 +0000 (23:56 +0100)] 
Added back ``items`` and ``values`` to ``ColumnCollection`` class.

Fixes: #6068
Change-Id: Idb42c864e17c02d7b89cffa667dcf853ec93e5c2

4 years agoMerge "turn off eager configure_mappers() outside of Query, Load"
mike bayer [Tue, 16 Mar 2021 22:38:45 +0000 (22:38 +0000)] 
Merge "turn off eager configure_mappers() outside of Query, Load"

4 years agoFix typo in Session.identity_key
Mike Bayer [Tue, 16 Mar 2021 22:32:30 +0000 (18:32 -0400)] 
Fix typo in Session.identity_key

Fixed regression in :meth:`_orm.Session.identity_key`, including that the
method and related methods were not covered by any unit test as well as
that the method contained a typo preventing it from functioning correctly.

Fixes: #6067
Change-Id: I1a84f9ed095c4226d57eef1c46996601dc2f1eaa

4 years agoRemove unneeded import
Mike Bayer [Tue, 16 Mar 2021 22:16:17 +0000 (18:16 -0400)] 
Remove unneeded import

this import forgot to get removed from
Ia7519ac4371a635f05ac69a3a4d0f4e6d2f04cad , removing it
in post-production.

We will need "enum" soon enough when we go to Python 3 only.

Change-Id: I28297c2ed9f87fd0841076b861b8eeb610754dc3

4 years agoMerge "CAST the elements in ARRAYs when using psycopg2"
mike bayer [Tue, 16 Mar 2021 22:14:38 +0000 (22:14 +0000)] 
Merge "CAST the elements in ARRAYs when using psycopg2"

4 years agoturn off eager configure_mappers() outside of Query, Load
Mike Bayer [Tue, 16 Mar 2021 21:59:44 +0000 (17:59 -0400)] 
turn off eager configure_mappers() outside of Query, Load

Fixed regression where producing a Core expression construct such as
:func:`_sql.select` using ORM entities would eagerly configure the mappers,
in an effort to maintain compatibility with the :class:`_orm.Query` object
which necessarily does this to support many backref-related legacy cases.
However, core :func:`_sql.select` constructs are also used in mapper
configurations and such, and to that degree this eager configuration is
more of an inconvenience, so eager configure has been disabled for the
:func:`_sql.select` and other Core constructs in the absence of ORM loading
types of functions such as :class:`_orm.Load`.

The change maintains the behavior of :class:`_orm.Query` so that backwards
compatibility is maintained. However, when using a :func:`_sql.select` in
conjunction with ORM entities, a "backref" that isn't explicitly placed on
one of the classes until mapper configure time won't be available unless
:func:`_orm.configure_mappers` or the newer :func:`_orm.registry.configure`
has been called elsewhere. Prefer using
:paramref:`_orm.relationship.back_populates` for more explicit relationship
configuration which does not have the eager configure requirement.

Fixes: #6066
Change-Id: I7a953ddcc189471fbac63c97c51ab8956f64012e

4 years agoMerge "Turn off pyodbc setinputsizes() by default"
mike bayer [Tue, 16 Mar 2021 20:39:30 +0000 (20:39 +0000)] 
Merge "Turn off pyodbc setinputsizes() by default"

4 years agoMerge "Early-assign Base.registry to a private name"
mike bayer [Tue, 16 Mar 2021 20:38:48 +0000 (20:38 +0000)] 
Merge "Early-assign Base.registry to a private name"

4 years agoReword deprecation message for Connection.run_callable()
Mike Bayer [Tue, 16 Mar 2021 19:32:22 +0000 (15:32 -0400)] 
Reword deprecation message for Connection.run_callable()

based on feedback at
https://github.com/sqlalchemy/sqlalchemy/commit/00b5c10846e800304caa86549ab9da373b42fa5d#r48321551

Change-Id: Ibdf4b4fb86af0b8f282a7866883837915ea2934e

4 years agoEarly-assign Base.registry to a private name
Mike Bayer [Tue, 16 Mar 2021 19:03:22 +0000 (15:03 -0400)] 
Early-assign Base.registry to a private name

Fixed bug where user-mapped classes that contained an attribute named
"registry" would cause conflicts with the new registry-based mapping system
when using :class:`.DeclarativeMeta`. While the attribute remains
something that can be set explicitly on a declarative base to be
consumed by the metaclass, once located it is placed under a private
class variable so it does not conflict with future subclasses that use
the same name for other purposes.

Fixes: #6054
Change-Id: I1f2e04b0d74c493e7e90eadead4e861d8960a794

4 years agoTurn off pyodbc setinputsizes() by default
Mike Bayer [Tue, 16 Mar 2021 15:23:07 +0000 (11:23 -0400)] 
Turn off pyodbc setinputsizes() by default

Fixed regression where a new setinputsizes() API that's available for
pyodbc was enabled, which is apparently incompatible with pyodbc's
fast_executemany() mode in the absence of more accurate typing information,
which as of yet is not fully implemented or tested. The pyodbc dialect and
connector has been modified so that setinputsizes() is not used at all
unless the parameter ``use_setinputsizes`` is passed to the dialect, e.g.
via :func:`_sa.create_engine`, at which point its behavior can be
customized using the :meth:`.DialectEvents.do_setinputsizes` hook.

Fixes: #6058
Change-Id: I99c2be3a5cd76fc3e490d10865292ed85ffc23ae

4 years agoAdd missing changelog file
Mike Bayer [Tue, 16 Mar 2021 15:26:52 +0000 (11:26 -0400)] 
Add missing changelog file

This file was missing for #6052

Fixes: #6052
Change-Id: Ic0543e633a9f9dfbae08f1636437c543e2e0cd40

4 years agofix 1.4 migration notes about sqlite implementation of regexp_match() 6057/head
Sebastian Bank [Tue, 16 Mar 2021 08:18:02 +0000 (09:18 +0100)] 
fix 1.4 migration notes about sqlite implementation of regexp_match()

- follow-up ec264a5a2c810394ee4ebd7a78f83fc0ea785c1f

4 years agoCAST the elements in ARRAYs when using psycopg2
Federico Caselli [Wed, 10 Mar 2021 22:54:52 +0000 (23:54 +0100)] 
CAST the elements in ARRAYs when using psycopg2

Adjusted the psycopg2 dialect to emit an explicit PostgreSQL-style cast for
bound parameters that contain ARRAY elements. This allows the full range of
datatypes to function correctly within arrays. The asyncpg dialect already
generated these internal casts in the final statement. This also includes
support for array slice updates as well as the PostgreSQL-specific
:meth:`_postgresql.ARRAY.contains` method.

Fixes: #6023
Change-Id: Ia7519ac4371a635f05ac69a3a4d0f4e6d2f04cad

4 years agoMove enable_eagerloads(False) out of _from_self() into count()
Mike Bayer [Tue, 16 Mar 2021 00:01:23 +0000 (20:01 -0400)] 
Move enable_eagerloads(False) out of _from_self() into count()

Fixed regression where calling upon :meth:`_orm.Query.count` in conjunction
with a loader option such as :func:`_orm.joinedload` would fail to ignore
the loader option. This is a behavior that has always been very specific to
the :meth:`_orm.Query.count` method; an error is normally raised if a given
:class:`_orm.Query` has options that don't apply to what it is returning.

Specifically, the call to enable_eagerloads(False) inside of
_from_self() is not needed as loader options are now not invoked
for subqueries.  Instead, set enable_eagerloads(False) in the
count() method itself, so that these options won't be considered
in this specific case.

Fixes: #6052
Change-Id: I0059ed3fb06156ef4116fd015cbef6f89808e8ef

4 years agoClarify LegacyRow / Row verbiage
Mike Bayer [Mon, 15 Mar 2021 23:34:49 +0000 (19:34 -0400)] 
Clarify LegacyRow / Row verbiage

Change-Id: I40db17216f09757ff49e87297ff9dd8aae18ed97
References: #6051

4 years agoVersion 1.4.1 placeholder
Mike Bayer [Mon, 15 Mar 2021 16:59:35 +0000 (12:59 -0400)] 
Version 1.4.1 placeholder

4 years ago- 1.4.0 rel_1_4_0
Mike Bayer [Mon, 15 Mar 2021 15:58:11 +0000 (11:58 -0400)] 
- 1.4.0

4 years agodocumentation updates
Mike Bayer [Mon, 15 Mar 2021 14:15:48 +0000 (10:15 -0400)] 
documentation updates

Change-Id: I43d0e8de1f90abcff4b278637808d1ebc8fd6c97

4 years agoMerge "Implement Mypy plugin"
mike bayer [Sun, 14 Mar 2021 21:31:08 +0000 (21:31 +0000)] 
Merge "Implement Mypy plugin"

4 years agoDocument NestedTransaction
Mike Bayer [Sun, 14 Mar 2021 16:28:46 +0000 (12:28 -0400)] 
Document NestedTransaction

Fixes: #3550
Change-Id: Ic2ff36ea434923590d2adbd101580025da319f66

4 years agoImplement Mypy plugin
Mike Bayer [Tue, 16 Feb 2021 23:36:50 +0000 (18:36 -0500)] 
Implement Mypy plugin

Rudimentary and experimental support for Mypy has been added in the form of
a new plugin, which itself depends on new typing stubs for SQLAlchemy. The
plugin allows declarative mappings in their standard form to both be
compatible with Mypy as well as to provide typing support for mapped
classes and instances.

Fixes: #4609
Change-Id: Ia035978c02ad3a5c0e5b3c6c30044dd5a3155170

4 years agotypo
Mike Bayer [Sat, 13 Mar 2021 02:21:39 +0000 (21:21 -0500)] 
typo

Change-Id: Ifaf3f708aa3ce73e365385ab7858eef3e4b8f3d3

4 years agoClarify ORM server side results
Mike Bayer [Fri, 12 Mar 2021 03:13:52 +0000 (22:13 -0500)] 
Clarify ORM server side results

the docs here implied that the buffering scheme used by
BufferedRowCursorFetchStrategy is also used by the ORM, however
this is not currently the case.  The ORM strictly uses the
"yield_per" option, which is either set explcitly, or passed
at result time via the fetchmany() / partitions() / yield_per()
methods.

Change-Id: I146595752dc227c97875de3c09ef9fc6f0fc836f

4 years agoMerge "Apply percent sign escaping to op(), custom_op()"
mike bayer [Tue, 9 Mar 2021 19:44:18 +0000 (19:44 +0000)] 
Merge "Apply percent sign escaping to op(), custom_op()"

4 years agoMerge remote-tracking branch 'origin/pr/6015'
Mike Bayer [Tue, 9 Mar 2021 18:45:38 +0000 (13:45 -0500)] 
Merge remote-tracking branch 'origin/pr/6015'

Change-Id: I9b8691cfe6d9ff6ffcef99c03d955e4002a596e8

4 years agoMerge remote-tracking branch 'origin/pr/6017'
Mike Bayer [Tue, 9 Mar 2021 18:44:39 +0000 (13:44 -0500)] 
Merge remote-tracking branch 'origin/pr/6017'

Change-Id: Ia99bc8990ac1072ad87a245b686196bd94029493