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.
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.
Mike Bayer [Thu, 6 Sep 2018 14:44:09 +0000 (10:44 -0400)]
Clarify init_scalar event use case
Since I didn't even realize what this was for when reading the docs,
make it clearer that this is to mirror a Column default and remove
the extra verbiage about the mechanics of INSERTs.
Mike Bayer [Thu, 30 Aug 2018 21:12:58 +0000 (17:12 -0400)]
MariaDB 10.3 updates
MariaDB seems to handle some additional UPDATE/DELETE FROM
syntaxes as well as some forms of INTERSECT and EXCEPT. Open
up tests that expect failure for MySQL to allow success for
MariaDB 10.3.
Mike Bayer [Wed, 7 Mar 2018 21:03:07 +0000 (16:03 -0500)]
Add notes regarding flat=True
Start documenting that flat=True and aliased=True don't work
with selectable particularly when selectable is an aliased select
already. References #4212
Mike Bayer [Mon, 5 Mar 2018 16:33:30 +0000 (11:33 -0500)]
Only replace first occurrence for COLLATE/ARRAY syntax
Fixed bug in Postgresql COLLATE / ARRAY adjustment first introduced
in :ticket:`4006` where new behaviors in Python 3.7 regular expressions
caused the fix to fail.
Mike Bayer [Fri, 2 Mar 2018 20:08:08 +0000 (15:08 -0500)]
Get MySQL version info from @@version
MySQL dialects now query the server version using ``SELECT @@version``
explicitly to the server to ensure we are getting the correct version
information back. Proxy servers like MaxScale interfere with the value
that is passed to the DBAPI's connection.server_version value so this
is no longer reliable.
Mike Bayer [Tue, 20 Feb 2018 17:15:57 +0000 (12:15 -0500)]
Default to using current mapped class as owner if none found
Repaired regression caused in 1.2.3 and 1.1.16 regarding association proxy
objects, revising the approach to :ticket:`4185` when calculating the
"owning class" of an association proxy to default to choosing the current
class if the proxy object is not directly associated with a mapped class,
such as a mixin.
Mike Bayer [Mon, 19 Feb 2018 23:13:24 +0000 (18:13 -0500)]
Rewrite the "deleting from collections" section
This section documents an aspect of the ORM that is
more generalized than just collections as well as more general
than just using session.delete(), even though session.delete()
with collections is the most common use case. Try to expand
out the scope here to explain the situation from the perspective
of any kind of relationship, include example with delete cascade
with many-to-one as well.
Mike Bayer [Mon, 12 Feb 2018 21:45:39 +0000 (16:45 -0500)]
Add dependency for parent_pre post updates to parent deletes
Fixed issue in post_update feature where an UPDATE is emitted
when the parent object has been deleted but the dependent object
is not. This issue has existed for a long time however
since 1.2 now asserts rows matched for post_update, this
was raising an error.
Mike Bayer [Fri, 9 Feb 2018 21:12:31 +0000 (16:12 -0500)]
Search through mapper superclass hierarchy for owner
Fixed regression caused by fix for issue :ticket:`4116` affecting versions
1.2.2 as well as 1.1.15, which had the effect of mis-calculation of the
"owning class" of an :class:`.AssociationProxy` as the ``NoneType`` class
in some declarative mixin/inheritance situations as well as if the
association proxy were accessed off of an un-mapped class. The "figure out
the owner" logic has been replaced by an in-depth routine that searches
through the complete mapper hierarchy assigned to the class or subclass to
determine the correct (we hope) match; will not assign the owner if no
match is found. An exception is now raised if the proxy is used
against an un-mapped instance.
Mike Bayer [Thu, 8 Feb 2018 19:52:29 +0000 (14:52 -0500)]
Ensure weakref finalize_fairy operates upon the current connection
Fixed a fairly serious connection pool bug where a connection that is
acquired after being refreshed as a result of a user-defined
:class:`.DisconnectionError` or due to the 1.2-released "pre_ping" feature
would not be correctly reset if the connection were returned to the pool by
weakref cleanup (e.g. the front-facing object is garbage collected); the
weakref would still refer to the previously invalidated DBAPI connection
which would have the reset operation erroneously called upon it instead.
This would lead to stack traces in the logs and a connection being checked
into the pool without being reset, which can cause locking issues.
Mike Bayer [Thu, 25 Jan 2018 21:11:29 +0000 (16:11 -0500)]
Add a new FAQ section explaining how to ensure parenthesis
with op().
Not sure if this can be further improved at some point, such
as if a BinaryExpression automatically applied self_group()
when op() is called, however for the moment op() behaves consistently
as with all other operators without any ad-hoc effects.
Mike Bayer [Wed, 24 Jan 2018 23:03:04 +0000 (18:03 -0500)]
Rework synonym, synonym_for documentation
The map_column example was incorrect, and overall the purpose
of this parameter as well as that of synonym_for was not explained;
examples added along with more encouragement to use hybrids.
Fixed bug in :meth:`.Insert.values` where using the "multi-values"
format in combination with :class:`.Column` objects as keys rather
than strings would fail. Pull request courtesy Aubrey Stark-Toller.
Mike Bayer [Thu, 4 Jan 2018 19:09:32 +0000 (14:09 -0500)]
Check for object was expunged before restoring after pk switch + rollback
Fixed bug where an object that is expunged during a rollback of
a nested or subtransaction which also had its primary key mutated
would not be correctly removed from the session, causing subsequent
issues in using the session.
Mike Bayer [Mon, 4 Dec 2017 21:40:20 +0000 (16:40 -0500)]
Add tests for ARRAY propagate events re. MutableList
Issue #4141 appears in version 1.2, however we are adding the
MutableList test for it to 1.1 as well. The metadata test
does not apply as in 1.1 ARRAY is not a SchemaEventTarget.
Mike Bayer [Mon, 13 Nov 2017 14:21:48 +0000 (09:21 -0500)]
Propagate kwargs for mysql concat, match
Fixed bug where the MySQL "concat" and "match" operators failed to
propagate kwargs to the left and right expressions, causing compiler
options such as "literal_binds" to fail.
Also adds non-interpreted **kw for visit_create_index, visit_typeclause
Mike Bayer [Sat, 28 Oct 2017 17:28:58 +0000 (13:28 -0400)]
Filter attributes we don't map during a load_scalar_attributes
Fixed bug where a descriptor that is elsewhere a mapped column
or relationship within a hierarchy based on :class:`.AbstractConcreteBase`
would be referred towards during a refresh operation, causing an error
as the attribute is not mapped as a mapper property.
A similar issue can arise for other attributes like the "type" column
added by :class:`.AbstractConcreteBase` if the class fails to include
"concrete=True" in its mapper, however the check here should also
prevent that scenario from causing a problem.
Mike Bayer [Fri, 20 Oct 2017 18:34:16 +0000 (14:34 -0400)]
Resolve AliasedClass when determining owning class of association proxy
Fixed bug where the association proxy would inadvertently link itself
to an :class:`.AliasedClass` object if it were called first with
the :class:`.AliasedClass` as a parent, causing errors upon subsequent
usage.
Daniel Thorell [Fri, 20 Oct 2017 16:59:55 +0000 (12:59 -0400)]
Remove deprecation warnings mysql5 7 20
MySQL 5.7.20 now warns for use of the @tx_isolation variable; a version
check is now performed and uses @transaction_isolation instead
to prevent this warning.
For 1.1, also backport our_warn() test fixture fix from 9f0fb6c601 1.2 branch.
(cherry picked from commit 41cfe44b5e5806b3d3b13949e41dbb347bfa29e1)
Co-authored by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #4120
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/391
Change-Id: I4d2e04df760c5351a71dde8b32145cdc69fa6115
Mike Bayer [Fri, 6 Oct 2017 15:14:29 +0000 (11:14 -0400)]
Fix array_agg to accommodate ARRAY arguments
Fixed bug in :func:`.array_agg` function where passing an argument
that is already of type :class:`.ARRAY`, such as a Postgresql
:obj:`.postgresql.array` construct, would produce a ``ValueError``, due
to the function attempting to nest the arrays.
Mike Bayer [Thu, 5 Oct 2017 15:25:10 +0000 (11:25 -0400)]
Don't include SelectBase when searching for surface column elements
Fixed bug where correlated select used against single-table inheritance
entity would fail to render correctly in the outer query, due to adjustment
for single inheritance discriminator criteria inappropriately re-applying
the criteria to the outer query.
Mike Bayer [Tue, 3 Oct 2017 00:50:56 +0000 (20:50 -0400)]
Improve check for overlapping FK targets on sibling classes
Fixed bug where ORM relationship would warn against conflicting sync
targets (e.g. two relationships would both write to the same column) for
sibling classes in an inheritance hierarchy, where the two relationships
would never actually conflict during writes.
Mike Bayer [Mon, 2 Oct 2017 15:50:05 +0000 (11:50 -0400)]
Support pg10
One test appears to use some awkward calling style
with the current_date function that isn't working in pg10
anymore, this looks like an extremely
old test that can be removed
Mike Bayer [Thu, 28 Sep 2017 20:47:28 +0000 (16:47 -0400)]
Take schema name into account when querying sqlite_master
Fixed bug where SQLite CHECK constraint reflection would fail
if the referenced table were in a remote schema, e.g. on SQLite a
remote database referred to by ATTACH.
Also add suite support for general CHECK constraint reflection.
Mike Bayer [Sat, 19 Aug 2017 22:39:08 +0000 (18:39 -0400)]
Support mariadb 10.2
Fixed issue where CURRENT_TIMESTAMP would not reflect correctly
in the MariaDB 10.2 series due to a syntax change, where the function
is now represented as ``current_timestamp()``.
Fixes: #4096
MariaDB 10.2 now supports CHECK constraints (warning: use version 10.2.9
or greater due to upstream issues noted in :ticket:`4097`). Reflection
now takes these CHECK constraints into account when they are present in
the ``SHOW CREATE TABLE`` output.
Mike Bayer [Thu, 28 Sep 2017 23:31:13 +0000 (19:31 -0400)]
Repair incorrectly merged mariadb logic
The changeset in c88d4d0 takes advantage of a
mariadb function that got randomly committed as part
of the SQL server fixup in 2efd89d02941ab4267d6e2842963, not
part of rel_1_1. The change here was not reviewed or tested
in gerrit and breaks the main branch.