Commit Graph

5212 Commits

Author SHA1 Message Date
Mike Bayer cd3ea1d56b - move out match compiler test to test_compiler
- test_query isn't assertscompiledsql

(cherry picked from commit 269313218d)
2016-01-23 14:33:40 -05:00
Mike Bayer 82300be016 - add missing IGNORE_EXCEPTION_DETAIL flag 2016-01-21 17:30:56 -05:00
Mike Bayer 107f1f47b9 - add a forwards-test here as well
(cherry picked from commit 38958f7b3f)
2016-01-21 15:33:18 -05:00
Mike Bayer 9cc769ac40 - documenation updates to clarify specific SQLite versions
that have problems with right-nested joins and UNION column keys;
references #3633 references #3634.   backport from 1.1 to 0.9
announcing 1.1 as where these behaviors will be retired based
on version-specific checks
- fix test_resultset so that it passes when SQLite 3.10.0 is
present, references #3633

(cherry picked from commit 89fa08792e)
2016-01-21 15:23:56 -05:00
Mike Bayer 23e60cd8eb - Fixed bug where some exception re-raise scenarios would attach
the exception to itself as the "cause"; while the Python 3 interpreter
is OK with this, it could cause endless loops in iPython.
fixes #3625
- add tests for reraise, raise_from_cause
- raise_from_cause is the same on py2k/3k, use just one function

(cherry picked from commit d4d9a65248)
2016-01-18 17:36:27 -05:00
Mike Bayer a36ace7ae3 - there was a DATEPART test after all, fix format
(cherry picked from commit 0ff3f95d5b)
2016-01-14 17:50:23 -05:00
Guillaume DOUMENC dc733bcea6 Remove quote on first DATEPART paramater
(cherry picked from commit c4f415d979)
- changelog for pr bitbucket:70, fixes #3624

(cherry picked from commit 215167d8d3)
2016-01-12 09:54:50 -05:00
Mike Bayer 61d2ceb681 - Fixed regression since 0.9 where the 0.9 style loader options
system failed to accommodate for multiple :func:`.undefer_group`
loader options in a single query.   Multiple :func:`.undefer_group`
options will now be taken into account even against the same
entity. fixes #3623

(cherry picked from commit c7ae0daf0e)
2016-01-09 10:10:51 -05:00
Mike Bayer 6ba8382fa8 - Fixed 1.0 regression where the eager fetch of cursor.rowcount was
no longer called for an UPDATE or DELETE statement emitted via plain
text or via the :func:`.text` construct, affecting those drivers
that erase cursor.rowcount once the cursor is closed such as SQL
Server ODBC and Firebird drivers.
fixes #3622

(cherry picked from commit 197ffa2be2)
2016-01-05 10:26:12 -05:00
Mike Bayer 40cc8f4467 - An adjustment to the regular expression used to parse MySQL views,
such that we no longer assume the "ALGORITHM" keyword is present in
the reflected view source, as some users have reported this not being
present in some Amazon RDS environments.
fixes #3613

(cherry picked from commit 8c54b14b5c)
2015-12-22 12:05:12 -05:00
Mike Bayer 10735365a8 - varchar requires a length
(cherry picked from commit 0c8242b26e)
2015-12-22 11:20:01 -05:00
Mike Bayer 2bf15f4423 - add the test from ref #3614 as well for testing ref #3611
(cherry picked from commit 4b708c4839)
2015-12-21 21:43:13 -05:00
Mike Bayer f1fcc92e36 - Further fixes to 🎫3605, pop method on :class:.MutableDict,
where the "default" argument was not included.
fixes #3605

(cherry picked from commit 913858c949)
2015-12-17 11:25:05 -05:00
Mike Bayer c3876fe755 - Fixed bug in baked loader system where the systemwide monkeypatch
for setting up baked lazy loaders would interfere with other
loader strategies that rely on lazy loading as a fallback, e.g.
joined and subquery eager loaders, leading to ``IndexError``
exceptions at mapper configuration time.
fixes #3612

(cherry picked from commit a22b208506)
2015-12-15 21:44:33 -05:00
Mike Bayer 4765b33f80 - Fixed regression caused in 1.0.10 by the fix for 🎫3593 where
the check added for a polymorphic joinedload from a
poly_subclass->class->poly_baseclass connection would fail for the
scenario of class->poly_subclass->class.
fixes #3611

(cherry picked from commit a8ec349198)
2015-12-15 14:01:34 -05:00
Mike Bayer 7184e69e27 - add some more oracle skips
(cherry picked from commit c42725ed54)
2015-12-14 20:22:21 -05:00
Mike Bayer bf9a53af2e - Fixed bug where :meth:.Session.bulk_update_mappings and related
would not bump a version id counter when in use.  The experience
here is still a little rough as the original version id is required
in the given dictionaries and there's not clean error reporting
on that yet.
fixes #3610

(cherry picked from commit 26ed90ab22)
2015-12-14 17:40:12 -05:00
Mike Bayer a6387b0df8 - Fixed bug in :meth:.Update.return_defaults which would cause all
insert-default holding columns not otherwise included in the SET
clause (such as primary key cols) to get rendered into the RETURNING
even though this is an UPDATE.

- Major fixes to the :paramref:`.Mapper.eager_defaults` flag, this
flag would not be honored correctly in the case that multiple
UPDATE statements were to be emitted, either as part of a flush
or a bulk update operation.  Additionally, RETURNING
would be emitted unnecessarily within update statements.

fixes #3609

(cherry picked from commit 0e4c4d7efc)
2015-12-14 17:30:42 -05:00
Mike Bayer 609d7bf8fb - Fixed bug where use of the :meth:.Query.select_from method would
cause a subsequent call to the :meth:`.Query.with_parent` method to
fail. fixes #3606
- add mark-as-fail test for #3607

(cherry picked from commit 7d96ad4d53)
2015-12-12 21:12:00 -05:00
Mike Bayer 9b7870dd59 - Added support for the `dict.pop() and dict.popitem()` methods
to the :class:`.mutable.MutableDict` class.
fixes #3605

(cherry picked from commit 5710a1e88b)
2015-12-11 11:24:58 -05:00
Mike Bayer 89966db3e8 - The ORM and Core tutorials, which have always been in doctest format,
are now exercised within the normal unit test suite in both Python
2 and Python 3.
- remove the old testdocs.py runner and replace with test/base/test_tutorials.py
- use pytest's unicode fixer so that we can test for unicode strings
in both py2k/3k
- use py3k format overall for prints, exceptions
- add other fixers to guarantee deterministic results
- add skips and ellipses to outputs that aren't worth matching

(cherry picked from commit d533b8e922)
2015-12-10 17:18:06 -05:00
Mike Bayer 6d44b01263 - Fixed issue within the :meth:.Insert.from_select construct whereby
the :class:`.Select` construct would have its ``._raw_columns``
collection mutated in-place when compiling the :class:`.Insert`
construct, when the target :class:`.Table` has Python-side defaults.
The :class:`.Select` construct would compile standalone with the
erroneous column present subsequent to compilation of the
:class:`.Insert`, and the the :class:`.Insert` statement itself would
fail on a second compile attempt due to duplicate bound parameters.
fixes #3603

(cherry picked from commit e57bf79616)
2015-12-09 18:15:57 -05:00
Mike Bayer 67b22cee3a - fix changelog for #3602
- add version switch for backend fsp test
2015-12-08 13:49:56 -05:00
Mike Bayer 7574762aa0 - make this DROP conditional, attempting to isolate why jenkins has
an issue with just one test

(cherry picked from commit 7df4054b04)
2015-12-08 10:42:44 -05:00
Mike Bayer f3137aa459 - Fixed bug in MySQL reflection where the "fractional sections portion"
of the :class:`.mysql.DATETIME`, :class:`.mysql.TIMESTAMP` and
:class:`.mysql.TIME` types would be incorrectly placed into the
``timestamp`` attribute, which is unused by MySQL, instead of the
``fsp`` attribute.
fixes #3602

(cherry picked from commit 3f42743d6a)
2015-12-07 17:25:27 -05:00
Mike Bayer c18ff4e404 - flake8 test_reflection and rework the type-based tests into
individual categories w/ modernized fixtures, assert attributes
within type objects.

(cherry picked from commit d7eae8c95c)
2015-12-07 17:25:23 -05:00
Mike Bayer 74fcb4b867 - Fixed issue where post_update on a many-to-one relationship would
fail to emit an UPDATE in the case where the attribute were set to
None and not previously loaded.
fixes #3599

(cherry picked from commit 935bc34dc5)
2015-12-02 12:14:18 -05:00
Mike Bayer 7b5fd86a42 - Fixed bug where CREATE TABLE with a no-column table, but a constraint
such as a CHECK constraint would render an erroneous comma in the
definition; this scenario can occur such as with a Postgresql
INHERITS table that has no columns of its own.
fixes #3598

(cherry picked from commit 9695faf329)
2015-12-01 19:04:48 -05:00
Diana Clarke 104cfe149a - Postgres: Do not prefix table with schema in: "FOR UPDATE of <table>"
For example, this query:

    SELECT s1.users.name FROM s1.users FOR UPDATE OF s1.users

should actually be:

    SELECT s1.users.name FROM s1.users FOR UPDATE OF users

fixes #3573

(cherry picked from commit fd47fea6fb)
2015-11-30 13:06:39 -05:00
aisch bb2b486de5 fix postgresql exclude contraint to check when= against None rather than __bool__ eval
(cherry picked from commit 0921a6abbc)
2015-11-30 13:01:33 -05:00
Nils Philippsen 33c3aded3a py2k: accept unicode literals on :func:backref, too
Fixed bug where in Py2K a unicode literal would not be accepted as the
string name of a class or other argument within declarative using
:func:`.backref` on :func:`.relationship`.

amends commit e6f67f4805

(cherry picked from commit 58f73d2278)
2015-11-30 12:49:12 -05:00
Mike Bayer 730aa2140c - A descriptive ValueError is now raised in the event that SQL server
returns an invalid date or time format from a DATE or TIME
column, rather than failing with a NoneType error.  Pull request
courtesy Ed Avis.
pullreq github:206

(cherry picked from commit 03a3b5ffd3)
2015-11-30 12:20:23 -05:00
Iuri de Silvio ab87b518e1 Fix _assert_unorderable_types on py36.
The error message changed to:

`'<' not supported between instances of 'foo' and 'bar'`

(cherry picked from commit d9178320d6)
2015-11-30 11:53:34 -05:00
Jacob MacDonald 67cebd902d Update usages of getargspec to compat version.
The places inspect.getargspec was being used were causing problems for
newer Python versions.

(cherry picked from commit e8a5ed9c1c)
2015-11-30 11:41:09 -05:00
Mike Bayer d4fa1345ff - close the session
(cherry picked from commit 4fcd93afb8)
2015-11-29 21:51:02 -05:00
Mike Bayer 670fd506fe - Fixed an issue in baked queries where the .get() method, used either
directly or within lazy loads, didn't consider the mapper's "get clause"
as part of the cache key, causing bound parameter mismatches if the
clause got re-generated.  This clause is cached by mappers
on the fly but in highly concurrent scenarios may be generated more
than once when first accessed.
fixes #3597

(cherry picked from commit b0308a7b3a)
2015-11-29 11:43:30 -05:00
Mike Bayer d2d60acdcb - Added support for parameter-ordered SET clauses in an UPDATE
statement.  This feature is available by passing the
:paramref:`~.sqlalchemy.sql.expression.update.preserve_parameter_order`
flag either to the core :class:`.Update` construct or alternatively
adding it to the :paramref:`.Query.update.update_args` dictionary at
the ORM-level, also passing the parameters themselves as a list of 2-tuples.
Thanks to Gorka Eguileor for implementation and tests.
adapted from pullreq github:200

(cherry picked from commit c90f0a49f3)
2015-11-28 14:30:58 -05:00
Mike Bayer 2aeda9bd21 - Fixed bug which is actually a regression that occurred between
versions 0.8.0 and 0.8.1, due 🎫`2714`.  The case where
joined eager loading needs to join out over a subclass-bound
relationship when "with_polymorphic" were also used would fail
to join from the correct entity.
fixes #3593

(cherry picked from commit 1202e140b9)
2015-11-25 15:29:31 -05:00
Mike Bayer 7998f15b16 - Fixed joinedload bug which would occur when a. the query includes
limit/offset criteria that forces a subquery b. the relationship
uses "secondary" c. the primaryjoin of the relationship refers to
a column that is either not part of the primary key, or is a PK
col in a joined-inheritance subclass table that is under a different
attribute name than the parent table's primary key column d. the
query defers the columns that are present in the primaryjoin, typically
via not being included in load_only(); the necessary column(s) would
not be present in the subquery and produce invalid SQL.
fixes #3592

(cherry picked from commit 60c36ca841)
2015-11-21 16:48:05 -05:00
Mike Bayer 3eac2d89c2 - don't create tables on compile-only tests
(cherry picked from commit 068d37035a)
2015-11-21 16:20:45 -05:00
Mike Bayer 65d6a7ef2c - try to get this to skip for oracle
(cherry picked from commit ef9a4cb60b)
2015-11-20 18:20:09 -05:00
Mike Bayer caef13d8cf - A rare case which occurs when a :meth:.Session.rollback fails in the
scope of a :meth:`.Session.flush` operation that's raising an
exception, as has been observed in some MySQL SAVEPOINT cases, prevents
the original  database exception from being observed when it was
emitted during  flush, but only on Py2K because Py2K does not support
exception  chaining; on Py3K the originating exception is chained.  As
a workaround, a warning is emitted in this specific case showing at
least the string message of the original database error before we
proceed to raise  the rollback-originating exception.
fixes #2696

(cherry picked from commit a6fe4dc0c8)
2015-11-19 15:45:47 -05:00
Mike Bayer 29d6f6e19b - Fixed the `.python_type attribute of :class:.postgresql.INTERVAL`
to return ``datetime.timedelta`` in the same way as that of
:obj:`.types.Interval.python_type`, rather than raising
``NotImplementedError``.
fixes #3571
2015-11-19 15:10:46 -05:00
Mike Bayer e8c2e4a179 - rewrite the docs and add a test for the bake_queries=True
relationship flag; this flag *does* have an effect when the baked
lazy loader plugin has been invoked.  clarify the intent of this
flag as an "opt out" but only has an effect when the baked system
is loaded anyway.  fixes #3572

(cherry picked from commit c7f9aa2818)
2015-11-19 14:24:17 -05:00
Mike Bayer 08f056cf9c - extend pullreq github:213 to also include DATETIMEOFFSET and TIME,
which also accept zero precision
- extend test case here to include a backend-agnostic suite
- changelog for MSSQL date fix

(cherry picked from commit 0847097c29)
2015-11-14 12:40:34 -05:00
Jacobo de Vera f34deb456e Pass precision value to mssql.DATETIME2 when it is 0
The simple check on the precision results in DATETIME2(0) generating a
DATETIME2 column, with default precision, which is 7.

(cherry picked from commit 80ce23f6fd)
2015-11-14 12:40:20 -05:00
Mike Bayer e8638373a3 - use is_() here to more clearly show what's going wrong
on occasional pypy test runs

(cherry picked from commit 5bc5adb627)
2015-10-19 18:49:23 -04:00
Mike Bayer 4f54607923 - Fixed regression in 1.0 where new feature of using "executemany"
for UPDATE statements in the ORM (e.g. :ref:`feature_updatemany`)
would break on Postgresql and other RETURNING backends
when using server-side version generation
schemes, as the server side value is retrieved via RETURNING which
is not supported with executemany.
fixes #3556
2015-10-19 12:18:02 -04:00
Mike Bayer fa829d0e1b - modernize some very old global-engine tests w/ bad teardowns
(cherry picked from commit affcfd1e52)

Conflicts:
	test/dialect/postgresql/test_query.py
2015-10-11 12:32:33 -04:00
Mike Bayer 9b7a00d93b - repair flake8 issues
(cherry picked from commit e6779d8437)
2015-10-11 12:28:20 -04:00