Commit Graph

7602 Commits

Author SHA1 Message Date
Mike Bayer befe7ffcb8 use ..deprecated directive w/ version in all cases
These changes should be ported from 1.3 back to 1.0 or
possibly 0.9 to the extent they are relevant in each
version. In 1.3 we hope to turn all deprecation documentation
into warnings.

(cherry picked from commit 77e9534673d58f2f4c33d16c0ed4e8671cea48b6)
(cherry picked from commit dcfe5a3f8929a11fd8d89b3b34449e1894bb2a3b)

Change-Id: I205186cde161af9389af513a425c62ce90dd54d8
2019-01-12 18:14:21 -05:00
Lele Gaifax 74838dda2f commit 1b774808c926665047bf353222ecd191679a95d1
Author: Lele Gaifax <lele@metapensiero.it>
Date:   Tue Dec 25 12:35:41 2018 +0100

    Consistently use "PostgreSQL", fixing also a few doc glitches

commit 0e382aaee4427193926f0dc10ad29056bc12c85e
Author: Lele Gaifax <lele@metapensiero.it>
Date:   Tue Dec 25 12:08:49 2018 +0100

    Remove duplicated words

Change-Id: Iaa586b9412f46a50fe6ff3bbb92e07d6cb1905c8
(cherry picked from commit c0f9708fde)
(cherry picked from commit 7ec092063a)
2018-12-30 21:23:37 -05:00
Mike Bayer c3be61261b Rewrite the convert_unicode docs and add tons of dragons
These flags will all be going away as Python 3 has solved
all of this.

Change-Id: I4f581d8dd7826dd823b671d0d8e72250284236c8
(cherry picked from commit 7f12f63c3a)
2018-12-21 12:14:09 -05:00
Mike Bayer b7ad656e06 Document and support nested composites
Composites can behave in a "nested" fashion by defining the
class in that way.   To make the constructor more convenient,
a callable can be passed to :func:`.composite` instead of the
class itself.  This works now, so add a test to ensure this
pattern remains available.

Change-Id: Ia009f274fca7269f41d6d824e0f70b6fb0ada081
(cherry picked from commit d4a130bb1b)
2018-12-12 12:56:57 -05:00
Raphael 84d0cae53a typo
typo

(cherry picked from commit 0a0b36686d)
2018-11-30 10:10:20 -05:00
Mike Bayer 4c75dead12 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
(cherry picked from commit 1f13c8c833)
2018-11-06 15:14:51 -05:00
Mike Bayer 92c20be2c2 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
(cherry picked from commit a8781b51b4)
2018-10-14 19:17:40 -04:00
Glyph 2a2de61f02 minor spelling correction
(cherry picked from commit 35a458c782)
2018-09-07 17:34:00 -04:00
Mike Bayer 2734fa55c8 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.

Change-Id: Id2c6a29800f7b723573610e4707aec7e6ea38f5f
(cherry picked from commit 71b01adc7b)
2018-09-06 10:45:02 -04:00
Mike Bayer 1351fa1386 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.

Change-Id: Ia9341a82485ef7201bb8130d8dbf4a9b6976035a
(cherry picked from commit 081d4275cf)
2018-08-30 17:13:58 -04:00
Mike Bayer 2e0f06df91 Fix links and update verbiage for reset_on_return
Change-Id: I642056b78570b44fdefe7f0874a8e4c720389f14
(cherry picked from commit d8bb208a85)
2018-08-28 14:59:00 -04:00
Mike Bayer a40ef14325 Document binary_prefix for mysqlclient and PyMySQL
Also, remove the section on "use_unicode=0", there is no reason
anyone should be using that now.

Fixes: #4216
Change-Id: I5b8b53e40903adf339af2934a4f2d8b068818ebf
(cherry picked from commit c3869f2383)
2018-08-17 19:33:59 -04:00
Mike Bayer 7f6b272507 Write a much better section about server defaults
Include information about eager_defaults etc.  These
docs were written before we had all the features
we do now.

Change-Id: Ie62e58c5986698824f717e9f8c802b07a27517d4
Fixes: #4317
(cherry picked from commit 82dfcf43de)
2018-08-09 13:35:24 -04:00
Logan Rosen 064fb78103 Update URL for PyMySQL documentation
(cherry picked from commit b694a309e8)
2018-06-28 16:13:00 -04:00
Mike Bayer 122ca52632 - add a tl;dr to postgresql search_path section as it's long
and will be easier to read if we know where it's going first.

Change-Id: I2766cf4655451ed514d4dc95ac60406b9f4a8ddb
(cherry picked from commit 513a6e5bce)
2018-05-06 09:02:56 -04:00
Mike Bayer 2ae99b671c 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

Change-Id: I6e576165f06387350ae97e43ad979e575a4912b9
(cherry picked from commit 39d7dfa08a)
2018-03-07 16:03:58 -05:00
Mike Bayer e2aea6e3e2 Version 1.1.19 placeholder 2018-03-06 14:10:39 -05:00
Mike Bayer cc6ec001b2 Only replace first occurrence for COLLATE/ARRAY syntax
Fixed bug in Postgresql COLLATE / ARRAY adjustment first introduced
in 🎫`4006` where new behaviors in Python 3.7 regular expressions
caused the fix to fail.

Change-Id: Ied3893d7cac210befa0277b55b3b895b0ba1f0d2
Fixes: #4208
(cherry picked from commit 7300469f71)
2018-03-05 15:53:06 -05:00
Mike Bayer 8064be5b00 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.

Change-Id: Iafd39be8c9bf1982d58b34cc997ae1016ad6c48c
Fixes: #4205
(cherry picked from commit 9ba77e8d3b682bff89fdab5e80271a96a52fe8c8)
(cherry picked from commit 5c1ebbc370)
2018-03-03 16:16:32 -05:00
Mike Bayer 1127fe7407 - add some seealsos for the transient object that loads use case
Change-Id: Ibfa79a3721f31806223906cccf4547673b3d42f1
(cherry picked from commit 5de2e17b6e)
2018-03-02 11:59:15 -05:00
Mike Bayer 6e2bb7686e Fix enable_relationship_loading() works fine w/ one-to-many
Change-Id: I6efb62afa02be4d42482cfdbec739a5c6ab32bd7
(cherry picked from commit fde2f77fd1978d4162ab01bc05bb5c793bc733b2)
2018-03-02 10:46:18 -05:00
Mike Bayer ad1c56b3a2 Version 1.1.18 placeholder 2018-02-22 16:16:11 -05:00
Mike Bayer b37f007732 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 🎫`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.

Change-Id: I87d0ac09f695dc285bd4bbe0a547f1d5ce23e068
Fixes: #4185
(cherry picked from commit 93881f7873048403b62cc3e179354712ba8e9282)
2018-02-20 16:42:24 -05:00
Mike Bayer 1337d73421 Version 1.1.17 placeholder 2018-02-16 17:36:45 -05:00
André Cruz 683e5a2dd4 Add ssl "operation timed out" message for psycopg2
Added "SSL SYSCALL error: Operation timed out" to the list
of messages that trigger a "disconnect" scenario for the
psycopg2 driver.  Pull request courtesy André Cruz.

Change-Id: Ie1a8fc97e74b6906ccacf53dad70fed973c42b7f
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/3
(cherry picked from commit 2f03ec08b5)
2018-02-15 12:48:43 -05:00
Mike Bayer f1125b79cc 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.

Change-Id: I31b1d22408e358962577435f0c4cb9a456ba0872
Fixes: #4187
(cherry picked from commit 8607ae51fc)
2018-02-12 17:06:03 -05:00
Mike Bayer cc6cef5184 Search through mapper superclass hierarchy for owner
Fixed regression caused by fix for issue 🎫`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.

Change-Id: I611b590df2babe077ce6c19bea89e84251d1a7f4
Fixes: #4185
(cherry picked from commit 650b9eddae)
2018-02-09 16:31:24 -05:00
mike bayer d41ab3d108 Merge "Ensure weakref finalize_fairy operates upon the current connection" into rel_1_1 2018-02-09 08:40:17 -05:00
Mike Bayer c2f29f33ac - fix formatting
Change-Id: Ic919048462520de8de84174a5e366d6c85316e87
(cherry picked from commit ea3fd42495)
2018-02-08 16:47:05 -05:00
Mike Bayer 6c6f865541 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.

Change-Id: Iabd9f3a63a1d0207d0de0054a6ced3560818cf9c
Fixes: #4184
(cherry picked from commit ab1f524c355c0bbac68485a60cb99e7a9d0f944a)
2018-02-08 14:56:19 -05:00
Mike Bayer 646b803297 - ensure it's clear that all DDLEvents can be associated
using propagate=True, which is consulted within the scope
of Table.tometadata().  Fixes: #4179

Change-Id: I0cb0d8f6a894bb645cfc94b3d9083339039c9193
(cherry picked from commit 56ff3c5270)
2018-02-02 15:47:48 -05:00
Mike Bayer 54ebae8bcd Further refine map_column verbiage
The verbiage here continues to be misleading as it implies that
a MapperProperty already exists for the Column when this is not
the case.

Change-Id: Iaa6990dc9693d47d50b15c4815c3c7f6f34d8577
(cherry picked from commit bc9cdd5de0)
2018-01-25 09:18:14 -05:00
Mike Bayer f5b84ab2c5 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.

Change-Id: I20bd286f541f798daa81fa598c0f31db1f5aa6ed
(cherry picked from commit 8250a4248f)
2018-01-24 18:03:58 -05:00
Mike Bayer 0b04471331 happy new year
Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
(cherry picked from commit 699272e4dc)
2018-01-12 14:25:17 -05:00
Aubrey Stark-Toller 8e112ad2cc ValuesBase.values inconsistency fix
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.

Change-Id: I9d3b40b5950df8f5bfdc8b1d22f9c3afb277f17f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/412
Fixes: #4162
(cherry picked from commit ab2165e6d6)
2018-01-12 11:30:05 -05:00
Mike Bayer a71e1ea211 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.

Change-Id: I57e2888902015d67ee11857e44382818f1d2f8bc
Fixes: #4151
(cherry picked from commit 5811276bb7)
2018-01-04 14:11:00 -05:00
Jacob Hayes fe84543cc7 Add TRUNCATE to postgres autocommit regexp
Extends AUTOCOMMIT_REGEXP for the postgres dialect to include `TRUNCATE`.

Change-Id: I315e03674b89bb89aae669b8655481e4d890491e
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/407
(cherry picked from commit 756d578287)
2017-12-18 11:33:37 -05:00
Jacob Hayes 9f3bf6b506 Fix import in Inspector.reflecttable doc
(cherry picked from commit e6b290df27)
2017-12-15 09:50:04 -05:00
Lele Gaifax 1be8f9597b add nullsfirst() / nullslast() to top-level imports
Change-Id: Ieefcc4c30c1c17f43f2908d961e00815bae862bb
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/378
(cherry picked from commit d507ea00a9)
2017-11-16 09:35:13 -05:00
Mike Bayer a616c0566d 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

Change-Id: Iaf54ac18949cc6a54f50678125f010b4f12c5673
Fixes: #4136
(cherry picked from commit 4f054550b7)
2017-11-13 09:24:02 -05:00
Mike Bayer 0274d80f83 Version 1.1.16 placeholder
Change-Id: Ia563c801f5f467084c49fc367f31b2385e0777bb
2017-11-03 17:07:06 -04:00
Mike Bayer b3502459c3 Fix as many RST parse warnings as possible.
Still a few I can't get.   Also 0.9 is EOL so hide the
unreleased notes.

Change-Id: If0e44d4a0b3e78e211f32d5c33b51b1a007c9c69
(cherry picked from commit 75bdcd096f)
2017-11-03 14:47:52 -04:00
Mike Bayer 4e4642d5d8 Add doc note for contains_eager() w/ subclasses.
Change-Id: I9634136e1855a081c25b04bb6ae8248f0f94be1c
Fixes: #4130
(cherry picked from commit 152522b3f2)
2017-11-02 13:54:04 -04:00
Nicolas CANIART d91edf2511 Accommodate tuples for ColumnDefault.__repr__
Fixed bug where ``__repr__`` of :class:`.ColumnDefault` would fail
if the argument were a tuple.  Pull request courtesy Nicolas Caniart.

Change-Id: I08aa2448ef91054c43d6068ac54cedbdf7a83d64
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/1
Fixes: #4126
(cherry picked from commit 5acc9b149a)
2017-10-31 11:40:00 -04:00
Mike Bayer a92f6316ed - add notes that @comparator and @expression don't go together.
Change-Id: I3fb366f8b49454453e4b6dada565c24c5ccb975e
(cherry picked from commit 8965f30215)
2017-10-30 20:03:24 -04:00
Mike Bayer e06bf169e5 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.

Change-Id: I407b07a3a3e2c374da19fc86ed44b987d595dcfa
Fixes: #4124
(cherry picked from commit fd4289c582)
2017-10-28 13:30:18 -04:00
Mike Bayer e111940156 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.

Change-Id: I9161bab67766bb75d73ca54d712ad1cad6de40dc
Fixes: #4116
(cherry picked from commit f14a58dea4)
2017-10-23 20:36:18 -04:00
Daniel Thorell 71c9b49141 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 41cfe44b5e)
Co-authored by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #4120
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/391
Change-Id: I4d2e04df760c5351a71dde8b32145cdc69fa6115
2017-10-23 19:06:28 -04:00
Mike Bayer b6479c33da Get MariaDB normalized version relative to "MariaDB" token
Fixed regression from 1.2.0b3 where "MariaDB" version comparison can
fail for some particular MariaDB version strings under Python 3.

For 1.1, this was merged as part of #4097

Change-Id: Iedf49f40c1614ccedf63e0fa26719dd704da104d
Fixes: #4115
(cherry picked from commit 57f7788ec2)
2017-10-23 18:51:53 -04:00
Paul Anton Letnes 8d953a91c2 Add missing space in repr of the sessionmaker class
The missing space was driving me nuts.

(cherry picked from commit b343dc5611)
2017-10-20 12:05:39 -04:00