]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
6 years agoModernize cx_oracle connect documentation
Mike Bayer [Thu, 15 Nov 2018 17:52:33 +0000 (12:52 -0500)] 
Modernize cx_oracle connect documentation

in preparation for #4369, however the documentation was
also inaccurate in that it did not mention connect_args.

Change-Id: I992e5f53ce16cc9c72d2c893a3ca798a9c2b4d07

6 years agoMerge "Add secondary selectable to FROM clauses for correlated exists"
mike bayer [Thu, 15 Nov 2018 15:17:59 +0000 (15:17 +0000)] 
Merge "Add secondary selectable to FROM clauses for correlated exists"

6 years agoMerge "Allow join() to pick the best candidate from multiple froms/entities"
mike bayer [Thu, 15 Nov 2018 15:05:11 +0000 (15:05 +0000)] 
Merge "Allow join() to pick the best candidate from multiple froms/entities"

6 years agoAllow join() to pick the best candidate from multiple froms/entities
Mike Bayer [Mon, 12 Nov 2018 23:27:34 +0000 (18:27 -0500)] 
Allow join() to pick the best candidate from multiple froms/entities

Refactored :meth:`.Query.join` to further clarify the individual components
of structuring the join. This refactor adds the ability for
:meth:`.Query.join` to determine the most appropriate "left" side of the
join when there is more than one element in the FROM list or the query is
against multiple entities.  In particular this targets the regression we
saw in :ticket:`4363` but is also of general use.   The codepaths within
:meth:`.Query.join` are now easier to follow and the error cases are
decided more specifically at an earlier point in the operation.

Fixes: #4365
Change-Id: I403f451243904a020ceab4c3f94bead550c7b2d5

6 years agoAdd secondary selectable to FROM clauses for correlated exists
Mike Bayer [Wed, 14 Nov 2018 16:02:40 +0000 (11:02 -0500)] 
Add secondary selectable to FROM clauses for correlated exists

In continuing with a similar theme as that of very recent :ticket:`4349`,
repaired issue with :meth:`.RelationshipProperty.Comparator.any` and
:meth:`.RelationshipProperty.Comparator.has` where the "secondary"
selectable needs to be explicitly part of the FROM clause in the
EXISTS subquery to suit the case where this "secondary" is a :class:`.Join`
object.

Fixes: #4366
Change-Id: Icd0d0c3871bbd0059f0c9256e2b980edc2c90551

6 years agoMerge "Add new parameters for IDENTITY start/increment in mssql"
mike bayer [Wed, 14 Nov 2018 22:35:19 +0000 (22:35 +0000)] 
Merge "Add new parameters for IDENTITY start/increment in mssql"

6 years agoAdd new parameters for IDENTITY start/increment in mssql
Mike Bayer [Sun, 11 Nov 2018 02:36:18 +0000 (21:36 -0500)] 
Add new parameters for IDENTITY start/increment in mssql

Deprecated the use of :class:`.Sequence` with SQL Server in order to affect
the "start" and "increment" of the IDENTITY value, in favor of new
parameters ``mssql_identity_start`` and ``mssql_identity_increment`` which
set these parameters directly.  :class:`.Sequence` will be used to generate
real ``CREATE SEQUENCE`` DDL with SQL Server in a future release.

Fixes: #4362
Change-Id: I1e69378c5c960ff0bc28137c923589692f1a918f

6 years agoMerge "Deannotate "parententity" in primaryjoin/secondaryjoin"
mike bayer [Wed, 14 Nov 2018 19:22:25 +0000 (19:22 +0000)] 
Merge "Deannotate "parententity" in primaryjoin/secondaryjoin"

6 years agoMerge "Insert primary entity in dynamic "secondary""
mike bayer [Wed, 14 Nov 2018 19:20:30 +0000 (19:20 +0000)] 
Merge "Insert primary entity in dynamic "secondary""

6 years agoDeannotate "parententity" in primaryjoin/secondaryjoin
Mike Bayer [Wed, 14 Nov 2018 16:31:22 +0000 (11:31 -0500)] 
Deannotate "parententity" in primaryjoin/secondaryjoin

Fixed bug where the ORM annotations could be incorrect for the
primaryjoin/secondaryjoin a relationship if one used the pattern
``ForeignKey(SomeClass.id)`` in the declarative mappings.   This pattern
would leak undesired annotations into the join conditions which can break
aliasing operations done within :class:`.Query` that are not supposed to
impact elements in that join condition.  These annotations are now removed
up front if present.

Also add a test suite for has/any into test_query which will
form the basis for new tests to be added in :ticket:`4366`.

Fixes: #4367
Change-Id: I929ef983981bb49bf975f346950ebb0e19c986b8

6 years agoMerge "Add Sequence to StrSQLCompiler"
mike bayer [Tue, 13 Nov 2018 23:37:33 +0000 (23:37 +0000)] 
Merge "Add Sequence to StrSQLCompiler"

6 years agoInsert primary entity in dynamic "secondary"
Mike Bayer [Mon, 12 Nov 2018 20:09:37 +0000 (15:09 -0500)] 
Insert primary entity in dynamic "secondary"

Fixed regression caused by :ticket:`4349` where adding the "secondary"
table to the FROM clause for a dynamic loader would affect the ability of
the :class:`.Query` to make a subsequent join to another entity.   The fix
adds the primary entity as the first element of the FROM list since
:meth:`.Query.join` wants to jump from that.   Version 1.3 will have
a more comprehensive solution to this problem as well (:ticket:`4365`).

Fixes: #4363
Change-Id: I1abbb6207722619dc5369e1fd96de43d60a1ee62

6 years agoConvert to spaces
Mike Bayer [Sun, 11 Nov 2018 02:56:52 +0000 (21:56 -0500)] 
Convert to spaces

Change-Id: I219f7f6ef4f644f64fcb04fed224c6415465df0b

6 years agoAdd Sequence to StrSQLCompiler
Mike Bayer [Sun, 11 Nov 2018 02:10:51 +0000 (21:10 -0500)] 
Add Sequence to StrSQLCompiler

Added :class:`.Sequence` to the "string SQL" system that will render a
meaningful string expression (``"<next sequence value: my_sequence>"``)
when stringifying without a dialect a statement that includes a "sequence
nextvalue" expression, rather than raising a compilation error.

Fixes: #4144
Change-Id: Ia910f0e22008a7cde7597365954ede324101cf4d

6 years agoMerge "Add new "all columns" naming convention tokens"
mike bayer [Sun, 11 Nov 2018 01:58:18 +0000 (01:58 +0000)] 
Merge "Add new "all columns" naming convention tokens"

6 years agoMerge "Modernize deferred callable for many-to-one comparison"
mike bayer [Sun, 11 Nov 2018 01:56:41 +0000 (01:56 +0000)] 
Merge "Modernize deferred callable for many-to-one comparison"

6 years agoModernize deferred callable for many-to-one comparison
Mike Bayer [Wed, 7 Nov 2018 16:21:39 +0000 (11:21 -0500)] 
Modernize deferred callable for many-to-one comparison

Improved the behavior of a relationship-bound many-to-one object expression
such that the retrieval of column values on the related object are now
resilient against the object being detached from its parent
:class:`.Session`, even if the attribute has been expired.  New features
within the :class:`.InstanceState` are used to memoize the last known value
of a particular column attribute before its expired, so that the expression
can still evaluate when the object is detached and expired at the same
time.  Error conditions are also improved using modern attribute state
features to produce more specific messages as needed.

To support the value being mutated while also being resilient towards
expiration, a new feature to InstanceState is added ._last_known_values
which holds onto the expired value when an individual key is expired.
Only takes effect specific to keys and InstanceState objects that
received a special instruction so this does not add to overall
memory/latency.

Fixes: #4359
Change-Id: Iff272e667bf741074549db550bf65348553ca8e7

6 years agoAdd new "all columns" naming convention tokens
Mike Bayer [Mon, 5 Nov 2018 19:52:35 +0000 (14:52 -0500)] 
Add new "all columns" naming convention tokens

Added new naming convention tokens ``column_0N_name``, ``column_0_N_name``,
etc., which will render the names / keys / labels for all columns referenced
by a particular constraint in a sequence.  In order to accommodate for the
length of such a naming convention, the SQL compiler's auto-truncation
feature now applies itself to constraint names as well, which creates a
shortened, deterministically generated name for the constraint that will
apply to a target backend without going over the character limit of that
backend.

Additional notes:

1. the SQLite dialect had a format_index method that was apparently not
used, removed.

2. the naming convention logic has been applying the foreign key
remote column spec to the naming convention, and not the actual
column name.  In the case where the referenced Table object uses
.key inside the columns and these are what ForeignKey() references,
the naming convention was doing the wrong thing.   The patch here
fixes this, however this isn't noted in the migration notes.

Fixes: #3989
Change-Id: Ib24f4754b886676096c480fc54b2e5c2463ac99a

6 years agocherry-pick changelog update for 1.2.15
Mike Bayer [Sat, 10 Nov 2018 20:59:12 +0000 (15:59 -0500)] 
cherry-pick changelog update for 1.2.15

6 years agocherry-pick changelog from 1.2.14
Mike Bayer [Sat, 10 Nov 2018 20:59:12 +0000 (15:59 -0500)] 
cherry-pick changelog from 1.2.14

6 years agoFix typo
Mike Bayer [Sat, 10 Nov 2018 16:26:31 +0000 (11:26 -0500)] 
Fix typo

Change-Id: I411466dc1952cf57f73d1453c73b0ca449842c35

6 years agoUse case insensitive matching on lower_case_table_names=1,2
Mike Bayer [Sat, 10 Nov 2018 04:18:55 +0000 (23:18 -0500)] 
Use case insensitive matching on lower_case_table_names=1,2

Fixed regression caused by :ticket:`4344` released in 1.2.13, where the fix
for MySQL 8.0's case sensitivity problem with referenced column names when
reflecting foreign key referents is worked around using the
``information_schema.columns`` view.  The workaround was failing on OSX /
``lower_case_table_names=2`` which produces non-matching casing for the
``information_schema.columns`` vs. that of ``SHOW CREATE TABLE``, so in
case-insensitive SQL modes case-insensitive matching is now used.

Fixes: #4361
Change-Id: I748549bc4c27fad6394593f8ec93fc22bfd01f6c

6 years agoMerge "Implement SQLite ON CONFLICT for constraints"
mike bayer [Fri, 9 Nov 2018 22:43:20 +0000 (22:43 +0000)] 
Merge "Implement SQLite ON CONFLICT for constraints"

6 years agoImplement SQLite ON CONFLICT for constraints
Denis Kataev [Mon, 12 Mar 2018 15:40:34 +0000 (11:40 -0400)] 
Implement SQLite ON CONFLICT for constraints

Implemented the SQLite ``ON CONFLICT`` clause as understood at the DDL
level, e.g. for primary key, unique, and CHECK constraints as well as
specified on a :class:`.Column` to satisfy inline primary key and NOT NULL.
Pull request courtesy Denis Kataev.

Fixes: #4360
Change-Id: I4cd4bafa8fca41e3101c87dbbfe169741bbda3f4
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/431

6 years agoImprove documentation re: Session.binds and partitioning strategies
Mike Bayer [Tue, 6 Nov 2018 20:13:03 +0000 (15:13 -0500)] 
Improve documentation re: Session.binds and partitioning strategies

Update documentation to include background on arbitrary superclass
usage, add full cross-linking between all related methods and parameters.
De-emphasize "twophase" and document that it is not well-supported
in drivers.

Change-Id: Id99894bb62cc506e896c9aa7c256e9f6e602243e

6 years agoMerge remote-tracking branch 'origin/pr/486'
Mike Bayer [Sat, 3 Nov 2018 16:45:31 +0000 (12:45 -0400)] 
Merge remote-tracking branch 'origin/pr/486'

Change-Id: I90596d4fc238b913146906db0ab700dd767c5615

6 years agoMerge remote-tracking branch 'origin/pr/450'
Mike Bayer [Sat, 3 Nov 2018 16:37:19 +0000 (12:37 -0400)] 
Merge remote-tracking branch 'origin/pr/450'

Change-Id: I50c0dd75199a34f68f9a2fa0f89208a887193969

6 years agoMerge "Deannotate ORM columns in ColumnEntity"
mike bayer [Sat, 3 Nov 2018 16:17:04 +0000 (16:17 +0000)] 
Merge "Deannotate ORM columns in ColumnEntity"

6 years ago- block py.test 3.9.1 and 3.9.2, 3.9.3 is OK
Mike Bayer [Fri, 2 Nov 2018 20:54:21 +0000 (16:54 -0400)] 
- block py.test 3.9.1 and 3.9.2, 3.9.3 is OK

Change-Id: I35ecd78b92ea420ef7909de65f82e005b92bf986

6 years agoDeannotate ORM columns in ColumnEntity
Mike Bayer [Fri, 2 Nov 2018 20:40:59 +0000 (16:40 -0400)] 
Deannotate ORM columns in ColumnEntity

Fixed a minor performance issue which could in some cases add unnecessary
overhead to result fetching, involving the use of ORM columns and entities
that include those same columns at the same time within a query.  The issue
has to do with hash / eq overhead when referring to the column in different
ways.

Fixes: #4347
Change-Id: I191d4d1b1623898060a9accdfd186de16f89a6b7

6 years agoTweak code-style and readability in `events/base.py`
Iwo Herka [Fri, 2 Nov 2018 18:06:25 +0000 (19:06 +0100)] 
Tweak code-style and readability in `events/base.py`

This includes a few low-key, syntax-level tweaks and:

1. Rewrite of the if-statment in `Events._accept_with`.
2. Property name change, i.e. from `dispatcher.dispatch_cls` to
`dispatcher.dispatch`. In this case postfix `_cls` is confusing as
the property is not a class, but an instance of one.

6 years agoAdd new NO_RAISE attribute flag and specify for m2o history load
Mike Bayer [Thu, 1 Nov 2018 15:11:03 +0000 (11:11 -0400)] 
Add new NO_RAISE attribute flag and specify for m2o history load

Added new behavior to the lazy load that takes place when the "old" value of
a many-to-one is retrieved, such that exceptions which would be raised due
to either ``lazy="raise"`` or a detached session error are skipped.

Fixes: #4353
Change-Id: I6c6c77613e93061a909f5062b70b17e8913fc9ee

6 years agoMerge "Implement __delete__"
mike bayer [Fri, 2 Nov 2018 13:21:15 +0000 (13:21 +0000)] 
Merge "Implement __delete__"

6 years agoImplement __delete__
Mike Bayer [Thu, 1 Nov 2018 17:15:14 +0000 (13:15 -0400)] 
Implement __delete__

A long-standing oversight in the ORM, the ``__delete__`` method for a many-
to-one relationship was non-functional, e.g. for an operation such as ``del
a.b``.  This is now implemented and is equivalent to setting the attribute
to ``None``.

Fixes: #4354
Change-Id: I60131a84c007b0bf6f20c5cc5f21a3b96e954046

6 years agoUse attr keys when testing bulk update params for primary key
Mike Bayer [Fri, 2 Nov 2018 01:53:18 +0000 (21:53 -0400)] 
Use attr keys when testing bulk update params for primary key

Fixed bug in :meth:`.Session.bulk_update_mappings` where alternate mapped
attribute names would result in the primary key column of the UPDATE
statement being included in the SET clause, as well as the WHERE clause;
while usually harmless, for SQL Server this can raise an error due to the
IDENTITY column.  This is a continuation of the same bug that was fixed in
:ticket:`.3849`, where testing was insufficient to catch this additional
flaw.

Fixes: #4357
Change-Id: Iead058c0465dfa31c5b8a8780769278b7000acc8

6 years agocherry-pick changelog update for 1.2.14
Mike Bayer [Wed, 31 Oct 2018 20:49:15 +0000 (16:49 -0400)] 
cherry-pick changelog update for 1.2.14

6 years agocherry-pick changelog from 1.2.13
Mike Bayer [Wed, 31 Oct 2018 20:49:14 +0000 (16:49 -0400)] 
cherry-pick changelog from 1.2.13

6 years agoAdd missing index method to _AssociationList.
Chris Macklin [Wed, 31 Oct 2018 13:03:50 +0000 (09:03 -0400)] 
Add missing index method to _AssociationList.

Added missing ``.index()`` method to list-based association collections
in the association proxy extension.

Change-Id: Ice81dc4bcccd520638c5bc9a0f8bb2027946c846
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/485

6 years agoMerge "Move pk on single-inh subclass check below conflict resolution check"
mike bayer [Wed, 31 Oct 2018 15:24:55 +0000 (15:24 +0000)] 
Merge "Move pk on single-inh subclass check below conflict resolution check"

6 years agoMerge "Add reserved word 'function' for MySQL"
mike bayer [Tue, 30 Oct 2018 21:23:49 +0000 (21:23 +0000)] 
Merge "Add reserved word 'function' for MySQL"

6 years agoMove pk on single-inh subclass check below conflict resolution check
Tom Manderson [Tue, 30 Oct 2018 17:05:43 +0000 (13:05 -0400)] 
Move pk on single-inh subclass check below conflict resolution check

The column conflict resolution technique discussed at
:ref:`declarative_column_conflicts` is now functional for a :class:`.Column`
that is also a primary key column.  Previously, a check for primary key
columns declared on a single-inheritance subclass would occur before the
column copy were allowed to pass.

Fixes: #4352
Change-Id: Id4c025da53c28e58db6b549fe398f25f8a90d355
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/483

6 years agoAdd reserved word 'function' for MySQL
Alex Hall [Tue, 30 Oct 2018 17:00:49 +0000 (13:00 -0400)] 
Add reserved word 'function' for MySQL

Added word ``function`` to the list of reserved words for MySQL, which is
now a keyword in MySQL 8.0

Fixes: #4348
Change-Id: Idd30acda7e99076810f65d0ee860055a18dc9193
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/481

6 years agoAdd missing space
wodim [Thu, 25 Oct 2018 12:11:23 +0000 (14:11 +0200)] 
Add missing space

6 years agore-word recycle parameter documentation
David Poggi [Tue, 23 Oct 2018 14:17:09 +0000 (10:17 -0400)] 
re-word recycle parameter documentation

Change-Id: I80cabcd9fa3f3b45e5355bf6c774a8eee02e7f1b

6 years agoMerge remote-tracking branch 'origin/pr/478'
Mike Bayer [Tue, 30 Oct 2018 16:53:42 +0000 (12:53 -0400)] 
Merge remote-tracking branch 'origin/pr/478'

Change-Id: I0f27b6426dbfd665edf2a119b1cfaadb54511dd0

6 years agoMerge "Create object- and column-oriented versions of AssociationProxyInstance"
mike bayer [Sat, 27 Oct 2018 18:08:44 +0000 (14:08 -0400)] 
Merge "Create object- and column-oriented versions of AssociationProxyInstance"

6 years agoCreate object- and column-oriented versions of AssociationProxyInstance
Mike Bayer [Tue, 23 Oct 2018 23:38:46 +0000 (19:38 -0400)] 
Create object- and column-oriented versions of AssociationProxyInstance

The :class:`.AssociationProxy` now has standard column comparison operations
such as :meth:`.ColumnOperators.like` and
:meth:`.ColumnOperators.startswith` available when the target attribute is a
plain column - the EXISTS expression that joins to the target table is
rendered as usual, but the column expression is then use within the WHERE
criteria of the EXISTS.  Note that this alters the behavior of the
``.contains()`` method on the association proxy to make use of
:meth:`.ColumnOperators.contains` when used on a column-based attribute.

Fixes: #4351
Change-Id: I310941f4e8f778c200f8144a26a89e5364cd4dfb

6 years agoPin pytest *before* 3.9.1 totally
Mike Bayer [Wed, 24 Oct 2018 13:09:32 +0000 (09:09 -0400)] 
Pin pytest *before* 3.9.1 totally

Unfortunately they have released
3.9.2 before fixing issue 4181, which means we will have to
re-pin a third time after they eventually release with
a fix

Change-Id: I9b6fab1b535f883a035f002264c41ad0166790ab
Reference: https://github.com/pytest-dev/pytest/issues/4181

6 years agoUse the same "current_timestamp" function for both sides of round trip
Mike Bayer [Sun, 21 Oct 2018 02:20:06 +0000 (22:20 -0400)] 
Use the same "current_timestamp" function for both sides of round trip

this test was using sysdate() and current_timestamp() together
in conjunction with a truncation to DAY, however for four hours
on saturday night (see commit time :) ) these two values will
have a different value if one side is EDT and the other is UTC.

tox does not transmit environment variables including TZ by
default, so even if the server is set up for EDT, running tox
will not set TZ and at least Oracle client seems to use this
value, producing UTC for session time but the database on CI
was configured for EDT, producing EDT for sysdate.

Change-Id: I56602d2402a475a0c4fdf61c1c5fc2618c82f915

6 years ago- also correct for dbapi is a Mock without __version__...
Mike Bayer [Sat, 20 Oct 2018 21:51:10 +0000 (17:51 -0400)] 
- also correct for dbapi is a Mock without __version__...

Change-Id: I9e6b61a3292a2a6c8bb281c2375f2326282bcb76

6 years agoMerge "Check more specifically for hybrid attr and not mapped property"
mike bayer [Sat, 20 Oct 2018 20:55:01 +0000 (16:55 -0400)] 
Merge "Check more specifically for hybrid attr and not mapped property"

6 years ago- correct for dbapi not present in some tests
Mike Bayer [Sat, 20 Oct 2018 20:04:35 +0000 (16:04 -0400)] 
- correct for dbapi not present in some tests

Change-Id: Iaa81a00658060d40add26c95cc69cee7edd5966a

6 years agoEnable decimal implicit bind for mysqlclient, is fixed as of
Mike Bayer [Sat, 20 Oct 2018 16:32:25 +0000 (12:32 -0400)] 
Enable decimal implicit bind for mysqlclient, is fixed as of
post 1.3.13

Change-Id: Ic7a2055597d06038ab330f1114416e4538964a2b

6 years agoCheck more specifically for hybrid attr and not mapped property
Mike Bayer [Fri, 19 Oct 2018 21:10:42 +0000 (17:10 -0400)] 
Check more specifically for hybrid attr and not mapped property

Fixed regression caused by :ticket:`4326` in version 1.2.12 where using
:class:`.declared_attr` with a mixin in conjunction with
:func:`.orm.synonym` would fail to map the synonym properly to an inherited
subclass.

Fixes: #4350
Change-Id: Ib2a9b6a125a2ac7c7ff80201746b7f10e5596226

6 years agoAdd prop.secondary to FROM for dynamic loader
Mike Bayer [Wed, 17 Oct 2018 14:42:50 +0000 (10:42 -0400)] 
Add prop.secondary to FROM for dynamic loader

Fixed bug where "dynamic" loader needs to explicitly set the "secondary"
table in the FROM clause of the query, to suit the case where the secondary
is a join object that is otherwise not pulled into the query from its
columns alone.

Fixes: #4349
Change-Id: I397f62abd5603efa4fb273586d0f772bf8c8fbbf

6 years agoblock py.test 3.9.1
Mike Bayer [Wed, 17 Oct 2018 15:49:47 +0000 (11:49 -0400)] 
block py.test 3.9.1

references:

https://github.com/pytest-dev/pytest/issues/4181

Change-Id: I216fde19dd0f5c4910d76c08400f2329b09ad584

6 years agoDon't use "is" to compare exceptions
Mike Bayer [Mon, 15 Oct 2018 05:44:13 +0000 (01:44 -0400)] 
Don't use "is" to compare exceptions

psycopg2 is introducing a fine grained exception model where
most exceptions will be specialized subclasses, so don't use
"is" to compare an expression type

Change-Id: I2eac7503e38136f0dcc0da6f77b0b1d83ea1c6dc

6 years agoDon't call rollback on DBAPI connection that's "closed"
Mike Bayer [Sun, 14 Oct 2018 19:55:46 +0000 (15:55 -0400)] 
Don't call rollback on DBAPI connection that's "closed"

Use the existence of ConnectionRecord.connection to estimate
that this connection is likely closed, and if so, don't
try to call "rollback" on it.  This rollback is normally harmless
but is causing segfaults in mysqlclient due to
https://github.com/PyMySQL/mysqlclient-python/issues/270.

Change-Id: I1d7c5f5a520527d8268b6334795c2051f7ceeea6

6 years ago- get the "now" date for this test in terms of the database to accommodate
Mike Bayer [Sat, 13 Oct 2018 03:02:12 +0000 (23:02 -0400)] 
- get the "now" date for this test in terms of the database to accommodate
for local timezone doesn't match that of the DB

Change-Id: I0899d9294e8a2bd8f7f2c3e66cf396e2e8bd4bcc

6 years agoselectinload omit join
Jayson Reis [Mon, 1 Oct 2018 16:58:46 +0000 (12:58 -0400)] 
selectinload omit join

The "selectin" loader strategy now omits the JOIN in the case of a
simple one-to-many load, where it instead relies upon the foreign key
columns of the related table in order to match up to primary keys in
the parent table.   This optimization can be disabled by setting
the :paramref:`.relationship.omit_join` flag to False.
Many thanks to Jayson Reis for the efforts on this.

As part of this change, horizontal shard no longer relies upon
the _mapper_zero() method to get the query-bound mapper, instead
using the more generalized _bind_mapper() (which will use mapper_zero
if no explicit FROM is present).  A short check for the particular
recursive condition is added to BundleEntity and it no longer assigns
itself as the "namespace" to its ColumnEntity objects which creates
a reference cycle.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #4340
Change-Id: I649587e1c07b684ecd63f7d10054cd165891baf4
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/7

6 years agoMerge "Route bulk update/delete exec through new Query._execute_crud method"
mike bayer [Thu, 4 Oct 2018 19:53:51 +0000 (15:53 -0400)] 
Merge "Route bulk update/delete exec through new Query._execute_crud method"

6 years agoRoute bulk update/delete exec through new Query._execute_crud method
Mike Bayer [Wed, 7 Feb 2018 00:30:55 +0000 (19:30 -0500)] 
Route bulk update/delete exec through new Query._execute_crud method

Added support for bulk :meth:`.Query.update` and :meth:`.Query.delete`
to the :class:`.ShardedQuery` class within the horiziontal sharding
extension.  This also adds an additional expansion hook to the
bulk update/delete methods :meth:`.Query._execute_crud`.

Fixes: #4196
Change-Id: I65f56458176497a8cbdd368f41b879881f06348b

6 years agoMerge "Support tuples of heterogeneous types for empty expanding IN"
mike bayer [Thu, 4 Oct 2018 17:49:42 +0000 (13:49 -0400)] 
Merge "Support tuples of heterogeneous types for empty expanding IN"

6 years agoAdd warning to hybrid property expression and fixup crosslinks
James Owen [Thu, 4 Oct 2018 15:12:41 +0000 (17:12 +0200)] 
Add warning to hybrid property expression and fixup crosslinks

6 years agoSupport tuples of heterogeneous types for empty expanding IN
Mike Bayer [Wed, 3 Oct 2018 14:40:38 +0000 (10:40 -0400)] 
Support tuples of heterogeneous types for empty expanding IN

Pass a list of all the types for the left side of an
IN expression to the visit_empty_set_expr() method, so that
the "empty expanding IN" can produce clauses for each element.

Fixes: #4271
Change-Id: I2738b9df2292ac01afda37f16d4fa56ae7bf9147

6 years agoPerform additional retrieval of correct column names
Mike Bayer [Tue, 2 Oct 2018 21:49:44 +0000 (17:49 -0400)] 
Perform additional retrieval of correct column names

Added a workaround for a MySQL bug #88718 introduced in the 8.0 series,
where the reflection of a foreign key constraint is not reporting the
correct case sensitivity for the referred column, leading to errors during
use of the reflected constraint such as when using the automap extension.
The workaround emits an additional query to the information_schema tables in
order to retrieve the correct case sensitive name.

Fixes: #4344
Change-Id: I08020d6eec43cbe8a56316660380d3739a0b45f7

6 years agoAdd additional documentation for ORM fetched defaults
Mike Bayer [Tue, 2 Oct 2018 17:54:00 +0000 (13:54 -0400)] 
Add additional documentation for ORM fetched defaults

Add additional examples to the section first added as part
of #4317 to cover the use cases requested in #3921.

Fixes: #3921
Change-Id: I6ec283aa0a6fbabedef40bb4320751ab4cd990ea

6 years agoMerge "Fix dependency_for final argument"
mike bayer [Tue, 2 Oct 2018 13:10:24 +0000 (09:10 -0400)] 
Merge "Fix dependency_for final argument"

6 years agoMerge "Add .info to InstanceState"
mike bayer [Tue, 2 Oct 2018 01:37:49 +0000 (21:37 -0400)] 
Merge "Add .info to InstanceState"

6 years agoMerge "Add reflection support for Postgresql partitioned tables"
mike bayer [Tue, 2 Oct 2018 01:36:47 +0000 (21:36 -0400)] 
Merge "Add reflection support for Postgresql partitioned tables"

6 years agoMerge "Strong reference parent object in association proxy"
mike bayer [Tue, 2 Oct 2018 01:34:05 +0000 (21:34 -0400)] 
Merge "Strong reference parent object in association proxy"

6 years agoFix dependency_for final argument
Joe Urciuoli [Wed, 19 Sep 2018 17:40:23 +0000 (13:40 -0400)] 
Fix dependency_for final argument

Fixed issue where part of the utility language helper internals was passing
the wrong kind of argument to the Python ``__import__`` builtin as the list
of modules to be imported.  The issue produced no symptoms within the core
library but could cause issues with external applications that redefine the
``__import__`` builtin or otherwise instrument it. Pull request courtesy Joe
Urciuoli.

Per the submitter: "The fourth argument provided to `__import__`  (which
`import_` feeds in to) is supposed to be a a list of strings, but this code is
passing a single string. This was causing the sqlalchemy `import_` function to
break the string (for example 'interfaces') into an array of single characters
['i', 'n', ...], which causes the actual `__import__` to not find the module
`sqlalchemy.orm.i` (since it's trying to import `sqlalchemy.orm.i` and
`sqlalchemy.orm.n` .. etc)"

No issue could be reproduced locally as it seems you can put anything non-
empty/None into that last argument, even a list like ``['X']``, and  all the
sub-modules seem to appear.  Omit it, and then the sub-modules aren't present.
Perhaps it just runs the module or not if this attribute is present.

Change-Id: Ia15c74620f24d24f0df4882f9b36a04e2c3725b8
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/473

6 years agoStrong reference parent object in association proxy
Mike Bayer [Fri, 1 Jun 2018 19:50:25 +0000 (14:50 -0500)] 
Strong reference parent object in association proxy

Considering the reversal of #597 as well as
84420a1d0fe09d7a45e878e853aa9f5258561f8b as I am unable to reproduce
the original issues from that release.

The long-standing behavior of the association proxy collection maintaining
only a weak reference to the parent object is reverted; the proxy will now
maintain a strong reference to the parent for as long as the proxy
collection itself is also in memory, eliminating the "stale association
proxy" error. This change is being made on an experimental basis to see if
any use cases arise where it causes side effects.

Change-Id: I051334be90a343dd0e8a1f35e072075eb14b14a7
Fixes: #4268
6 years agoAdd .info to InstanceState
Mike Bayer [Mon, 1 Oct 2018 20:34:50 +0000 (16:34 -0400)] 
Add .info to InstanceState

Added ``.info`` dictionary to the :class:`.InstanceState` class, the object
that comes from calling :func:`.inspect` on a mapped object.

Fixes: #4257
Change-Id: I32d043f369edb708a17eec2e0b8876db0c1891b4

6 years agoAdd reflection support for Postgresql partitioned tables
Mike Bayer [Mon, 1 Oct 2018 20:23:33 +0000 (16:23 -0400)] 
Add reflection support for Postgresql partitioned tables

Added rudimental support for reflection of Postgresql
partitioned tables, e.g. that relkind='p' is added to reflection
queries that return table information.

Fixes: #4237
Change-Id: I66fd10b002e4ed21ea13b13a7e35a85f66bdea75

6 years agoAdd test and retroactive changelog for issue 4040
Mike Bayer [Mon, 1 Oct 2018 18:00:39 +0000 (14:00 -0400)] 
Add test and retroactive changelog for issue 4040

Fixes: #4040
Change-Id: I707c1cd2708a37102ad8184bec21be35cb6242d7

6 years agoAdd link to Code of Conduct
Mike Bayer [Sat, 29 Sep 2018 23:12:40 +0000 (19:12 -0400)] 
Add link to Code of Conduct

Change-Id: Ib07db7c2fc97739a172e541a0681176a67f89a2f

6 years agoRemove unnecessary unicode and raw string prefix
Denis Kataev [Fri, 28 Sep 2018 07:40:30 +0000 (12:40 +0500)] 
Remove unnecessary unicode and raw string prefix

6 years agoMerge "Import from collections.abc"
mike bayer [Fri, 28 Sep 2018 01:55:01 +0000 (21:55 -0400)] 
Merge "Import from collections.abc"

6 years agoAdd non-primary mapper example illustrating a row-limited relationship
Mike Bayer [Fri, 28 Sep 2018 01:27:59 +0000 (21:27 -0400)] 
Add non-primary mapper example illustrating a row-limited relationship

Change-Id: Ifcb3baa6b220e375dc029794dd10c111660eac94

6 years agoMerge "Break association proxy into a descriptor + per-class accessor"
mike bayer [Thu, 27 Sep 2018 21:10:21 +0000 (17:10 -0400)] 
Merge "Break association proxy into a descriptor + per-class accessor"

6 years agoBreak association proxy into a descriptor + per-class accessor
Mike Bayer [Tue, 27 Feb 2018 18:15:10 +0000 (13:15 -0500)] 
Break association proxy into a descriptor + per-class accessor

Reworked :class:`.AssociationProxy` to store state that's specific to a
parent class in a separate object, so that a single
:class:`.AssocationProxy` can serve for multiple parent classes, as is
intrinsic to inheritance, without any ambiguity in the state returned by it.
A new method :meth:`.AssociationProxy.for_class` is added to allow
inspection of class-specific state.

Change-Id: I634f88aae6306ac5c5237a0e1acbe07d0481d6b6
Fixes: #3423
6 years agoImport from collections.abc
xtreak [Mon, 24 Sep 2018 16:23:54 +0000 (12:23 -0400)] 
Import from collections.abc

Fixed additional warnings generated by Python 3.7 due to changes in the
organization of the Python ``collections`` and ``collections.abc`` packages.
Previous ``collections`` warnings were fixed in version 1.2.11. Pull request
courtesy xtreak.

See I2d1c0ef97c8ecac7af152cc56263422a40faa6bb for the original collections.abc
fixes.

Fixes: #4339
Change-Id: Ia92d2461f20309fb33ea6c6f592f7d4e7e32ae7a
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/475

6 years agoMerge "Remove MappedCollection converter; deprecate @converter"
mike bayer [Thu, 27 Sep 2018 19:44:45 +0000 (15:44 -0400)] 
Merge "Remove MappedCollection converter; deprecate @converter"

6 years agoRemove MappedCollection converter; deprecate @converter
Mike Bayer [Wed, 26 Sep 2018 22:52:44 +0000 (18:52 -0400)] 
Remove MappedCollection converter; deprecate @converter

Removed the collection converter used by the :class:`.MappedCollection`
class. This converter was used only to assert that the incoming dictionary
keys matched that of their corresponding objects, and only during a bulk set
operation.  The converter can interfere with a custom validator or
:meth:`.AttributeEvents.bulk_replace` listener that wants to convert
incoming values further.  The ``TypeError`` which would be raised by this
converter when an incoming key didn't match the value is removed; incoming
values during a bulk assignment will be keyed to their value-generated key,
and not the key that's explicitly present in the dictionary.

Overall, @converter is superseded by the
:meth:`.AttributeEvents.bulk_replace` event handler added as part of
:ticket:`3896`.

Fixes: #3604
Change-Id: Id0f7bd2cec938f5975eb2ab94df9ba5754dd43c3

6 years agoMerge "Copy create_constraint flag for Enum"
mike bayer [Wed, 26 Sep 2018 00:16:33 +0000 (20:16 -0400)] 
Merge "Copy create_constraint flag for Enum"

6 years agoMerge "Accept multiple expressions for aggregate_order_by order_by"
mike bayer [Wed, 26 Sep 2018 00:15:54 +0000 (20:15 -0400)] 
Merge "Accept multiple expressions for aggregate_order_by order_by"

6 years agoMerge remote-tracking branch 'origin/pr/476' into pep-8-mxodbc
Mike Bayer [Tue, 25 Sep 2018 15:44:33 +0000 (11:44 -0400)] 
Merge remote-tracking branch 'origin/pr/476' into pep-8-mxodbc

Change-Id: I0aa585719737c03a6ebb99b8ccb9f4ffdfd3fed5

6 years agoAccept multiple expressions for aggregate_order_by order_by
Mike Bayer [Tue, 25 Sep 2018 15:11:41 +0000 (11:11 -0400)] 
Accept multiple expressions for aggregate_order_by order_by

Added support for the :class:`.aggregate_order_by` function to receive
multiple ORDER BY elements, previously only a single element was accepted.

Fixes: #4337
Change-Id: I411ac31697a0d65b568ad65ce5b5181717afbd65

6 years agoCopy create_constraint flag for Enum
Mike Bayer [Tue, 25 Sep 2018 14:38:40 +0000 (10:38 -0400)] 
Copy create_constraint flag for Enum

Fixed bug where the :paramref:`.Enum.create_constraint` flag on  the
:class:`.Enum` datatype would not be propagated to copies of the type, which
affects use cases such as declarative mixins and abstract bases.

Fixes: #4341
Change-Id: I978be65f33a616fe4d5f5de03fb3eaab6f6a2272

6 years agoPEP8 mxodbc.py
Agam Rafaeli [Mon, 24 Sep 2018 12:01:44 +0000 (15:01 +0300)] 
PEP8 mxodbc.py

6 years agoAdd use_nchar_for_unicode flag; don't use nchar types for generic unicode
Mike Bayer [Wed, 13 Jun 2018 21:48:51 +0000 (17:48 -0400)] 
Add use_nchar_for_unicode flag; don't use nchar types for generic unicode

The Oracle dialect will no longer use the NCHAR/NCLOB datatypes to
represent generic unicode strings or clob fields in conjunction with
:class:`.Unicode` and :class:`.UnicodeText` unless the flag
``use_nchar_for_unicode=True`` is passed to :func:`.create_engine`.
Additionally, string types under Oracle now coerce to unicode under Python
2 in all cases, however unlike in previous iterations, we use SQLAlchemy's
native unicode handlers which are very performant (when C extensions are
enabled; when they are not, we use cx_Oracle's handlers).

Change-Id: I3939012e9396520875bc52e69bf81f27393836ee
Fixes: #4242
6 years agomove callcounts up to python 3.7
Mike Bayer [Fri, 21 Sep 2018 17:53:59 +0000 (13:53 -0400)] 
move callcounts up to python 3.7

Change-Id: I1d17c2cd05b0dc3b787609925b6ebf2075752394

6 years agoMerge "Allow dialects to customize group by clause compilation"
mike bayer [Fri, 21 Sep 2018 01:54:25 +0000 (21:54 -0400)] 
Merge "Allow dialects to customize group by clause compilation"

6 years agoAllow dialects to customize group by clause compilation
Samuel Chou [Wed, 19 Sep 2018 17:30:24 +0000 (13:30 -0400)] 
Allow dialects to customize group by clause compilation

Refactored :class:`.SQLCompiler` to expose a
:meth:`.SQLCompiler.group_by_clause` method similar to the
:meth:`.SQLCompiler.order_by_clause` and :meth:`.SQLCompiler.limit_clause`
methods, which can be overridden by dialects to customize how GROUP BY
renders.  Pull request courtesy Samuel Chou.

Change-Id: I0a7238e55032558c27a0c56a72907c7b883456f1
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/474

6 years ago- forgot the colon
Mike Bayer [Wed, 19 Sep 2018 20:12:50 +0000 (16:12 -0400)] 
- forgot the colon

Change-Id: I954d939ace775b5e6d94b8b1a909a9eddb7f352f

6 years agoAllow pip opts to be specified in environment
Mike Bayer [Wed, 19 Sep 2018 18:55:09 +0000 (14:55 -0400)] 
Allow pip opts to be specified in environment

To allow a custom requirements file to be passed in,
add a generic passthrough to the tox install command.

Change-Id: Ic2e46a27914b76802dc26143e34ad507978af474

6 years agocherry-pick changelog update for 1.2.13
Mike Bayer [Wed, 19 Sep 2018 18:15:19 +0000 (14:15 -0400)] 
cherry-pick changelog update for 1.2.13

6 years agocherry-pick changelog from 1.2.12
Mike Bayer [Wed, 19 Sep 2018 18:15:18 +0000 (14:15 -0400)] 
cherry-pick changelog from 1.2.12

6 years agoMerge "Adapt right side in join if lateral detected"
mike bayer [Wed, 19 Sep 2018 13:30:34 +0000 (09:30 -0400)] 
Merge "Adapt right side in join if lateral detected"