]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
8 years agoConsider mysql partition options separately from other table options
Mike Bayer [Thu, 6 Apr 2017 00:59:42 +0000 (20:59 -0400)] 
Consider mysql partition options separately from other table options

Move down all the PARTITION, SUBPARTITION options
into a separate segment so that they come out at the
end of CREATE TABLE after the table options.

Change-Id: Iaa1c823848c93680ca22d72bda1b7c49742b9060
Fixes: #3961
8 years ago- add placeholder for 1.1.10
Mike Bayer [Thu, 6 Apr 2017 13:55:04 +0000 (09:55 -0400)] 
- add placeholder for 1.1.10

Change-Id: I068dd3b47dec200740db617891a64798db8f1734

8 years agoSupport Postgresql INTERVAL fields spec/reflection
Mike Bayer [Wed, 5 Apr 2017 16:55:39 +0000 (12:55 -0400)] 
Support Postgresql INTERVAL fields spec/reflection

Added support for all possible "fields" identifiers when reflecting the
Postgresql ``INTERVAL`` datatype, e.g. "YEAR", "MONTH", "DAY TO
MINUTE", etc..   In addition, the :class:`.postgresql.INTERVAL`
datatype itself now includes a new parameter
:paramref:`.postgresql.INTERVAL.fields` where these qualifiers can be
specified; the qualifier is also reflected back into the resulting
datatype upon reflection / inspection.

Change-Id: I33816e68c533b023e0632db6f4e73fefd2de4721
Fixes: #3959
8 years agoMerge "Double percent signs based on paramstyle, not dialect"
mike bayer [Wed, 5 Apr 2017 17:06:00 +0000 (13:06 -0400)] 
Merge "Double percent signs based on paramstyle, not dialect"

8 years agoDouble percent signs based on paramstyle, not dialect
Mike Bayer [Mon, 4 Jul 2016 19:54:29 +0000 (15:54 -0400)] 
Double percent signs based on paramstyle, not dialect

This patch moves the "doubling" of percent signs into
the base compiler and makes it completely a product
of whether or not the paramstyle is format/pyformat or
not.   Without this paramstyle, percent signs
are not doubled across text(), literal_column(), and
column().

Change-Id: Ie2f278ab1dbb94b5078f85c0096d74dbfa049197
Fixes: #3740
8 years agoMerge "Recognize brackets, quoted_name in SQL Server schema"
mike bayer [Tue, 4 Apr 2017 18:28:39 +0000 (14:28 -0400)] 
Merge "Recognize brackets, quoted_name in SQL Server schema"

8 years ago- 1.1.9 release date
Mike Bayer [Tue, 4 Apr 2017 18:11:05 +0000 (14:11 -0400)] 
- 1.1.9 release date

Change-Id: I8d1d55bde6424e4013c5b16bb27d6fc15fa225c2

8 years agoRecognize brackets, quoted_name in SQL Server schema
Mike Bayer [Mon, 3 Apr 2017 19:05:27 +0000 (15:05 -0400)] 
Recognize brackets, quoted_name in SQL Server schema

The SQL Server dialect now allows for a database and/or owner name
with a dot inside of it, using brackets explicitly in the string around
the owner and optionally the database name as well.  In addition,
sending the :class:`.quoted_name` construct for the schema name will
not split on the dot and will deliver the full string as the "owner".
:class:`.quoted_name` is also now available from the ``sqlalchemy.sql``
import space.

Change-Id: I77491d63ce47638bd23787d903ccde2f35a9d43d
Fixes: #2626
8 years agoAdd much more detail to the "unhashable types" change
Mike Bayer [Tue, 4 Apr 2017 17:09:55 +0000 (13:09 -0400)] 
Add much more detail to the "unhashable types" change

Change-Id: I34cbf54913b81ef2ae8b2e60f03feb78601460e5
Fixes: 3958
(cherry picked from commit 10a3004f2ca29921c844f58689a5f02ed5f10e03)

8 years agoMerge "Apply SQL compilation to sqltext for column-level CHECK constraint"
mike bayer [Tue, 4 Apr 2017 14:22:32 +0000 (10:22 -0400)] 
Merge "Apply SQL compilation to sqltext for column-level CHECK constraint"

8 years agoMerge "Ensure we check that SQL expression has an .info attribute"
mike bayer [Tue, 4 Apr 2017 14:08:49 +0000 (10:08 -0400)] 
Merge "Ensure we check that SQL expression has an .info attribute"

8 years agoApply SQL compilation to sqltext for column-level CHECK constraint
Mike Bayer [Tue, 4 Apr 2017 14:02:39 +0000 (10:02 -0400)] 
Apply SQL compilation to sqltext for column-level CHECK constraint

Fixed bug where a column-level :class:`.CheckConstraint` would fail
to compile the SQL expression using the underlying dialect compiler
as well as apply proper flags to generate literal values as
inline, in the case that the sqltext is a Core expression and
not just a plain string.   This was long-ago fixed for table-level
check constraints in 0.9 as part of :ticket:`2742`, which more commonly
feature Core SQL expressions as opposed to plain string expressions.

Change-Id: I1301ba4b40063e91bc47726aecc5f4990ffcaeda
Fixes: #3957
8 years agoFix typo.
Bertrand Janin [Tue, 4 Apr 2017 13:11:25 +0000 (09:11 -0400)] 
Fix typo.

8 years agoEnsure we check that SQL expression has an .info attribute
Mike Bayer [Tue, 4 Apr 2017 13:06:13 +0000 (09:06 -0400)] 
Ensure we check that SQL expression has an .info attribute

Fixed regression released in 1.1.8 due to :ticket:`3950` where the
deeper search for information about column types in the case of a
"schema type" or a :class:`.TypeDecorator` would produce an attribute
error if the mapping also contained a :obj:`.column_property`.

Change-Id: I38254834d3d79c9b339289a8163eb4789ec4c931
Fixes: #3956
8 years agoResultProxy won't autoclose connection until state flag is set
Mike Bayer [Mon, 3 Apr 2017 21:25:26 +0000 (17:25 -0400)] 
ResultProxy won't autoclose connection until state flag is set

Changed the mechanics of :class:`.ResultProxy` to unconditionally
delay the "autoclose" step until the :class:`.Connection` is done
with the object; in the case where Postgresql ON CONFLICT with
RETURNING returns no rows, autoclose was occurring in this previously
non-existent use case, causing the usual autocommit behavior that
occurs unconditionally upon INSERT/UPDATE/DELETE to fail.

Change-Id: I235a25daf4381b31f523331f810ea04450349722
Fixes: #3955
(cherry picked from commit 8ee363e4917b0dcd64a83b6d26e465c9e61e0ea5)
(cherry picked from commit f52fb5282a046d26b6ee2778e03b995eb117c2ee)

8 years ago- fix version identifier
Mike Bayer [Mon, 3 Apr 2017 21:31:18 +0000 (17:31 -0400)] 
- fix version identifier

Change-Id: I63abfb167f54ea2ea2f8bf4ba22ab38b60c5d59c

8 years agoMerge "Use consistent method signature for Alias.self_group()"
mike bayer [Mon, 3 Apr 2017 16:37:35 +0000 (12:37 -0400)] 
Merge "Use consistent method signature for Alias.self_group()"

8 years agoUse consistent method signature for Alias.self_group()
Mike Bayer [Thu, 16 Mar 2017 21:28:41 +0000 (17:28 -0400)] 
Use consistent method signature for Alias.self_group()

Fixed bug where the use of an :class:`.Alias` object in a column
context would raise an argument error when it tried to group itself
into a parenthesized expression.   Using :class:`.Alias` in this way
is not yet a fully supported API, however it applies to some end-user
recipes and may have a more prominent role in support of some
future Postgresql features.

Change-Id: I81717e30416e0350f08d1e022c3d84656e0a9735
Fixes: #3939
8 years agoReturn self when Variant.coerce_compared_value would return impl
Mike Bayer [Sat, 1 Apr 2017 15:36:16 +0000 (11:36 -0400)] 
Return self when Variant.coerce_compared_value would return impl

Fixed regression released in 1.1.5 due to :ticket:`3859` where
adjustments to the "right-hand-side" evaluation of an expression
based on :class:`.Variant` to honor the underlying type's
"right-hand-side" rules caused the :class:`.Variant` type
to be inappropriately lost, in those cases when we *do* want the
left-hand side type to be transferred directly to the right hand side
so that bind-level rules can be applied to the expression's argument.

Change-Id: Ia54dbbb19398549d654b74668753c4152599d900
Fixes: #3952
8 years ago- 1.1.9 placeholder
Mike Bayer [Sat, 1 Apr 2017 15:36:52 +0000 (11:36 -0400)] 
- 1.1.9 placeholder

Change-Id: Ic7897b5e05d7a20b280d4412d3bdf2ebc85905d4

8 years ago- 1.1.8 release date
Mike Bayer [Fri, 31 Mar 2017 18:31:13 +0000 (14:31 -0400)] 
- 1.1.8 release date

Change-Id: I6243e620e55ad862e8494d64cc754badce25097d

8 years agoTrack SchemaEventTarget types in as_mutable()
Mike Bayer [Thu, 30 Mar 2017 21:52:10 +0000 (17:52 -0400)] 
Track SchemaEventTarget types in as_mutable()

Fixed bug in :mod:`sqlalchemy.ext.mutable` where the
:meth:`.Mutable.as_mutable` method would not track a type that had
been copied using :meth:`.TypeEngine.copy`.  This became more of
a regression in 1.1 compared to 1.0 because the :class:`.TypeDecorator`
class is now a subclass of :class:`.SchemaEventTarget`, which among
other things indicates to the parent :class:`.Column` that the type
should be copied when the :class:`.Column` is.  These copies are
common when using declarative with mixins or abstract classes.

Change-Id: Ib04df862c58263185dbae686c548fea3e12c46f1
Fixes: #3950
8 years agoApply type processing to untyped preexec default clause
Mike Bayer [Mon, 27 Feb 2017 21:43:59 +0000 (16:43 -0500)] 
Apply type processing to untyped preexec default clause

Fixed bug where a SQL-oriented Python-side column default could fail to
be executed properly upon INSERT in the "pre-execute" codepath, if the
SQL itself were an untyped expression, such as plain text.  The "pre-
execute" codepath is fairly uncommon however can apply to non-integer
primary key columns with SQL defaults when RETURNING is not used.

Tests exist here to ensure typing is applied to
a typed expression for default, but in the case of
an untyped SQL value, we know the type from the column,
so apply this.

Change-Id: I5d8b391611c137b9f700115a50a2bf5b30abfe94
Fixes: #3923
8 years agoAdd bindparams support for baked Result count() method
Malaclypse The Younger [Thu, 30 Mar 2017 14:54:14 +0000 (10:54 -0400)] 
Add bindparams support for baked Result count() method

Added support for bound parameters, e.g. those normally set up
via :meth:`.Query.params`, to the :meth:`.baked.Result.count`
method.  Previously, support for parameters were omitted. Pull request
courtesy Pat Deegan.

Change-Id: I8c33548cf2a483699767e459731694c8cadebff6
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/350

8 years agoDocs/faq/performance
Ihor Kalnytskyi [Thu, 30 Mar 2017 14:07:31 +0000 (10:07 -0400)] 
Docs/faq/performance

Some updates for FAQ/Performance documentation page:

* Fix typo in testing script.
* Populate testing script with one more way to achieve higher performance.

See commit messages for details.

Change-Id: Id6fbf328164b14b3b58ca9616b103a35e72f7b8f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/345

8 years agoSupport Postgresql development version numbers
Sean McCully [Wed, 29 Mar 2017 20:14:02 +0000 (16:14 -0400)] 
Support Postgresql development version numbers

Added support for parsing the Postgresql version string for
a development version like "PostgreSQL 10devel".  Pull request
courtesy Sean McCully.

Change-Id: I7bc18bc4d290349c23e9796367b7d694d0873096
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/351

8 years ago- start changelog for 1.1.8
Mike Bayer [Wed, 29 Mar 2017 20:15:53 +0000 (16:15 -0400)] 
- start changelog for 1.1.8

Change-Id: I6c23f43ca76aeca469980fc8be228af20c2c700d

8 years ago- reorg migration notes a bit
Mike Bayer [Tue, 28 Mar 2017 13:26:56 +0000 (09:26 -0400)] 
- reorg migration notes a bit

Change-Id: Id2a727a2a13eb84ad104ab049ae37b9e708af6b5

8 years ago- update release date for 1.1.7
Mike Bayer [Mon, 27 Mar 2017 21:34:15 +0000 (17:34 -0400)] 
- update release date for 1.1.7

Change-Id: I6ce86e2e0c54135194c60d99b433b2f38c467dbd

8 years agoAllow aliased() to be passed to Query.select_entity_from().
Mike Bayer [Mon, 27 Mar 2017 17:48:40 +0000 (13:48 -0400)] 
Allow aliased() to be passed to Query.select_entity_from().

An :func:`.aliased()` construct can now be passed to the
:meth:`.Query.select_entity_from` method.   Entities will be pulled
from the selectable represented by the :func:`.aliased` construct.
This allows special options for :func:`.aliased` such as
:paramref:`.aliased.adapt_on_names` to be used in conjunction with
:meth:`.Query.select_entity_from`.

Additionally rewrote the docstring for :meth:`.Query.select_entity_from`,
including starting with explicit use of :func:`.aliased` as the
usual idiomatic pattern.  An example using text().columns() is added
as well as the use case from :ticket:`3933` using name matching.

Change-Id: If7e182965236993064a2a086e3b6d55a4f097ca8
Fixes: #3933
8 years agoMerge "Add safe_reraise() + warnings only to Connection._autorollback"
mike bayer [Mon, 27 Mar 2017 16:27:56 +0000 (12:27 -0400)] 
Merge "Add safe_reraise() + warnings only to Connection._autorollback"

8 years agoMerge branch 'patch-1' of https://github.com/tamentis/sqlalchemy
Mike Bayer [Mon, 27 Mar 2017 15:30:37 +0000 (11:30 -0400)] 
Merge branch 'patch-1' of https://github.com/tamentis/sqlalchemy

8 years agoAdd safe_reraise() + warnings only to Connection._autorollback
Mike Bayer [Mon, 27 Mar 2017 14:52:58 +0000 (10:52 -0400)] 
Add safe_reraise() + warnings only to Connection._autorollback

Added an exception handler that will warn for the "cause" exception on
Py2K when the "autorollback" feature of :class:`.Connection` itself
raises an exception. In Py3K, the two exceptions are naturally reported
by the interpreter as one occurring during the handling of the other.
This is continuing with the series of changes for rollback failure
handling that were last visited as part of :ticket:`2696` in 1.0.12.

Change-Id: I600ba455a14ebaea27c6189889181f97c632f179
Fixes: #3946
8 years agoPre-load alias.c within JoinedEagerLoader cached AliasedClass
Mike Bayer [Sun, 26 Mar 2017 02:17:17 +0000 (22:17 -0400)] 
Pre-load alias.c within JoinedEagerLoader cached AliasedClass

Fixed a race condition which could occur under threaded environments
as a result of the caching added via :ticket:`3915`.   An internal
collection of ``Column`` objects could be regenerated on an alias
object inappropriately, confusing a joined eager loader when it
attempts to render SQL and collect results and resulting in an
attribute error.   The collection is now generated up front before
the alias object is cached and shared among threads.

Change-Id: I97d5b205992d38af8d2b4307178a15c086ef9993
Fixes: #3947
8 years agoTreat collation names as identifiers
Mike Bayer [Thu, 23 Mar 2017 19:11:03 +0000 (15:11 -0400)] 
Treat collation names as identifiers

The expression used for COLLATE as rendered by the column-level
:func:`.expression.collate` and :meth:`.ColumnOperators.collate` is now
quoted as an identifier when the name is case sensitive, e.g. has
uppercase characters.  Note that this does not impact type-level
collation, which is already quoted.

Change-Id: I83d5d9cd1e66a4f20b96303bb84c5f360d5d6a1a
Fixes: #3785
8 years agoSupport hybrids/composites with bulk updates
Mike Bayer [Wed, 22 Mar 2017 16:56:23 +0000 (12:56 -0400)] 
Support hybrids/composites with bulk updates

The :meth:`.Query.update` method can now accommodate both
hybrid attributes as well as composite attributes as a source
of the key to be placed in the SET clause.   For hybrids, an
additional decorator :meth:`.hybrid_property.update_expression`
is supplied for which the user supplies a tuple-returning function.

Change-Id: I15e97b02381d553f30b3301308155e19128d2cfb
Fixes: #3229
8 years agoUse config.db global opts as defaults for all testing_engine()
Mike Bayer [Wed, 22 Mar 2017 14:13:15 +0000 (10:13 -0400)] 
Use config.db global opts as defaults for all testing_engine()

Some options need to be passed to engines in all cases,
such as currently the oracle 12516 workaround.   make sure
calls to testing_engine also set up the dictionary with
defaults even if options is passed.    not clear if this affects
other backends yet.

Change-Id: I5a1f7634e4ce5af6fe55dc21a24db6afacd19bb7

8 years agoRaise on flag_modified() for non-present attribute
Mike Bayer [Tue, 21 Mar 2017 21:11:18 +0000 (17:11 -0400)] 
Raise on flag_modified() for non-present attribute

The :func:`.attributes.flag_modified` function now raises
:class:`.InvalidRequestError` if the named attribute key is not
present within the object, as this is assumed to be present
in the flush process.  To mark an object "dirty" for a flush
without referring to any specific attribute, the
:func:`.attributes.flag_dirty` function may be used.

Change-Id: I6c64e4d253c239e38632f38c27bb16e68fe8dfbe
Fixes: #3753
8 years agoAllow reuse of hybrid_property across subclasses
Diana Clarke [Thu, 16 Mar 2017 20:05:18 +0000 (16:05 -0400)] 
Allow reuse of hybrid_property across subclasses

The :class:`sqlalchemy.ext.hybrid.hybrid_property` class now supports
calling mutators like ``@setter``, ``@expression`` etc. multiple times
across subclasses, and now provides a ``@getter`` mutator, so that
a particular hybrid can be repurposed across subclasses or other
classes.  This now matches the behavior of ``@property`` in standard
Python.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #3911
Fixes: #3912
Change-Id: Iff033d8ccaae20ded9289cbfa789c376759381f5

8 years agoIntegrate "pre-ping" into connection pool.
Mike Bayer [Fri, 24 Feb 2017 15:50:14 +0000 (10:50 -0500)] 
Integrate "pre-ping" into connection pool.

Added native "pessimistic disconnection" handling to the :class:`.Pool`
object.  The new parameter :paramref:`.Pool.pre_ping`, available from
the engine as :paramref:`.create_engine.pool_pre_ping`, applies an
efficient form of the "pre-ping" recipe featured in the pooling
documentation, which upon each connection check out, emits a simple
statement, typically "SELECT 1", to test the connection for liveness.
If the existing connection is no longer able to respond to commands,
the connection is transparently recycled, and all other connections
made prior to the current timestamp are invalidated.

Change-Id: I89700d0075e60abd2250e54b9bd14daf03c71c00
Fixes: #3919
8 years agoFix a title typo
Bertrand Janin [Sun, 19 Mar 2017 22:05:54 +0000 (18:05 -0400)] 
Fix a title typo

Utilites -> Utilities

8 years agoMerge branch 'master' of https://bitbucket.org/jalessio/sqlalchemy
Mike Bayer [Sat, 18 Mar 2017 18:57:41 +0000 (14:57 -0400)] 
Merge branch 'master' of https://bitbucket.org/jalessio/sqlalchemy

8 years agofix pep8 errors in association example
Paul Brown [Fri, 17 Mar 2017 05:24:15 +0000 (00:24 -0500)] 
fix pep8 errors in association example

(cherry picked from commit 6aad7fb4217ef294f68f693be5b3137c28184949)

8 years agofix pep8 errors in adjacency_list example
Paul Brown [Fri, 17 Mar 2017 05:23:49 +0000 (00:23 -0500)] 
fix pep8 errors in adjacency_list example

(cherry picked from commit ff230f1862892eb2b479ed85e6858a82159b435f)

8 years agoNew features from python 2.7
Катаев Денис [Fri, 17 Mar 2017 18:19:21 +0000 (14:19 -0400)] 
New features from python 2.7

After bump minimum supported version to 2.7 (1da9d3752160430c91534a8868ceb8c5ad1451d4), we can use new syntax.

Change-Id: Ib064c75a00562e641d132f9c57e5e69744200e05
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/347

8 years agoMerge "Implement comments for tables, columns"
mike bayer [Fri, 17 Mar 2017 18:16:27 +0000 (14:16 -0400)] 
Merge "Implement comments for tables, columns"

8 years agoImplement comments for tables, columns
Frazer McLean [Sat, 11 Jun 2016 19:47:33 +0000 (21:47 +0200)] 
Implement comments for tables, columns

Added support for SQL comments on :class:`.Table` and :class:`.Column`
objects, via the new :paramref:`.Table.comment` and
:paramref:`.Column.comment` arguments.   The comments are included
as part of DDL on table creation, either inline or via an appropriate
ALTER statement, and are also reflected back within table reflection,
as well as via the :class:`.Inspector`.   Supported backends currently
include MySQL, Postgresql, and Oracle.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #1546
Change-Id: Ib90683850805a2b4ee198e420dc294f32f15d35d

8 years agoAdd bulk_replace event, integrate with @validates
Mike Bayer [Wed, 25 Jan 2017 16:51:04 +0000 (11:51 -0500)] 
Add bulk_replace event, integrate with @validates

Added new attribute event :meth:`.AttributeEvents.bulk_replace`.
This event is triggered when a collection is assigned to a
relationship, before the incoming collection is compared with the
existing one.  This early event allows for conversion of incoming
non-ORM objects as well.  The event is integrated with the
``@validates`` decorator.

The ``@validates`` decorator now allows the decorated method to receive
objects from a "bulk collection set" operation that have not yet
been compared to the existing collection.  This allows incoming values
to be converted to compatible ORM objects as is already allowed
from an "append" event.   Note that this means that the
``@validates`` method is called for **all** values during a collection
assignment, rather than just the ones that are new.

Change-Id: I27f59db008d9e521d31a3e30143d7cd997e4b7b3
Fixes: #3896
8 years agoAnnotate parentmapper in primaryjoin / secondaryjoin
Mike Bayer [Mon, 16 Jan 2017 18:34:55 +0000 (13:34 -0500)] 
Annotate parentmapper in primaryjoin / secondaryjoin

This patch applies the "parentmapper" annotation to the columns
in the primaryjoin/secondaryjoin, but more dramatically,
also removes all the "deannotate" steps that were historically
applied to the relationship primaryjoin/secondaryjoin.
These deannotation steps were left over from the initial
implementations of annotations where the behaviors were not
as reliable.

By ensuring these annotations are present,
the evaluator no longer needs to do a name-based lookup
when it sees a column that has no "parentmapper",
because it can be assured this is not a mapped column.
This fixes the issue where the expression were based on
a relationship primaryjoin but the name of a column
in the join condition didn't match the attribute name.

Change-Id: I8c1d4594116d4109fef314a87c96a24d2efa0058
Fixes: #3366
8 years agoDon't mutate old collection on bulk replace
Mike Bayer [Tue, 14 Feb 2017 16:39:44 +0000 (11:39 -0500)] 
Don't mutate old collection on bulk replace

For a bulk replace, assume the old collection is no longer
useful to the attribute system and only send the removal events,
not actually mutated the collection.

this changes behavior significantly and also means that dispose_collection
now receives the old collection intact.

Change-Id: Ic2685c85438191f07797d9ef97833a2cfdc4fcc2
Fixes: #3913
8 years agoMerge "Consult _select_from_entity in _adjust_for_single_inheritance"
mike bayer [Wed, 15 Mar 2017 21:12:03 +0000 (17:12 -0400)] 
Merge "Consult _select_from_entity in _adjust_for_single_inheritance"

8 years agoConsult compiled paramstyle on execute_compiled
Mike Bayer [Wed, 15 Mar 2017 14:15:12 +0000 (10:15 -0400)] 
Consult compiled paramstyle on execute_compiled

Fixed bug where in the unusual case of passing a
:class:`.Compiled` object directly to :meth:`.Connection.execute`,
the dialect with which the :class:`.Compiled` object were generated
was not consulted for the paramstyle of the string statement, instead
assuming it would match the dialect-level paramstyle, causing
mismatches to occur.

Change-Id: I114e4db2183fbb75bb7c0b0641f5a161855696ee
Fixes: #3938
8 years agoFix typos ('expicit' -> 'explicit')
Jamie Alessio [Wed, 15 Mar 2017 02:02:38 +0000 (19:02 -0700)] 
Fix typos ('expicit' -> 'explicit')

8 years agoConsult _select_from_entity in _adjust_for_single_inheritance
Mike Bayer [Mon, 16 Jan 2017 18:06:44 +0000 (13:06 -0500)] 
Consult _select_from_entity in _adjust_for_single_inheritance

Fixed bug in single-table inheritance where the select_from()
argument would not be taken into account when limiting rows
to a subclass.  Previously, only expressions in the
columns requested would be taken into account.

Change-Id: Id353c45eade52b264d8f6685a58ba53975669eea
Fixes: #3891
8 years agoMerge "Add "empty in" strategies; default to "static""
mike bayer [Tue, 14 Mar 2017 23:39:37 +0000 (19:39 -0400)] 
Merge "Add "empty in" strategies; default to "static""

8 years agoMerge "Improve serializer behavior"
mike bayer [Tue, 14 Mar 2017 23:38:06 +0000 (19:38 -0400)] 
Merge "Improve serializer behavior"

8 years ago- add missing hyperlink for change 3934
Mike Bayer [Tue, 14 Mar 2017 21:14:02 +0000 (17:14 -0400)] 
- add missing hyperlink for change 3934

Change-Id: I4f6f1d24588f5f8aa8cf8f7f67627a08552d4c93

8 years agoAdd "empty in" strategies; default to "static"
Mike Bayer [Tue, 14 Mar 2017 16:00:56 +0000 (12:00 -0400)] 
Add "empty in" strategies; default to "static"

The longstanding behavior of the :meth:`.Operators.in_` and
:meth:`.Operators.not_in_` operators emitting a warning when
the right-hand condition is an empty sequence has been revised;
a new flag :paramref:`.create_engine.empty_in_strategy` allows an
empty "IN" expression to generate a simple boolean expression, or
to invoke the previous behavior of dis-equating the expression to
itself, with or without a warning.  The default behavior is now
to emit the simple boolean expression, allowing an empty IN to
be evaulated without any performance penalty.

Change-Id: I65cc37f2d7cf65a59bf217136c42fee446929352
Fixes: #3907
8 years agoImprove serializer behavior
Mike Bayer [Thu, 9 Mar 2017 16:36:19 +0000 (11:36 -0500)] 
Improve serializer behavior

Fix an issue where the Annotated system needs to have a
__reduce__ method, also see why we can't default to HIGHEST_PROTOCOL.
This latter part might not be a good idea until 1.2 for compatibility
reasons.

Change-Id: I0239e38259fc768c9e3b6c448c29161e271a969c
Fixes: #3918
8 years agoEmit after_rollback() event before snapshot removal
Mike Bayer [Sat, 11 Mar 2017 15:52:43 +0000 (10:52 -0500)] 
Emit after_rollback() event before snapshot removal

The state of the :class:`.Session` is now present when the
:meth:`.SessionEvents.after_rollback` event is emitted, that is,  the
attribute state of objects prior to their being expired.   This is now
consistent with the  behavior of the
:meth:`.SessionEvents.after_commit` event which  also emits before the
attribute state of objects is expired.

Change-Id: I9c572656ec5a9bfaeab817e9c95107c75aca1b51
Fixes: #3934
8 years agoEnable sane_multi_rowcount for cx_Oracle
Mike Bayer [Tue, 14 Mar 2017 17:38:12 +0000 (13:38 -0400)] 
Enable sane_multi_rowcount for cx_Oracle

Also add some tests to test_rowcount.

Change-Id: Idaa18fdc4fcfeb615725531c37de77decf76a783
Fixes: #3932
8 years agoadd autoescape option to startswith, endswith, and contains
Diana Clarke [Sun, 10 Apr 2016 19:19:03 +0000 (15:19 -0400)] 
add autoescape option to startswith, endswith, and contains

Fixes: #2694
Change-Id: I34c0bdcb01c2b76b9ab6cd315dae13e3dd8a502b
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/207

8 years ago- add ad_hoc_engines to remove RealReconnectTest from oracle
Mike Bayer [Tue, 14 Mar 2017 13:14:37 +0000 (09:14 -0400)] 
- add ad_hoc_engines to remove RealReconnectTest from oracle

Change-Id: Ie40aeba87dcfe9e8216abb8be050e7c2cc5b5ec9

8 years agoNormalize Oracle reflected FK constraint name
Mike Bayer [Mon, 13 Mar 2017 15:20:53 +0000 (11:20 -0400)] 
Normalize Oracle reflected FK constraint name

Oracle reflection now "normalizes" the name given to a foreign key
constraint, that is, returns it as all lower case for a case
insensitive name.  This was already the behavior for indexes
and primary key constraints as well as all table and column names.
This will allow Alembic autogenerate scripts to compare and render
foreign key constraint names correctly when initially specified
as case insensitive.

Change-Id: Ibb34ec6ce7cb244d1c4ae9d44ce2d37d37227e69
Fixes: #3276
8 years ago- re-set no ad-hoc-engines for oracle, previously low-connections
Mike Bayer [Mon, 13 Mar 2017 22:08:43 +0000 (18:08 -0400)] 
- re-set no ad-hoc-engines for oracle, previously low-connections
disabled this

Change-Id: I3ceceaea7a3969248121ff4dc97c11296831fc99

8 years agoAdd tests for empty association set comparison
Mike Bayer [Mon, 13 Mar 2017 15:48:42 +0000 (11:48 -0400)] 
Add tests for empty association set comparison

This seems to only occur in python 2.6, adding tests
to ensure it stays

Change-Id: Id714680970bf1f70e2fe06b0c8688b7c5a6b6b0c
Fixes: #3265
8 years agoRepair _execute_scalar for WITH_UNICODE mode
Mike Bayer [Mon, 13 Mar 2017 16:27:51 +0000 (12:27 -0400)] 
Repair _execute_scalar for WITH_UNICODE mode

cx_Oracle 5.3 seems to code this flag ON now, so
remove the warning and ensure WITH_UNICODE handling works.

Additionally, the XE setup on jenkins is having more
problems here, in particular low-connections mode is
causing cx_Oracle to fail more frequently now.  Turning
off low-connections fixes those but then we get the
TNS errors, so adding an emergency "retry" flag that
is not yet a feature available to users.  Real world
applications are not dropping/creating thousands of
tables the way our test suite is.

Change-Id: Ie95b0e697276c404d3264c2e624e870463d966d6
Fixes: #3937
8 years ago- bump minimum python version to 2.7
Mike Bayer [Fri, 10 Mar 2017 19:28:49 +0000 (14:28 -0500)] 
- bump minimum python version to 2.7
- add placeholder 1.2 release documentation, update intro numbers

Change-Id: I9f9969cbb9e95c2f750a5c16798e92c35a5ef6cf

8 years ago- begin the 1.2 branch in master, diverge from 1.1
Mike Bayer [Fri, 10 Mar 2017 19:08:09 +0000 (14:08 -0500)] 
- begin the 1.2 branch in master, diverge from 1.1

Change-Id: I446f7528046873bf2d547daec043737b1bffe5f4

8 years ago- add a note as to why we have this very complicated Annotated
Mike Bayer [Thu, 9 Mar 2017 22:38:21 +0000 (17:38 -0500)] 
- add a note as to why we have this very complicated Annotated
system

Change-Id: I7d4048b92fcd3a7c7630c43aa9390d983f447c0a

8 years agoAllow SchemaType and Variant to work together
Mike Bayer [Tue, 7 Mar 2017 17:53:00 +0000 (12:53 -0500)] 
Allow SchemaType and Variant to work together

Added support for the :class:`.Variant` and the :class:`.SchemaType`
objects to be compatible with each other.  That is, a variant
can be created against a type like :class:`.Enum`, and the instructions
to create constraints and/or database-specific type objects will
propagate correctly as per the variant's dialect mapping.

Also added testing for some potential double-event scenarios
on TypeDecorator but it seems usually this doesn't occur.

Change-Id: I4a7e7c26b4133cd14e870f5bc34a1b2f0f19a14a
Fixes: #2892
8 years agoRepair missing "checkfirst" for test suite
Mike Bayer [Tue, 7 Mar 2017 20:00:18 +0000 (15:00 -0500)] 
Repair missing "checkfirst" for test suite

the test_metadata tests trigger the before_create dispatch without
the checkfirst flag.  Postgresql backend should be able to
tolerate this.

Change-Id: Ife497cc3a4eb2812462116f94aad732864225f3f

8 years ago- document ForeignKeyConstraint columns / elements, fixes #2904
Mike Bayer [Tue, 7 Mar 2017 19:54:53 +0000 (14:54 -0500)] 
- document ForeignKeyConstraint columns / elements, fixes #2904

Change-Id: Ia50a3100d1bd88020c30224932b16aeadd7f4c75

8 years agoMerge "Don't cache savepoint identifiers"
mike bayer [Tue, 7 Mar 2017 00:12:40 +0000 (19:12 -0500)] 
Merge "Don't cache savepoint identifiers"

8 years agoDon't cache savepoint identifiers
Mike Bayer [Mon, 6 Mar 2017 17:26:01 +0000 (12:26 -0500)] 
Don't cache savepoint identifiers

Fixed bug in compiler where the string identifier of a savepoint would
be cached in the identifier quoting dictionary; as these identifiers
are arbitrary, a small memory leak could occur if a single
:class:`.Connection` had an unbounded number of savepoints used,
as well as if the savepoint clause constructs were used directly
with an unbounded umber of savepoint names.   The memory leak does
**not** impact the vast majority of cases as normally the
:class:`.Connection`, which renders savepoint names with a simple
counter starting at "1", is used on a per-transaction or
per-fixed-number-of-transactions basis before being discarded.

The savepoint name in virtually all cases does not require quoting
at all, however to support potential third party use cases
the "check for quotes needed" logic is retained, at a small
performance cost.   Uncondtionally quoting the name is another
option, but this would turn the name into a case sensitive name
which runs the risk of poor interactions with existing deployments
that may be looking at these names in other contexts.

Change-Id: I6b53c96abf7fdf1840592bbca5da81347911844c
Fixes: #3931
8 years ago- update asktom link, fixes #3925
Mike Bayer [Mon, 6 Mar 2017 21:50:13 +0000 (16:50 -0500)] 
- update asktom link, fixes #3925

Change-Id: Ibd63311dfccebbdf67e8ad7dc56ad311bf573895

8 years agoUpdate profiles for psycopg2 2.7
Mike Bayer [Mon, 6 Mar 2017 21:09:32 +0000 (16:09 -0500)] 
Update profiles for psycopg2 2.7

psycopg2 has updated their unicode / string handling, greatly
reducing callcounts on Python 2.x.

Change-Id: Idffd242b303ffea9c7733068a4be290da4dbe679

8 years agoOnly use schema_translate_map on SchemaItem subclasses
Mike Bayer [Tue, 28 Feb 2017 19:03:47 +0000 (14:03 -0500)] 
Only use schema_translate_map on SchemaItem subclasses

Fixed bug in new "schema translate" feature where the translated schema
name would be invoked in terms of an alias name when rendered along
with a column expression; occurred only when the source translate
name was "None".   The "schema translate" feature now only takes
effect for :class:`.SchemaItem` and :class:`.SchemaType` subclasses,
that is, objects that correspond to a DDL-creatable structure in
a database.

Change-Id: Ie8cb35aeaba2c67efec8c8c57c219e4dd346e44a
Fixes: #3924
8 years ago- 1.1.7 prep
Mike Bayer [Tue, 28 Feb 2017 19:49:04 +0000 (14:49 -0500)] 
- 1.1.7 prep

Change-Id: I7d738e194339ffd6edf3ff6a078808fc5251fe50

8 years ago- 1.1.6 rel_1_1_6
Mike Bayer [Tue, 28 Feb 2017 16:41:24 +0000 (11:41 -0500)] 
- 1.1.6

8 years agoAdd new reserved words for MySQL 8.0 (beta).
Hanno Schlichting [Tue, 28 Feb 2017 16:10:57 +0000 (11:10 -0500)] 
Add new reserved words for MySQL 8.0 (beta).

Based on https://dev.mysql.com/doc/refman/8.0/en/keywords.html#table-keywords-new-8.0

Change-Id: I128c93520e57331e0ec4d40b0c0e752bf9b982d9
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/346

8 years agoPerformance within instances()
Mike Bayer [Thu, 23 Feb 2017 19:40:00 +0000 (14:40 -0500)] 
Performance within instances()

Continuing from Ie43beecf37945b2bb7fff0aaa597a597293daa18,
also observed is the overhead of PathRegsitry memoized token
functions, as these paths are not cached in the case of
long joinedloader chains.  The memoizations here were made
with short paths in mind, and have been replaced with
an inlined straight create of these paths up front, producing
callcounts very similar to 0.8. Combined with the previous
optimizations, 1.1 now runs the "joined eager load of one row"
worst case test in about 40% fewer calls than 0.8 and 60%
fewer than 1.1.5.

Change-Id: Ib5e1c1345a1dd8edfbdb3fed06eb717d4e164d31
Fixes: #3915
8 years agoMerge "Memoize AliasedClass, ClauseAdapter objects in joined eager load"
mike bayer [Wed, 22 Feb 2017 22:16:28 +0000 (17:16 -0500)] 
Merge "Memoize AliasedClass, ClauseAdapter objects in joined eager load"

8 years ago- add test for inserting PG array w/ NULL, references #3916
Mike Bayer [Thu, 16 Feb 2017 18:00:28 +0000 (13:00 -0500)] 
- add test for inserting PG array w/ NULL, references #3916

Change-Id: I87be274c1ba019b41744a5a76c1b5e9334564ec8

8 years agoMemoize AliasedClass, ClauseAdapter objects in joined eager load
Mike Bayer [Thu, 16 Feb 2017 16:31:26 +0000 (11:31 -0500)] 
Memoize AliasedClass, ClauseAdapter objects in joined eager load

Addressed some long unattended performance concerns within the
joined eager loader query construction system.  The use of ad-hoc
:class:`.AliasedClass` objects per query, which produces lots of column
lookup overhead each time, has been replaced with a cached approach
that makes use of a small pool of :class:`.AliasedClass` objects
that are reused between invocations of joined eager loading.
Callcount reduction of SQL query generation for worst-case joined
loader scenarios (lots of joins, lots of columns) is reduced by
approximately 270%.

Change-Id: Ie43beecf37945b2bb7fff0aaa597a597293daa18
Fixes: #3915
8 years agoAdd new DDL autocommit expressions for Postgresql
Mike Bayer [Mon, 13 Feb 2017 19:20:38 +0000 (14:20 -0500)] 
Add new DDL autocommit expressions for Postgresql

Added regular expressions for the "IMPORT FOREIGN SCHEMA",
"REFRESH MATERIALIZED VIEW" Postgresql statements so that they
autocommit when invoked via a connection or engine without
an explicit transaction.  Pull requests courtesy Frazer McLean
and Paweł Stiasny.

Fixes: #3840
Co-authored-by: Frazer McLean
Co-authored-by: Paweł Stiasny
Change-Id: I92b2b61683d29d57fa23a66a3559120cb1241c2f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/323

8 years ago- limit to MySQL dialect
Mike Bayer [Mon, 13 Feb 2017 19:40:55 +0000 (14:40 -0500)] 
- limit to MySQL dialect

Change-Id: I2781e1e2221d89c75dd65ff49490d9c409967930

8 years ago- pull autocommit suite into the mysql suite as well
Mike Bayer [Mon, 13 Feb 2017 19:33:21 +0000 (14:33 -0500)] 
- pull autocommit suite into the mysql suite as well

Change-Id: If1106f7f125739e69ad2482f65b8f37672a76c9e

8 years ago- add a test suite that ensures textual autocommit works
Mike Bayer [Mon, 13 Feb 2017 19:17:11 +0000 (14:17 -0500)] 
- add a test suite that ensures textual autocommit works
for correct expressions

Change-Id: I17d35169be914924828487abba05658dff380f2a

8 years agopytds based connector for MS-SQL
Grzegorz Makarewicz [Sun, 12 Feb 2017 19:10:43 +0000 (20:10 +0100)] 
pytds based connector for MS-SQL

8 years agoCheck for columns not part of mapping, correct mapping for eager_defaults
Mike Bayer [Thu, 9 Feb 2017 02:05:16 +0000 (21:05 -0500)] 
Check for columns not part of mapping, correct mapping for eager_defaults

Fixed two closely related bugs involving the mapper eager_defaults
flag in conjunction with single-table inheritance; one where the
eager defaults logic would inadvertently try to access a column
that's part of the mapper's "exclude_properties" list (used by
Declarative with single table inheritance) during the eager defaults
fetch, and the other where the full load of the row in order to
fetch the defaults would fail to use the correct inheriting mapper.

Fixes: #3908
Change-Id: Ie745174c917d512e2c46d9e3cc14512cde53cc9a

8 years agoDon't post-SELECT columns w/o a server default/onupdate for eager_defaults
Mike Bayer [Thu, 9 Feb 2017 02:42:34 +0000 (21:42 -0500)] 
Don't post-SELECT columns w/o a server default/onupdate for eager_defaults

Fixed a major inefficiency in the "eager_defaults" feature whereby
an unnecessary SELECT would be emitted for column values where the
ORM had explicitly inserted NULL, corresponding to attributes that
were unset on the object but did not have any server default
specified, as well as expired attributes on update that nevertheless
had no server onupdate set up.   As these columns are not part of the
RETURNING that eager_defaults tries to use, they should not be
post-SELECTed either.

Change-Id: I0d4f1e9d3d9717d68dcc0592f69456a1f1c36df8
Fixes: #3909
8 years ago- document Query.with_session(), direct constructor usage
Mike Bayer [Wed, 8 Feb 2017 22:47:29 +0000 (17:47 -0500)] 
- document Query.with_session(), direct constructor usage

Change-Id: I47499d040623202dd9b3be0ea65f2d9ad03c11a4

8 years agoMake all tests to be PEP8 compliant
Khairi Hafsham [Thu, 2 Feb 2017 18:02:21 +0000 (13:02 -0500)] 
Make all tests to be PEP8 compliant

tested using pycodestyle version 2.2.0

Fixes: #3885
Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343

8 years agoMerge "Accept FetchedValue, text() for column "default" value"
mike bayer [Wed, 1 Feb 2017 23:13:06 +0000 (18:13 -0500)] 
Merge "Accept FetchedValue, text() for column "default" value"

8 years ago- add a note referring to the enum value as not currently persisted,
Mike Bayer [Wed, 1 Feb 2017 23:09:45 +0000 (18:09 -0500)] 
- add a note referring to the enum value as not currently persisted,
reference #3906

Change-Id: I2274c356cc88cd011c5a34a69e75a2548a93e87a

8 years agoAccept FetchedValue, text() for column "default" value
Mike Bayer [Wed, 1 Feb 2017 21:25:31 +0000 (16:25 -0500)] 
Accept FetchedValue, text() for column "default" value

Fixed bug whereby the :meth:`.DDLEvents.column_reflect` event would not
allow a non-textual expression to be passed as the value of the
"default" for the new column, such as a :class:`.FetchedValue`
object to indicate a generic triggered default or a
:func:`.sql.expression.text` construct.  Clarified the documentation
in this regard as well.

Fixes: #3905
Change-Id: I829796c3e9f87f375149bebee7eef133a6876d4d

8 years ago- clarify Enum validation rules, fixes #3904
Mike Bayer [Wed, 1 Feb 2017 21:39:48 +0000 (16:39 -0500)] 
- clarify Enum validation rules, fixes #3904

Change-Id: I221f161ae77ee1b9487329330bc520ab65e97611

8 years agoUnion the exclude_properties of the inheriting mapper in declarative
Mike Bayer [Thu, 26 Jan 2017 21:11:49 +0000 (16:11 -0500)] 
Union the exclude_properties of the inheriting mapper in declarative

Fixed bug where the "automatic exclude" feature of declarative that
ensures a column local to a single table inheritance subclass does
not appear as an attribute on other derivations of the base would
not take effect for multiple levels of subclassing from the base.

Change-Id: Ibf67b631b4870dd1bd159f7d6085549d299fffe0
Fixes: #3895
8 years agoMerge "Add count(), scalar() to baked query"
mike bayer [Mon, 30 Jan 2017 22:27:21 +0000 (17:27 -0500)] 
Merge "Add count(), scalar() to baked query"