Commit Graph

2979 Commits

Author SHA1 Message Date
Lele Gaifax d507ea00a9 add nullsfirst() / nullslast() to top-level imports
Change-Id: Ieefcc4c30c1c17f43f2908d961e00815bae862bb
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/378
2017-11-16 09:33:00 -05:00
mike bayer 63ea6ef4fb Merge "Add baked.Result.with_post_criteria method" 2017-11-13 14:46:43 -05:00
Mike Bayer 4f054550b7 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
2017-11-13 09:23:14 -05:00
Mike Bayer 3937fc7dfc Add baked.Result.with_post_criteria method
Added new method :meth:`.baked.Result.with_post_criteria` to baked
query system, allowing non-SQL-modifying transformations to take place
after the query has been pulled from the cache.  Among other things,
this method can be used with :class:`.horizontal_shard.ShardedQuery`
to set the shard identifier.   :class:`.horizontal_shard.ShardedQuery`
has also been modified such that its :meth:`.ShardedQuery.get` method
interacts correctly with that of :class:`.baked.Result`.

Change-Id: I04630c683240abbb4b99f0510a1a3dcb564815b4
Fixes: #4135
2017-11-12 18:44:41 -05:00
Mike Bayer 6448903b52 - fix loop logic that was leaving out 10K items from
example suites, fixes #4132

Change-Id: Icf07f33fc99a880d6165d300579ef5d2c366f6f5
2017-11-09 11:38:22 -05:00
Mike Bayer 3c75a46be4 - add new FAQ section re: MySQL failure modes
Change-Id: I458dcf6290464c8bf140a376e9a8d2ee10937c08
2017-11-03 17:50:54 -04:00
Mike Bayer ca7d3b5a5b Version 1.1.16 placeholder
Change-Id: Ia563c801f5f467084c49fc367f31b2385e0777bb
(cherry picked from commit 0274d80f83)
2017-11-03 17:07:06 -04:00
Mike Bayer 4959f5da49 - 1.1.15
(cherry picked from commit 0b33a8c48f)

Change-Id: I1093dbb02844f6bea50639c0dd60d71de5c2d86f
2017-11-03 17:06:59 -04:00
Mike Bayer 75bdcd096f 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
2017-11-03 14:45:18 -04:00
Mike Bayer 5d1a718214 - cross-link of_type() correctly
Change-Id: Iaacab5d2fe45b0b87fea922ec914e258dba9e30d
2017-11-02 13:40:43 -04:00
Nicolas CANIART 5acc9b149a 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
2017-10-31 11:38:07 -04:00
Mike Bayer fd4289c582 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
2017-10-28 13:29:48 -04:00
mike bayer f7b957b589 Merge "Rework autoescape to be a simple boolean; escape the escape character" 2017-10-26 16:25:25 -04:00
Mike Bayer bda06f76c0 - fix formatting
Change-Id: I4085424656d8e7078dc46378129de6506c4141b2
2017-10-26 16:24:57 -04:00
Ben Shen cd3db26cc9 Fix / consolidate for SQL Server BINARY, VARBINARY
Fixed bug where sqltypes.BINARY and sqltypes.VARBINARY datatypes
would not include correct bound-value handlers for pyodbc,
which allows the pyodbc.NullParam value to be passed that
helps with FreeTDS.

Co-authored by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I6e3c16a69465b4fbc7b17a1927fb5e66acee93cb
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/386
Fixes: #4121
2017-10-25 10:50:54 -04:00
Mike Bayer 654ca5463d Rework autoescape to be a simple boolean; escape the escape character
Reworked the new "autoescape" feature introduced in
:ref:`change_2694` in 1.2.0b2 to be fully automatic; the escape
character now defaults to a forwards slash ``"/"`` and
is applied to percent, underscore, as well as the escape
character itself, for fully automatic escaping.  The
character can also be changed using the "escape" parameter.

Change-Id: I74894a2576983c0f6eb89480c9e5727f49fa9c25
Fixes: #2694
2017-10-24 23:11:13 -04:00
Mike Bayer 73f2527486 Merge remote-tracking branch 'origin/pr/396' 2017-10-24 10:40:05 -04:00
Mike Bayer 9e5395c3da Merge remote-tracking branch 'origin/pr/394' 2017-10-24 10:39:54 -04:00
Mike Bayer 0236ab5694 Merge remote-tracking branch 'origin/pr/359' 2017-10-24 10:39:43 -04:00
Mike Bayer 9018be2dfd Merge remote-tracking branch 'origin/pr/393' 2017-10-24 10:39:35 -04:00
Yoichi NAKAYAMA 2f46856f95 Remove extra backslash 2017-10-24 16:09:45 +09:00
Yoichi NAKAYAMA 521951b55d Fix typo in "on duplicate key update" example 2017-10-24 16:00:21 +09:00
mike bayer da4b0a41e1 Merge "Resolve AliasedClass when determining owning class of association proxy" 2017-10-23 20:56:06 -04:00
mike bayer 7482ba0b3c Merge "Remove deprecation warnings mysql5 7 20" 2017-10-23 20:35:35 -04:00
Mike Bayer 1c025e9795 Add changelog for ticket #4097
A changelog was not added for #4097 even though this issue
was ticketed and backported to 1.1.

Change-Id: I1aeb5cb344c95ad86daa166e68eca7073eca0b87
Fixes: #4097
2017-10-23 18:58:37 -04:00
Mike Bayer 9a3b86908a Revert 860640fb8d
Revert 860640fb8d as this breaking change
was not actually released under 1.1

Change-Id: Ia1bfbebc5c34cd003de8657fedfccb6a41fc53fe
2017-10-23 18:48:00 -04:00
Mike Bayer 860640fb8d Issue #4115 will be backported to 1.1, move changelog file
Change-Id: Ib5039ad9cbdf036ab78b74266847fd67cdcfbfc3
2017-10-23 18:39:47 -04:00
Daniel Thorell 41cfe44b5e 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.

Co-authored by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #4120
Change-Id: I4d2e04df760c5351a71dde8b32145cdc69fa6115
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/391
2017-10-23 18:29:23 -04:00
Jeff Widman 16c237d3d1 Fix typo: srtategies --> strategies 2017-10-20 15:33:36 -07:00
Jeff Widman 975081a3a8 Fix typo: multidimentional --> multidimensional 2017-10-20 15:24:15 -07:00
Mike Bayer 57f7788ec2 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.

Change-Id: Iedf49f40c1614ccedf63e0fa26719dd704da104d
Fixes: #4115
2017-10-20 16:08:47 -04:00
Mike Bayer f14a58dea4 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
2017-10-20 14:35:09 -04:00
Mike Bayer 1fbed902ed Version 1.2.0b4 placeholder
Change-Id: I6f0a29360d70851398532e957722ae2a76b76f38
2017-10-13 13:58:46 -04:00
Mike Bayer 9cf6ac32d6 - 1.2.0b3 2017-10-13 13:16:59 -04:00
mike bayer 2942ecb230 Merge "Disallow all ambiguous boolean values for Boolean" 2017-10-12 14:41:37 -04:00
Mike Bayer c63658973c Disallow all ambiguous boolean values for Boolean
In release 1.1, the :class:`.Boolean` type was broken in that
boolean coercion via ``bool()`` would occur for backends that did not
feature "native boolean", but would not occur for native boolean backends,
meaning the string ``"0"`` now behaved inconsistently. After a poll, a
consensus was reached that non-boolean values should be raising an error,
especially in the ambiguous case of string ``"0"``; so the :class:`.Boolean`
datatype will now raise ``ValueError`` if an incoming value is not
within the range ``None, True, False, 1, 0``.

Change-Id: If70c4f79c266f0dd1a0306c0ffe7acb9c66c4cc3
Fixes: #4102
2017-10-12 13:39:06 -04:00
Mike Bayer 9ffee8c94a - make a note in 1.1 migration notes for ref #4102
Change-Id: If9edba3af476bc4303246e55d0ecb53009084342
2017-10-12 11:15:11 -04:00
Mike Bayer 3306d4d34d - psycopg2's batch mode isn't the multiple values thing,
it's just batching of statements

Change-Id: Ibb2e154d50ff3d9649822c9e4717ca5a3fd49430
2017-10-11 10:28:37 -04:00
Mike Bayer 4fbeec9d61 Add fast execution helper support.
Added a new flag ``use_batch_mode`` to the psycopg2 dialect.  This flag
enables the use of psycopg2's ``psycopg2.extras.execute_batch``
extension when the :class:`.Engine` calls upon ``cursor.executemany()``.
This extension provides a critical performance increase by over an order of magnitude
when running INSERT statements in batch.  The flag is False by default
as it is considered to be experimental for now.

Change-Id: Ib88d28bc792958d47109f644ff1d08c897db4ff7
Fixes: #4109
2017-10-10 13:43:35 -04:00
mike bayer 1230016bf0 Merge "Don't include SelectBase when searching for surface column elements" 2017-10-08 21:43:09 -04:00
Mike Bayer 4bb8397ae3 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.

Change-Id: Ibe5f6275d90e4868e6ef8a733de05acd44c05d78
Fixes: #4107
2017-10-06 11:29:09 -04:00
Mike Bayer 1281e6e6c4 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.

Change-Id: I38df21f1392af1843e10119682fa0635d346e2a8
Fixes: #4103
2017-10-05 11:29:11 -04:00
mike bayer 2c28079188 Merge "Add SQL Server TIMESTAMP / ROWVERSION datatypes" 2017-10-04 10:12:39 -04:00
Mike Bayer fadebedff0 Add SQL Server TIMESTAMP / ROWVERSION datatypes
SQL Server has an entirely different use for the TIMESTAMP
datatype that is unrelated to the SQL standard's version of this
type.   It is a read-only type that returns an incrementing
binary value.  The ROWVERSION name will supersede the TIMESTAMP
name.  Implement datatype objects for both, separate from the
base DateTime/TIMESTAMP class hierarchy, and also implement
an optional integer coercion feature.

Change-Id: Ie2bd43b7aac57760b8ec6ff6e26460e2086a95eb
Fixes: #4086
2017-10-04 09:27:31 -04:00
Mike Bayer 8ba8dd23b7 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
2017-10-03 12:58:38 -04:00
Mike Bayer 29b752f8b2 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
2017-09-28 19:22:17 -04:00
Mike Bayer 68b52c48b7 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
2017-09-28 16:51:35 -04:00
mike bayer 4a2760ffd2 Merge "Add full list of pyodbc error codes for MSSQL" 2017-09-28 12:07:19 -04:00
Mike Bayer 1ec7ba52e1 - add more dragons to session.begin() / autocommit docs
Change-Id: I9e326f353d396321565dfbf53b7a30f18d8c86e9
2017-09-28 11:43:48 -04:00
Mike Bayer 6a38697261 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
2017-09-28 09:39:54 -04:00