Commit Graph

11017 Commits

Author SHA1 Message Date
Mike Bayer eb859dcd2c 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.

Change-Id: I9367a7978cadc59066e89fc4917d7eb6c78dedee
Fixes: #4078
(cherry picked from commit 8ba8dd23b7)
2017-10-03 14:42:49 -04:00
Mike Bayer 2a8167f241 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

Also cherry-picks f846a789b7 from master
to repair 'postgres'-deprecation warning test for multiple
calls within a single process

Change-Id: I5f8aee0f5ed423461be5a9060c812eb0acdc7df5
(cherry picked from commit 67ee56be69)
2017-10-03 13:01:58 -04:00
Mike Bayer 8948d961b2 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.

Change-Id: I073a72cb47dc4f8c5683000d708768523759332f
Fixes: #4099
(cherry picked from commit 68b52c48b7)
2017-09-29 18:45:36 -04:00
Mike Bayer 917a971764 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 🎫`4097`).  Reflection
now takes these CHECK constraints into account when they are present in
the ``SHOW CREATE TABLE`` output.

Fixes: #4098

Change-Id: I8666d61814e8145ca12cbecad94019b44af868e3
(cherry picked from commit 29b752f8b2)
2017-09-29 13:21:16 -04:00
Mike Bayer c036078299 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 2efd89d029, not
part of rel_1_1.    The change here was not reviewed or tested
in gerrit and breaks the main branch.

Change-Id: I41746f890e6e82acfb12e78f174d00d7ba7d19d4
Fixes: #4097
2017-09-28 19:31:13 -04:00
Mike Bayer 865d915d0e Remove unused .cascading from unit test for __table_cls__ feature
Two independent gerrits for 04bbad660b
and ec1700ba29 produce a failure
when merged due to new warning.
will merge into rel_1_1 as well for completeness even though
warning is not there.

Change-Id: I1bd494d205107d8b2a30d475a22c61a59b70985b
(cherry picked from commit 21ff71b0eb)
2017-09-28 13:07:45 -04:00
Mike Bayer c88d4d0e94 Warn for mariadb 10.2 < 9
There's a few CHECK constraint issues we managed
to get resolved as of MariaDB 10.2.8 then 10.2.9.   They
are pretty severe so warn users for these particular mariadb
versions.

Change-Id: Ie0899f94fda25960975ebee72f3044370f43eb7c
Fixes: #4097
(cherry picked from commit 21bf37f6e4)
2017-09-28 12:34:33 -04:00
mike bayer eae1edc749 Merge "Add full list of pyodbc error codes for MSSQL" into rel_1_1 2017-09-28 12:07:29 -04:00
Mike Bayer 124c14c6e4 - add more dragons to session.begin() / autocommit docs
Change-Id: I9e326f353d396321565dfbf53b7a30f18d8c86e9
(cherry picked from commit 1ec7ba52e1)
2017-09-28 11:44:09 -04:00
Mike Bayer d44d8b28aa - tweak the handle_error docs a bit
Change-Id: Iebe5b13b3a568f3aa0f3ab02a55e2a9cbb4545c7
(cherry picked from commit e1a923dc5a)
2017-09-28 09:59:37 -04:00
Mike Bayer af70c3022f Add full list of pyodbc error codes for MSSQL
Moved the SQL server error codes out of connnectors/pyodbc.py
and into mssql/pyodbc.py.  Added complete list
of odbc-related disconnect codes.

Change-Id: Icd84a920dbfa1f188847f859654ff6f7a48170f1
Fixes: #4095
(cherry picked from commit 6a38697261)
2017-09-28 09:41:40 -04:00
mike bayer 171e6efd35 Merge "Support method form of any_(), all_()" into rel_1_1 2017-09-27 18:10:18 -04:00
Mike Bayer 3a8a8b9bc5 Support method form of any_(), all_()
Fixed bug where the recently added :meth:`.ColumnOperators.any_`
and :meth:`.ColumnOperators.all_` methods didn't work when called
as methods, as opposed to using the standalone functions
:func:`~.expression.any_` and :func:`~.expression.all_`.  Also
added documentation examples for these relatively unintuitive
SQL operators.

Change-Id: I3e56b463e9fd146a077b9970624f50cba27f9811
Fixes: #4093
(cherry picked from commit 944c662d8a)
2017-09-27 15:50:07 -04:00
mike bayer 0c608ebec6 Merge "Accomodate for multidimensional array in rewriting for COLLATE" into rel_1_1 2017-09-27 15:48:02 -04:00
Mike Bayer f66a3dfc9c Accomodate for multidimensional array in rewriting for COLLATE
Made further fixes to the :class:`.ARRAY` class in conjunction with
COLLATE, as the fix made in 🎫`4006` failed to accommodate
for a multidimentional array.

Change-Id: If3e438f8ce94ebae2196671c88a4914f3b743e60
Fixes: #4006
(cherry picked from commit 6652f72352)
2017-09-27 09:49:11 -04:00
Mike Bayer d1ca3a8d46 Document and test __table_cls__
A use case has been identified for __table_cls__, which was
added in 1.0 just for the purpose of test fixtures.   Add this to
public API and ensure the target use case (conditional table generation)
stays supported.

Change-Id: I87be5bcb72205cab89871fa586663bf147450995
Fixes: #4082
(cherry picked from commit 04bbad660b)
2017-09-26 11:39:08 -04:00
Michael Smirnov d00a4f7cab Fixed a typo in before_execute doc.
events.py edited online with Bitbucket

(cherry picked from commit e0ddf30bf6)
2017-09-25 17:25:20 -04:00
Mike Bayer a14e5c42ca use the stack to get the insert statement in on conflict
Fixed bug in Postgresql :meth:`.postgresql.dml.Insert.on_conflict_do_update`
which would prevent the insert statement from being used as a CTE,
e.g. via :meth:`.Insert.cte`, within another statement.

Change-Id: Ie20972a05e194290bc9d92819750845872949ecc
Fixes: #4074
(cherry picked from commit 7051653610)
2017-09-12 12:58:55 -04:00
Mike Bayer 21ca9b50c7 Version 1.1.15 placeholder
Change-Id: I81fd38694b19ee9dadaf89276dd4fe9bd6f67c94
2017-09-05 13:06:29 -04:00
Mike Bayer 4b22b01ade - 1.1.14 rel_1_1_14 2017-09-05 10:26:00 -04:00
Mike Bayer 2cdb0777c2 - 1.1.14 placeholder
Change-Id: I1648f7780cc0accdfe7650a62754b39c8e5552a8
2017-09-05 09:56:17 -04:00
mike bayer ba9c238d7e Merge "Guard against KeyError in session.merge after check for identity" into rel_1_1 2017-09-05 09:46:05 -04:00
mike bayer 04958bb7d7 Merge "Check for non-mapped property in synonym" into rel_1_1 2017-09-05 09:43:52 -04:00
Mike Bayer 68953902dd Guard against KeyError in session.merge after check for identity
Fixed bug in :meth:`.Session.merge` following along similar lines as that
of 🎫`4030`, where an internal check for a target object in
the identity map could lead to an error if it were to be garbage collected
immediately before the merge routine actually retrieves the object.

Change-Id: Ifecfb8b9d50c52d0ebd5a03e1bd69fe3abf1dc40
Fixes: #4069
(cherry picked from commit bfad032017fde2e519ad5eacc0011a71bf7a22a9)
2017-09-04 19:36:51 -04:00
Mike Bayer 8ec1369eb3 Check for non-mapped property in synonym
An :class:`.InvalidRequestError` is raised when a :func:`.synonym`
is used against an attribute that is not against a :class:`.MapperProperty`,
such as an association proxy.  Previously, a recursion overflow would
occur trying to locate non-existent attributes.

Change-Id: If2ce38c429a69951df4c94b71b74edbd59d775e3
Fixes: #4067
(cherry picked from commit 130f31ca79)
2017-09-04 18:56:38 -04:00
Mike Bayer a3965ea5ff Always check that discarded state is the expected one
Fixed race condition in ORM identity map which would cause objects
to be inappropriately removed during a load operation, causing
duplicate object identities to occur, particularly under joined eager
loading which involves deduplication of objects.  The issue is specific
to garbage collection of weak references and is observed only under the
Pypy interpreter.

Change-Id: I9f6ae3fe5b078f26146af82b15d16f3a549a9032
Fixes: #4068
(cherry picked from commit 37c5ed2ed9)
2017-09-04 16:22:51 -04:00
Mike Bayer 4be865f79b Add InternalError for mysqlclient disconnect
mysqlclient as of 1.3.11 changed the exception
class for a particular disconnect situation from
InterfaceError to InternalError; the disconnection
detection logic now accommodates this.

Change-Id: I294f90f794491fd363548719222d8e3008480615
Fixes: #4065
(cherry picked from commit 65680b2343)
2017-09-01 12:32:44 -04:00
Mike Bayer 5dc3eed55e include a note about the importance of type coerce for custom ops
Change-Id: Ia7dab65523d6a34fcc92ee785ffe03f7e2a33cfd
(cherry picked from commit 56845d8cc2)
2017-09-01 10:52:47 -04:00
Mike Bayer 5243341ed8 Consider merge key with (None, ) as non-persistent
Fixed bug in :meth:`.Session.merge` where objects in a collection that had
the primary key attribute set to ``None`` for a key that is  typically
autoincrementing would be considered to be a database-persisted key for
part of the internal deduplication process, causing only one object to
actually be inserted in the database.

Change-Id: I0a6e00043be0b2979cda33740e1be3b430ecf8c7
Fixes: #4056
2017-08-31 16:23:42 -04:00
Mike Bayer 89fab2824b - pin on cx_Oracle 6.0.1 for the moment while we wait for
either https://github.com/oracle/python-cx_Oracle/issues/75
to be fixed or we can merge a workaround

Change-Id: Ia3927337fb48824e0fdc764ed3a9d4930ca7a9c6
(cherry picked from commit de73c6d1cd)
2017-08-31 16:23:26 -04:00
Mike Bayer fb55270835 Allow for multiple FOLLOWING/PRECEDING in a window range
Altered the range specification for window functions to allow
for two of the same PRECEDING or FOLLOWING keywords in a range
by allowing for the left side of the range to be positive
and for the right to be negative, e.g. (1, 3) is
"1 FOLLOWING AND 3 FOLLOWING".

Change-Id: I7d3a6c641151bb49219104968d18dac2266f3db8
Fixes: #4053
(cherry picked from commit 3a5bbe4cbe)
2017-08-25 09:43:38 -04:00
Mike Bayer 3b5840f16a Ensure col is not None when retrieving quick populators
Fixed bug where an :func:`.undefer_group` option would not be recognized
if it extended from a relationship that was loading using joined eager
loading.

In particular we need to double check the column both in terms of
the given "adapter" as well as without applying the "adapter"
when searching for the column in the result.

As we now avoid redoing the row processor step we also
improve on callcounts in joined eager loading.

Change-Id: I0f48766f12f7299f4626ff41a00bf1f5bfca5f3b
Fixes: #4048
(cherry picked from commit eee9dfd4514801f0c67f71632fc722731171479b)
2017-08-24 09:41:12 -04:00
Mike Bayer 4f27454fd3 - sanitize class names for junit reporting
Change-Id: I42821d8324208b708adc17a10b1a2758797cb9db
(cherry picked from commit a61ff195b5)
2017-08-24 09:38:25 -04:00
Mike Bayer af15353315 Restore original test names
The change in de1f8f8345
modified how test classes are named, breaking logic that
extracts the class name for the profiling suite.
Add a new variable _sa_orig_cls_name if we've modified the
name so that the profiling logic doesn't need to guess
the original class name.

Change-Id: Ica15a97408b9e0749a78c87f62749c15c1627009
(cherry picked from commit bb9d511e52)
2017-08-24 09:37:47 -04:00
Mike Bayer b63d815c21 Allow multiple versions of single backend
Improve screen output to illustrate which server version is
running for a particular database config, and additionally
allow full overriding for the backend-specific targets in
tox.ini via environment variables, so that CI can inject
multiple server urls for a particular database such as MySQL/MariaDB.

Change-Id: Ibf443bb9fb82e4563efd1bb66058fa9989aa2fda
(cherry picked from commit de1f8f8345)
2017-08-24 09:33:42 -04:00
Mike Bayer 186da1c122 - remove 3.4's
Change-Id: Ib2089e812d16d7792d7b3d5bfe103abe19221a00
2017-08-23 17:33:42 -04:00
Mike Bayer 84a59d9776 - add posargs so we can run profile regenon individual tests
Change-Id: I298e57a5fc920b2563e4f42367f821e0719c0be6
2017-08-23 17:25:13 -04:00
Mike Bayer 6a8955f32b - fix typos
Change-Id: Ibf8bc0e997ff989c7b0c16afad48a95414078052
(cherry picked from commit d8a80a35a0)
2017-08-22 18:16:08 -04:00
Mike Bayer b6412f6029 - modernize the mysql connection timeout docs
Change-Id: Icb0474509539c1eb7536544749f2a48b4972078a
(cherry picked from commit 4ce46fb0a085c1cc739e21881cc25567e663f8dc)
2017-08-22 16:50:33 -04:00
Mike Bayer 53175850bf First level repair for cx_Oracle 6.0 test regressions
Fixed more regressions caused by cx_Oracle 6.0; at the moment, the only
behavioral change for users is disconnect detection now detects for
cx_Oracle.DatabaseError in addition to cx_Oracle.InterfaceError, as
this behavior seems to have changed.   Other issues regarding numeric
precision and uncloseable connections are pending with the upstream
cx_Oracle issue tracker.

Change-Id: Id61f1e33b21c155a598396340dfdecd28ff4066b
Fixes: #4045
(cherry picked from commit 03255a5a0f)
2017-08-22 14:44:39 -04:00
Mike Bayer d6018ef3a2 - ensure identifier re-use doesn't make this break
Change-Id: I9fe6c42c097d31b50a479250d39a3cd8ebcbffaf
(cherry picked from commit 41549de960)
2017-08-22 13:56:06 -04:00
Mike Bayer 35e879fcde - allow a separate template database to be used for
PG CREATE DATABASE.  as nobody will connect to it that would
solve the contention issue here
- backport --nomemory since tox.ini is using it

Change-Id: I00a4d52091876e120faff4a8a5493c53280d96f1
(cherry picked from commit 4c30681839)
2017-08-22 13:25:58 -04:00
Mike Bayer a1d78a2ce8 - repair --dbs
Change-Id: I69e39d2368f50b126c369ecc35e01799fd013254
(cherry picked from commit 3fc6f32ddc)
2017-08-22 13:07:36 -04:00
Mike Bayer e46eea26d3 - still supporting py2.6 in 1.1 (!)
Change-Id: Iaaababf83b9c3a6e4dc784fc9807bed01c90b69b
2017-08-22 09:41:40 -04:00
Mike Bayer 0594e37513 - simplify and see if it still works
Change-Id: Id0cf7ae2223507d413aaa22e5f8df066b7ac2b46
(cherry picked from commit fe5eede555)
2017-08-21 22:17:24 -04:00
Mike Bayer 9ceddec38f merge PG fixes from master
Change-Id: I5630eb8ba503c567bebddd10f6e525ceb3dd5998
2017-08-21 20:15:21 -04:00
hsmtkk 320ba61529 fix a typo
(cherry picked from commit 58fb83c45b)
2017-08-21 16:28:29 -04:00
Mike Bayer ecf38bf712 - filter out non-oracle URLs
Change-Id: I475f744f8801bc923d738e466d208d662e707413
(cherry picked from commit 97e455f21b)
2017-08-21 12:10:55 -04:00
Mike Bayer 42f11fe80b - this test doesn't work in strict mode, not that important
Change-Id: I3ed361af5c9f0c7acbeb8b534966828949f4958b
(cherry picked from commit 63d47c051d)
2017-08-21 12:10:41 -04:00
Mike Bayer cc3d1e057d - a few mysql fixes, more to come
Change-Id: Icdcc8ed03374251b8d3815ae58e2726ea27c14b4
(cherry picked from commit 64032a35ae)
2017-08-21 12:10:28 -04:00