]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
8 years agoInclude missing import in example
Michael Stewart [Fri, 30 Jun 2017 21:02:20 +0000 (14:02 -0700)] 
Include missing import in example

8 years agoCoerce to float for Float with all native decimal backends
Mike Bayer [Mon, 26 Jun 2017 20:50:24 +0000 (16:50 -0400)] 
Coerce to float for Float with all native decimal backends

The result processor for the :class:`.Float` type now unconditionally
runs values through the ``float()`` processor if the dialect
specifies that it also supports "native decimal" mode.  While most
backends will deliver Python ``float`` objects for a floating point
datatype, the MySQL backends in some cases lack the typing information
in order to provide this and return ``Decimal`` unless the float
conversion is done.

Change-Id: I638f1480fb00a507036efaf0e0080f26893d98ad
Fixes: #4020
8 years agoMerge "Support state expiration for with_expression(); rename deferred_expression"
mike bayer [Mon, 26 Jun 2017 19:47:50 +0000 (15:47 -0400)] 
Merge "Support state expiration for with_expression(); rename deferred_expression"

8 years agoSupport state expiration for with_expression(); rename deferred_expression
Mike Bayer [Mon, 26 Jun 2017 17:24:22 +0000 (13:24 -0400)] 
Support state expiration for with_expression(); rename deferred_expression

The attributeimpl for a deferred_expression does not
support a scalar loader, add new configurability so that
the impl can have this flag turned off.   Document
that the with_expression() system currently does not
offer any deferred loading.

To eliminate confusion over "deferred", which refers to
lazy loading of column attributes, and "with_expression",
which refers to an attribute that is explicitly at
query time only, rename deferred_expression to query_expression.

Change-Id: I07c4a050ed68c79ccbde9492e9de1630b7470d74

8 years agoReturn given type when it matches the adaptation
Mike Bayer [Mon, 26 Jun 2017 16:44:15 +0000 (12:44 -0400)] 
Return given type when it matches the adaptation

The rules for type coercion between :class:`.Numeric`, :class:`.Integer`,
and date-related types now include additional logic that will attempt
to preserve the settings of the incoming type on the "resolved" type.
Currently the target for this is the ``asdecimal`` flag, so that
a math operation between :class:`.Numeric` or :class:`.Float` and
:class:`.Integer` will preserve the "asdecimal" flag as well as
if the type should be the :class:`.Float` subclass.

Change-Id: Idfaba17220d6db21ca1ca4dcb4c19834cd397817
Fixes: #4018
8 years agoMerge "Coerce float Python type to Float; ensure Python float coming back"
mike bayer [Mon, 26 Jun 2017 15:56:38 +0000 (11:56 -0400)] 
Merge "Coerce float Python type to Float; ensure Python float coming back"

8 years agoCoerce float Python type to Float; ensure Python float coming back
Mike Bayer [Fri, 23 Jun 2017 03:51:52 +0000 (23:51 -0400)] 
Coerce float Python type to Float; ensure Python float coming back

Added some extra strictness to the handling of Python "float" values
passed to SQL statements.  A "float" value will be associated with the
:class:`.Float` datatype and not the Decimal-coercing :class:`.Numeric`
datatype as was the case before, eliminating a confusing warning
emitted on SQLite as well as unecessary coercion to Decimal.

Change-Id: I1bb1810ff1d198c0d929ccba5656e55401d74119
Fixes: #4017
8 years agoadded link for CrateDB support
Jodok Batlogg [Fri, 23 Jun 2017 19:16:18 +0000 (21:16 +0200)] 
added link for CrateDB support

8 years agoDon't erase reflected comment in _init_existing
Eloy Felix [Tue, 20 Jun 2017 13:29:34 +0000 (09:29 -0400)] 
Don't erase reflected comment in _init_existing

Change-Id: Ie0b78c79367933486528ca0ba686d4a9f16922b1
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/370

8 years agoAdd ad-hoc mapped expressions
Mike Bayer [Mon, 19 Jun 2017 20:35:53 +0000 (16:35 -0400)] 
Add ad-hoc mapped expressions

Added a new feature :func:`.orm.with_expression` that allows an ad-hoc
SQL expression to be added to a specific entity in a query at result
time.  This is an alternative to the SQL expression being delivered as
a separate element in the result tuple.

Change-Id: Id8c479f7489fb02e09427837c59d1eabb2a6c014
Fixes: #3058
8 years ago- 1.1.11 release date
Mike Bayer [Mon, 19 Jun 2017 15:00:59 +0000 (11:00 -0400)] 
- 1.1.11 release date

Change-Id: I351e5727368b67598d091e5153a66987e349f8f6

8 years agoMerge "Handle SHOW VARIABLES returning no row"
mike bayer [Fri, 16 Jun 2017 22:40:13 +0000 (18:40 -0400)] 
Merge "Handle SHOW VARIABLES returning no row"

8 years agoMerge "Add all versioning logic to _post_update()"
mike bayer [Fri, 16 Jun 2017 20:41:14 +0000 (16:41 -0400)] 
Merge "Add all versioning logic to _post_update()"

8 years agoHandle SHOW VARIABLES returning no row
Mike Bayer [Fri, 16 Jun 2017 17:30:25 +0000 (13:30 -0400)] 
Handle SHOW VARIABLES returning no row

MySQL 5.7 has introduced permission limiting for the "SHOW VARIABLES"
command; the MySQL dialect will now handle when SHOW returns no
row, in particular for the initial fetch of SQL_MODE, and will
emit a warning that user permissions should be modified to allow the
row to be present.

Change-Id: I98e7a69230da397b17eae07b7e9d024fa7aeeb26
Fixes: #4007
8 years agoSet complete FROM list for subquery eagerload's orig query
Mike Bayer [Thu, 15 Jun 2017 17:12:16 +0000 (13:12 -0400)] 
Set complete FROM list for subquery eagerload's orig query

Instead of checking that the "orig_entity" we receive applies
as a correct FROM element for the subquery we're building,
set the FROM clause of the query to exactly what it already
is based on column_descriptions (assuming there is no FROM
list already), thereby ensuring that the FROM list will remain
intact, regardless of what orig_entity turns out to be and
what the target_cols ultimately refer towards.

Fixed issue with subquery eagerloading which continues on from
the series of issues fixed in :ticket:`2699`, :ticket:`3106`,
:ticket:`3893` involving that the "subquery" contains the correct
FROM clause when beginning from a joined inheritance subclass
and then subquery eager loading onto a relationship from
the base class, while the query also includes criteria against
the subclass. The fix in the previous tickets did not accommodate
for additional subqueryload operations loading more deeply from
the first level, so the fix has been further generalized.

Change-Id: Ic909590814f71e577d8266b1dbc4c393dc48e019
Fixes: #4011
8 years agoRepair WithinGroup.get_children()
Mike Bayer [Fri, 16 Jun 2017 13:58:03 +0000 (09:58 -0400)] 
Repair WithinGroup.get_children()

Fixed AttributeError which would occur in :class:`.WithinGroup`
construct during an iteration of the structure.

Change-Id: I563882d93c8c32292463a605b636aa60c77e9406
Fixes: #4012
8 years agoAdd all versioning logic to _post_update()
Mike Bayer [Tue, 12 Apr 2016 19:57:20 +0000 (15:57 -0400)] 
Add all versioning logic to _post_update()

An UPDATE emitted as a result of the
:paramref:`.relationship.post_update` feature will now integrate with
the versioning feature to both bump the version id of the row as well
as assert that the existing version number was matched.

Fixes: #3496
Change-Id: I865405dd6069f1c1e3b0d27a4980e9374e059f97

8 years ago- remove redundant fixture from base test class
Mike Bayer [Thu, 15 Jun 2017 20:07:06 +0000 (16:07 -0400)] 
- remove redundant fixture from base test class

Change-Id: I76f197d5b2b39ae476bfff924e899773aa123be0

8 years ago- ensure String has a length for mysql compatibility
Mike Bayer [Thu, 15 Jun 2017 17:51:14 +0000 (13:51 -0400)] 
- ensure String has a length for mysql compatibility

Change-Id: Iaa1077ca5929bdc67300cc6bfb1ba98aff382246

8 years agoRepair regression to pathing for subclasses
Mike Bayer [Thu, 15 Jun 2017 16:03:22 +0000 (12:03 -0400)] 
Repair regression to pathing for subclasses

Issue #3963's initial commit narrowed the "current path"
match rules too much such that a path that matches current
path on subclass would no longer match.

Change-Id: I8c9a0db91a09d789cfb8666288a913f8bbcdb2e9
Fixes: #3963
8 years agoRefinements for unitofwork internals
Mike Bayer [Wed, 14 Jun 2017 16:53:00 +0000 (12:53 -0400)] 
Refinements for unitofwork internals

* remove "mapper" argument from SaveUpdateState, DeleteState
* use __slots__ for all uow action classes
* rename ".delete" to ".isdelete"
* rename issue_post_update to register_post_update since this
  doesn't actually issue the UPDATE
* rename IssuePostUpdate to PostUpdateAll

Change-Id: Ia6263b80d6a86eab1e8ed38df1421b1d0f249797

8 years agoSupport AssociationProxy any() / has() / contains() to another AssociationProxy
Mike Bayer [Mon, 12 Jun 2017 16:56:04 +0000 (12:56 -0400)] 
Support AssociationProxy any() / has() / contains() to another AssociationProxy

The :meth:`.AssociationProxy.any`, :meth:`.AssociationProxy.has`
and :meth:`.AssociationProxy.contains`
comparison methods now support linkage to an attribute that
is itself also an :class:`.AssociationProxy`, recursively.

After some initial attempts it's clear that the any() / has()
of AssociationProxy needed to be reworked into a generic
_criterion_exists() to allow this to work recursively without
excess complexity.  For the case of the multi-linked associationproxy,
the usual checks of "any()" / "has()" correctness simply don't
take place; for a single-link association proxy the error
checking logic that takes place in relationship() has been
ported to the local any() / has() methods.

Change-Id: Ic5aed2a4e910b8138a737d215430113c31cce856
Fixes: #3769
8 years agoRender ARRAY index embedded between type and COLLATE
Mike Bayer [Thu, 8 Jun 2017 16:55:23 +0000 (12:55 -0400)] 
Render ARRAY index embedded between type and COLLATE

Fixed bug where using :class:`.ARRAY` with a string type that
features a collation would fail to produce the correct syntax
within CREATE TABLE.

The "COLLATE" must appear to the right of the array dimensions,
so we are using regexp substitution to insert the brackets in the
appropriate place.  A more heavyweight solution would be that datatypes
know how to split up their base type vs. modifiers, but as this is
so specific to Postgresql ARRAY it's better to handle these cases
more locally.

Change-Id: I394c3c673eb60689e51b5301e51651972cfdb4c0
Fixes: #4006
8 years agoParse for Postgresql version w/ "beta"
Mike Bayer [Wed, 7 Jun 2017 16:30:22 +0000 (12:30 -0400)] 
Parse for Postgresql version w/ "beta"

Continuing with the fix that correctly handles Postgresql
version string "10devel" released in 1.1.8, an additional regexp
bump to handle version strings of the form "10beta1".   While
Postgresql now offers better ways to get this information, we
are sticking w/ the regexp at least through 1.1.x for the least
amount of risk to compatibility w/ older or alternate Postgresql
databases.

Change-Id: I12ddb06465f7dcf80563c27632441ef5963f60d4
Fixes: #4005
8 years ago- assert passive_deletes='all' does not affect collection/scalar
Mike Bayer [Tue, 6 Jun 2017 22:53:03 +0000 (18:53 -0400)] 
- assert passive_deletes='all' does not affect collection/scalar
membership removal

in issue #3844 we hypotheized that passive_deletes='all' was broken
because it sets to NULL a foreign key attribute when the child
object is removed or replaced.   However, not doing the NULL
set means that nothing happens at all and the operation silently
fails.

Change-Id: I11834e7e324349e172dc797bac62731008b6b95a

8 years ago- make sure ticket # is here
Mike Bayer [Tue, 6 Jun 2017 21:59:19 +0000 (17:59 -0400)] 
- make sure ticket # is here

Change-Id: I7d54026da9a9a9331a4fd7e675dbfe9c433fe2e4

8 years agoWarn when declared_attr.cascading detected on mapped class
Mike Bayer [Tue, 6 Jun 2017 21:13:54 +0000 (17:13 -0400)] 
Warn when declared_attr.cascading detected on mapped class

A warning is emitted if the :attr:`.declared_attr.cascading` modifier
is used with a declarative attribute that is itself declared on
a class that is to be mapped, as opposed to a declarative mixin
class or ``__abstract__`` class.  The :attr:`.declared_attr.cascading`
modifier currently only applies to mixin/abstract classes.

Also add a test for @declared_attr.cascading when used on an attribute
on __abstract__.

Change-Id: Ib1b9dbe373e8be1cf24eadfed224a8988b3cd95d
Fixes: #3847
8 years agoRe-send column value w/ onupdate default during post-update
Mike Bayer [Tue, 6 Jun 2017 17:54:33 +0000 (13:54 -0400)] 
Re-send column value w/ onupdate default during post-update

Adjusted the behavior of post_update such that if a column with
an "onupdate" default has received an explicit value for
INSERT, re-send the same data during a post-update UPDATE so
that the value remains in effect, rather than an onupdate
overwriting it.

Change-Id: I26bccb6f957dcad07a2bcbda2dd9e14c60b92b06
Fixes: #3471
8 years agoMerge "Implement _postfetch_post_update to expire/refresh onupdates in post_update"
mike bayer [Tue, 6 Jun 2017 17:40:27 +0000 (13:40 -0400)] 
Merge "Implement _postfetch_post_update to expire/refresh onupdates in post_update"

8 years agoImplement _postfetch_post_update to expire/refresh onupdates in post_update
Mike Bayer [Tue, 12 Apr 2016 19:56:02 +0000 (15:56 -0400)] 
Implement _postfetch_post_update to expire/refresh onupdates in post_update

Fixed bug involving the :paramref:`.relationship.post_update` feature
where a column "onupdate" value would not result in expiration or
refresh of the corresponding object attribute, if the UPDATE for the
row were a result of the "post update" feature.  Additionally, the
:meth:`.SessionEvents.refresh_flush` event is now emitted for these
attributes when refreshed within the flush.

Fixes: #3472
Change-Id: I5ee2d715e773a306ab1e8143e4382c228991ac78

8 years agoImplement in-place mutation operators for MutableSet, MutableList
Mike Bayer [Mon, 5 Jun 2017 19:49:04 +0000 (15:49 -0400)] 
Implement in-place mutation operators for MutableSet, MutableList

Implemented in-place mutation operators ``__ior__``, ``__iand__``,
``__ixor__`` and ``__isub__`` for :class:`.mutable.MutableSet`
and ``__iadd__`` for :class:`.mutable.MutableList` so that change
events are fired off when these mutator methods are used to alter the
collection.

Change-Id: Ib357a96d3b06c5deb6b53eb304a8b9f1dc9e9ede
Fixes: #3853
8 years agoselectin polymorphic loading
Mike Bayer [Tue, 28 Mar 2017 15:00:37 +0000 (11:00 -0400)] 
selectin polymorphic loading

Added a new style of mapper-level inheritance loading
"polymorphic selectin".  This style of loading
emits queries for each subclass in an inheritance
hierarchy subsequent to the load of the base
object type, using IN to specify the desired
primary key values.

Fixes: #3948
Change-Id: I59e071c6142354a3f95730046e3dcdfc0e2c4de5

8 years agoMerge branch 'fix-typo' of https://github.com/lelit/sqlalchemy
Mike Bayer [Fri, 2 Jun 2017 22:35:54 +0000 (18:35 -0400)] 
Merge branch 'fix-typo' of https://github.com/lelit/sqlalchemy

8 years agoFix a few doc typos
Lele Gaifax [Mon, 22 May 2017 13:03:06 +0000 (15:03 +0200)] 
Fix a few doc typos

8 years agoImplement get_unique_constraints, get_check_constraints for Oracle
Eloy Felix [Mon, 12 Dec 2016 17:09:54 +0000 (12:09 -0500)] 
Implement get_unique_constraints, get_check_constraints for Oracle

Pull-request: https://github.com/zzzeek/sqlalchemy/pull/326
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/342

Fixes: #4002
Change-Id: I221fe8ba305fc455a03e3a5d15f803bf8ee2e8fb

8 years agoDon't hard-evaluate non-ORM @declared_attr for AbstractConcreteBase
Mike Bayer [Fri, 26 May 2017 17:26:40 +0000 (13:26 -0400)] 
Don't hard-evaluate non-ORM @declared_attr for AbstractConcreteBase

Fixed bug where using :class:`.declared_attr` on an
:class:`.AbstractConcreteBase` where a particular return value were some
non-mapped symbol, including ``None``, would cause the attribute
to hard-evaluate just once and store the value to the object
dictionary, not allowing it to invoke for subclasses.   This behavior
is normal when :class:`.declared_attr` is on a mapped class, and
does not occur on a mixin or abstract class.  Since
:class:`.AbstractConcreteBase` is both "abstract" and actually
"mapped", a special exception case is made here so that the
"abstract" behavior takes precedence for :class:`.declared_attr`.

Change-Id: I6160ebb3a52c441d6a4b663c8c9bbac6d37fa417
Fixes: #3848
8 years agoAdd placeholder XML support
Mike Bayer [Fri, 26 May 2017 15:24:25 +0000 (11:24 -0400)] 
Add placeholder XML support

Added a placeholder type :class:`.mssql.XML` to the SQL Server
dialect, so that a reflected table which includes this type can
be re-rendered as a CREATE TABLE.  The type has no special round-trip
behavior nor does it currently support additional qualifying
arguments.

Change-Id: I651fa729bd8e9b31a0b5effe0839aff077d77c46
Fixes: #3973
8 years agoMerge "Raise if ForeignKeyConstraint created with different numbers of local and...
mike bayer [Thu, 25 May 2017 20:24:25 +0000 (16:24 -0400)] 
Merge "Raise if ForeignKeyConstraint created with different numbers of local and remote columns."

8 years agoFlatten operator precedence for comparison operators
Michael Birtwell [Thu, 25 May 2017 15:11:21 +0000 (11:11 -0400)] 
Flatten operator precedence for comparison operators

The operator precedence for all comparison operators such as LIKE, IS,
IN, MATCH, equals, greater than, less than, etc. has all been merged
into one level, so that expressions which make use of these against
each other will produce parentheses between them.   This suits the
stated operator precedence of databases like Oracle, MySQL and others
which place all of these operators as equal precedence, as well as
Postgresql as of 9.5 which has also flattened its operator precendence.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #3999
Change-Id: I3f3d5124a64af0d376361cdf15a97e2e703be56f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/367

8 years agoRaise if ForeignKeyConstraint created with different numbers of
Mike Bayer [Thu, 25 May 2017 14:17:11 +0000 (10:17 -0400)] 
Raise if ForeignKeyConstraint created with different numbers of
local and remote columns.

An :class:`.ArgumentError` is now raised if a
:class:`.ForeignKeyConstraint` object is created with a mismatched
number of "local" and "remote" columns, which otherwise causes the
internal state of the constraint to be incorrect.   Note that this
also impacts the condition where a dialect's reflection process
produces a mismatched set of columns for a foreign key constraint.

Downstream DB2 dialect has been reported as potentially causing this
scenario.

Change-Id: Id51c34a6c43749bb582639f9c1dc28723482f0e5
Fixes: #3949
References: #3998

8 years agoAdd with_for_update() support in session.refresh()
Mike Bayer [Mon, 15 May 2017 13:39:19 +0000 (09:39 -0400)] 
Add with_for_update() support in session.refresh()

Session.refresh() is still hardcoded to legacy lockmode,
come up with a new API so that the newer argument style
works with it.

Added new argument :paramref:`.with_for_update` to the
:meth:`.Session.refresh` method.  When the :meth:`.Query.with_lockmode`
method were deprecated in favor of :meth:`.Query.with_for_update`,
the :meth:`.Session.refresh` method was never updated to reflect
the new option.

Change-Id: Ia02a653746b7024699b515451525a88d7a17d63a
Fixes: #3991
8 years ago- add forwards-version
Mike Bayer [Tue, 23 May 2017 19:44:52 +0000 (15:44 -0400)] 
- add forwards-version

Change-Id: Id1652beb13209aac203456c88acff629048e00cc

8 years agoMerge "Remove twophase for cx_Oracle 6.x"
mike bayer [Tue, 23 May 2017 19:42:27 +0000 (15:42 -0400)] 
Merge "Remove twophase for cx_Oracle 6.x"

8 years agoRemove twophase for cx_Oracle 6.x
Mike Bayer [Tue, 23 May 2017 14:17:51 +0000 (10:17 -0400)] 
Remove twophase for cx_Oracle 6.x

Support for two-phase transactions has been removed entirely for
cx_Oracle when version 6.0b1 or later of the DBAPI is in use.  The two-
phase feature historically has never been usable under cx_Oracle 5.x in
any case, and cx_Oracle 6.x has removed the connection-level "twophase"
flag upon which this feature relied.

Change-Id: I2e8161cc2bc12f4845c9224cd483038112fe9734
Fixes: #3997
8 years agoAdd AttributeEvents.modified
Mike Bayer [Mon, 22 May 2017 19:42:59 +0000 (15:42 -0400)] 
Add AttributeEvents.modified

Added new event handler :meth:`.AttributeEvents.modified` which is
triggered when the func:`.attributes.flag_modified` function is
invoked, which is common when using the :mod:`sqlalchemy.ext.mutable`
extension module.

Change-Id: Ic152f1d5c53087d780b24ed7f1f1571527b9e8fc
Fixes: #3303
8 years ago- add option to disable py.test warnings plugin;
Mike Bayer [Tue, 23 May 2017 16:24:26 +0000 (12:24 -0400)] 
- add option to disable py.test warnings plugin;
lift cap on py.test.
references: https://github.com/pytest-dev/pytest/issues/2430

Change-Id: Ieb8a6258ba1d15efa570d9cda2b51cf021499a23

8 years agoMerge "Add clause adaptation for AliasedClass to with_parent()"
mike bayer [Tue, 23 May 2017 16:08:51 +0000 (12:08 -0400)] 
Merge "Add clause adaptation for AliasedClass to with_parent()"

8 years ago- add session.close() w/ rationale to top-level "using transactions"
Mike Bayer [Tue, 23 May 2017 15:35:12 +0000 (11:35 -0400)] 
- add session.close() w/ rationale to top-level "using transactions"
 section.  References #3974

Change-Id: Idb650cbe9825cfae893ee917132b5b9d693f0c6c

8 years agoAdd clause adaptation for AliasedClass to with_parent()
Mike Bayer [Mon, 22 May 2017 19:08:10 +0000 (15:08 -0400)] 
Add clause adaptation for AliasedClass to with_parent()

Fixed bug where :meth:`.Query.with_parent` would not work if the
:class:`.Query` were against an :func:`.aliased` construct rather than
a regular mapped class.  Also adds a new parameter
:paramref:`.util.with_parent.from_entity` to the standalone
:func:`.util.with_parent` function as well as
:meth:`.Query.with_parent`.

Change-Id: Ic684dd63cc90b582c7580c9bba3c92fa3f286da7
Fixes: #3607
8 years ago- pin py.test at 3.0.7 due to https://github.com/pytest-dev/pytest/issues/2430
Mike Bayer [Tue, 23 May 2017 15:12:22 +0000 (11:12 -0400)] 
- pin py.test at 3.0.7 due to https://github.com/pytest-dev/pytest/issues/2430

Change-Id: I587282da141aa6ea92f944eeb4c9e5782d0b5f29

8 years ago- remove .gitattributes and merge=union as this isn't really
Mike Bayer [Mon, 22 May 2017 22:42:17 +0000 (18:42 -0400)] 
- remove .gitattributes and merge=union as this isn't really
working anyway.   need to try something else.

Change-Id: Iabcefa4b66d242acb74a8135c2f5a6a4345441a7

8 years agoRepair formatting throughout documentation
Kataev Denis [Mon, 22 May 2017 21:52:45 +0000 (17:52 -0400)] 
Repair formatting throughout documentation

1. Section decorators to [one style](http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections):
without inset at both side and with same length as text.
2. Fix broken [reference](http://docs.sqlalchemy.org/en/latest/core/type_basics.html#generic-types).
3. Convert tabs to space in some small files.
4. Some python code snippets have python+sql syntax hint.

Change-Id: I39a7a41ef0b0591c6bf1e610748e2b5c19fc5379
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/361

8 years agodetect and raise for version_id is NULL
Diana Clarke [Tue, 14 Mar 2017 17:03:11 +0000 (13:03 -0400)] 
detect and raise for version_id is NULL

The versioning feature does not support NULL for the version counter.
An exception is now raised if the version id is programmatic and
was set to NULL for an UPDATE.  Pull request courtesy Diana Clarke.

Fixes: #3673
Change-Id: I8b0da56234a7c7f5e7fde35536e09a6216a5e48a

8 years agoMerge "Detect no params w/ manual version_id counter and set to itself"
mike bayer [Mon, 22 May 2017 20:25:20 +0000 (16:25 -0400)] 
Merge "Detect no params w/ manual version_id counter and set to itself"

8 years agoAllow metadata.reflect() to recover from unreflectable tables
Mike Bayer [Mon, 22 May 2017 18:08:55 +0000 (14:08 -0400)] 
Allow metadata.reflect() to recover from unreflectable tables

Added support for views that are unreflectable due to stale
table definitions, when calling :meth:`.MetaData.reflect`; a warning
is emitted for the table that cannot respond to ``DESCRIBE``
but the operation succeeds.  The MySQL dialect now
raises UnreflectableTableError which is in turn caught by
MetaData.reflect().  Reflecting the view standalone raises
this error directly.

Change-Id: Id8005219d8e073c154cc84a873df911b4a6cf4d6
Fixes: #3871
8 years agoDetect no params w/ manual version_id counter and set to itself
Mike Bayer [Mon, 22 May 2017 18:47:26 +0000 (14:47 -0400)] 
Detect no params w/ manual version_id counter and set to itself

Fixed bug where programmatic version_id counter in conjunction with
joined table inheritance would fail if the version_id counter
were not actually incremented and no other values on the base table
were modified, as the UPDATE would have an empty SET clause.  Since
programmatic version_id where version counter is not incremented
is a documented use case, this specific condition is now detected
and the UPDATE now sets the version_id value to itself, so that
concurrency checks still take place.

Change-Id: I80e385bffeed4851cc20131cbe983c173a46f655
Fixes: #3996
8 years ago- add a note to versioning that version id col cannot be null,
Mike Bayer [Mon, 22 May 2017 18:32:06 +0000 (14:32 -0400)] 
- add a note to versioning that version id col cannot be null,
is not supported.

Change-Id: I3724fea3f2d508210e35827eb1ea17f5e334da19
Fixes: #3673
(cherry picked from commit fcaf17766fdd22e67407e432f7666d63439d7a39)
(cherry picked from commit 8cce3beef729e51eaed2d01a6ba0b0677abc7b36)

8 years agoRemove "scope" keyword from scoped_session.__call__()
Mike Bayer [Mon, 22 May 2017 17:00:38 +0000 (13:00 -0400)] 
Remove "scope" keyword from scoped_session.__call__()

Removed a very old keyword argument from :class:`.scoped_session`
called ``scope``.  This keyword was never documented and was an
early attempt at allowing for variable scopes.

Change-Id: I9a26498a1a66d1eafb0723e98b527688a60f9d9b
Fixes: #3796
8 years agoPrevent SQL server isolation level from failing
Mike Bayer [Sun, 21 May 2017 19:28:00 +0000 (15:28 -0400)] 
Prevent SQL server isolation level from failing

Fixed bug where SQL Server transaction isolation must be fetched
from a different view when using Azure data warehouse, the query
is now attempted against both views and then a NotImplemented
is raised unconditionally if failure continues to provide the
best resiliency against future arbitrary API changes in new
SQL Server versions.

Change-Id: I621b5089febe8ace136428fa133fde1a7e21cda4
Fixes: #3994
8 years ago- add 1.1.11 placeholder
Mike Bayer [Sun, 21 May 2017 19:24:49 +0000 (15:24 -0400)] 
- add 1.1.11 placeholder

Change-Id: Ia45668f2882ac0e59ade390262b09cbb62ecac0b

8 years ago- 1.1.10 release date
Mike Bayer [Fri, 19 May 2017 20:20:59 +0000 (16:20 -0400)] 
- 1.1.10 release date

Change-Id: I6418052571c86b53f44b1a083fca932a65448d95

8 years ago- Document the most transparent way to set JSON.NULL for
Mike Bayer [Thu, 18 May 2017 21:44:10 +0000 (17:44 -0400)] 
- Document the most transparent way to set JSON.NULL for
a column default.

The JSON.NULL value is special in that while it is a Python-side
value, it represents "do this special behavior", and is not at all
like any other Python-side value for which normally, that's exactly
the type of data we want back.   So in this case, encourage the user
to use a SQL expression that is exact, so in the ORM context, you get
back what was actually persisted in the column.  There's some variants
of this such as literal(JSON.NULL, JSON) but text("'null'") is simpler.

Change-Id: I0339fafdc03e4b2f533d53970b2f74c774f2687b
Fixes: #3923
8 years agoAdd new configuration, inspection for baked queries
Mike Bayer [Wed, 17 May 2017 17:05:04 +0000 (13:05 -0400)] 
Add new configuration, inspection for baked queries

Added new flag :paramref:`.Session.enable_baked_queries` to the
:class:`.Session` to allow baked queries to be disabled
session-wide, reducing memory use.   Also added new :class:`.Bakery`
wrapper so that the bakery returned by :paramref:`.BakedQuery.bakery`
can be inspected.

Change-Id: I5657af7a99d2b24c89d6aee1343f432728e3f807

8 years ago- add complete parameter /return value docs to session.begin() /
Mike Bayer [Wed, 17 May 2017 14:46:52 +0000 (10:46 -0400)] 
- add complete parameter /return value docs to session.begin() /
session.begin_nested().  Fixes #3993

Change-Id: If485d77b364c34d94061d2f48efbde3f8a8adec9

8 years ago- give SelectinLoader its own bakery, dont use mapper
Mike Bayer [Wed, 17 May 2017 02:13:40 +0000 (22:13 -0400)] 
- give SelectinLoader its own bakery, dont use mapper
level cache
- include SelectinLoader itself in the cache key, though
this is currently not critical

Change-Id: I8e4bcd579277fbe53d9c7eca3552a0b8ab9d7a39

8 years ago- move additional sections under with_polymorphic missed
Mike Bayer [Tue, 16 May 2017 15:00:41 +0000 (11:00 -0400)] 
- move additional sections under with_polymorphic missed
in the previous change

Change-Id: I20217d4d4ebfc033229d87e472ad82d32202617a

8 years ago- categorize these two with_polymorphic subsections under with_polymorphic
Mike Bayer [Tue, 16 May 2017 14:51:14 +0000 (10:51 -0400)] 
- categorize these two with_polymorphic subsections under with_polymorphic

Change-Id: I8bd49ac241df4b8645c8f78938d6f8122952d75a

8 years ago- fix broken link
Mike Bayer [Tue, 16 May 2017 13:59:38 +0000 (09:59 -0400)] 
- fix broken link

Change-Id: I2f3b5ae29600696b34a6afdddc2f94920febf31d

8 years agomodernize and repair inheritance examples
Mike Bayer [Tue, 16 May 2017 13:51:06 +0000 (09:51 -0400)] 
modernize and repair inheritance examples

remarkably, the examples for concrete and single were still
using classical mappings.    Ensure all three examples use
modern declarative patterns, each illustrate the identical set
of query operations.  Use back_populates, flat=True for joins,
etc. ensure flake8 linting, correct links and add a link back
from newly reworked inheritance documentation.

Change-Id: I8465a9badbb0eda804f457ccac599f051ee3c27c

8 years agoMerge "Demote innerjoin to outerjoin coming from with_polymorphic"
mike bayer [Fri, 12 May 2017 22:07:49 +0000 (18:07 -0400)] 
Merge "Demote innerjoin to outerjoin coming from with_polymorphic"

8 years agoDemote innerjoin to outerjoin coming from with_polymorphic
Mike Bayer [Fri, 12 May 2017 16:01:53 +0000 (12:01 -0400)] 
Demote innerjoin to outerjoin coming from with_polymorphic

a with_polymorphic, regardless of inheritance type, represents
multiple classes.  A subclass that wants to joinedload with innerjoin=True
needs to be demoted to an outerjoin because the parent entity rows
might not be of that type.   Looks more intuitive with a joined
inheritance load, but applies just as well to single or concrete.

Change-Id: I4d3d76106ae20032269f8848aad70a8e2f9422f9
Fixes: #3988
8 years agoCascade mappers in terms of the instance's mapper
Mike Bayer [Fri, 12 May 2017 14:53:54 +0000 (10:53 -0400)] 
Cascade mappers in terms of the instance's mapper

Fixed a (extremely old) bug in cascade_mappers where the
first cascade we do is against the "self" mapper, and not the
one that actually corresponds to the state given. These are
different in the case where we start with a relationship
to a class, and the instance is of a subclass, which itself
can have relationships that aren't on the base mapper.

A pretty severe bug that somehow has avoided the radar
since the beginning.

Change-Id: I512956b9757b07e06f3ca1ccb507a33fb10bed31
Fixes: #3986
8 years agoAdd links to with_only_columns to Select.column, append_column
Mike Bayer [Fri, 12 May 2017 13:23:44 +0000 (09:23 -0400)] 
Add links to with_only_columns to Select.column, append_column

Provide a brief example for these two methods
indicating that typically a table-bound (or other selectable)
column is appended here, then link to with_only_columns
documentation which has in-depth guidelines already including
that one should not append columns from the current select to itself.

Change-Id: I0742405a7f3c41450d337b9c633519d9cc101dfb
Fixes: #3987
8 years agoMerge "Update inheritance documentation."
mike bayer [Thu, 11 May 2017 00:26:30 +0000 (20:26 -0400)] 
Merge "Update inheritance documentation."

8 years agoUpdate inheritance documentation.
Mike Bayer [Mon, 1 May 2017 17:04:32 +0000 (13:04 -0400)] 
Update inheritance documentation.

The inheritance documentation is confused, disorganized, and out
of date.  Reorganize and clarify, in particular in preparation
for new inheritance features.

Change-Id: Ibe6a35b4b0432bad866a6afb0598b2cf1b509f10

8 years agoMerge "Add conditionals specific to deferred for expire ro properties"
mike bayer [Wed, 10 May 2017 18:21:33 +0000 (14:21 -0400)] 
Merge "Add conditionals specific to deferred for expire ro properties"

8 years agoAdd conditionals specific to deferred for expire ro properties
Mike Bayer [Wed, 10 May 2017 18:03:28 +0000 (14:03 -0400)] 
Add conditionals specific to deferred for expire ro properties

Fixed bug where a :func:`.column_property` that is also marked as
"deferred" would be marked as "expired" during a flush, causing it
to be loaded along with the unexpiry of regular attributes even
though this attribute was never accessed.

Change-Id: Iaa9e17b66ece30a8e729e4af746b31ff99b1ec9a
Fixes: #3984
8 years agoFix docs syntax error
Denis Kataev [Wed, 10 May 2017 12:33:16 +0000 (17:33 +0500)] 
Fix docs syntax error

8 years agoMerge "Use regexp to parse cx_oracle version string"
mike bayer [Tue, 9 May 2017 19:51:08 +0000 (15:51 -0400)] 
Merge "Use regexp to parse cx_oracle version string"

8 years agoUse regexp to parse cx_oracle version string
Mike Bayer [Tue, 9 May 2017 16:17:04 +0000 (12:17 -0400)] 
Use regexp to parse cx_oracle version string

Fixed bug in cx_Oracle dialect where version string parsing would
fail for cx_Oracle version 6.0b1 due to the "b" character.  Version
string parsing is now via a regexp rather than a simple split.

Change-Id: I2af7172b0d7184e3ea3bd051e9fa8d6ca2a571cd
Fixes: #3975
8 years agoSupport autocommit for GRANT and REVOKE on postgresql
Jacob Hayes [Mon, 8 May 2017 20:26:06 +0000 (16:26 -0400)] 
Support autocommit for GRANT and REVOKE on postgresql

Extends `AUTOCOMMIT_REGEXP` for the postgres dialect to include `GRANT` and `REVOKE`.

Change-Id: Iba15f1ebf5bd7bc0fc1193fdf561417e53bf5d57
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/357

8 years agoProtect against cls weakref becoming None
Mike Bayer [Mon, 8 May 2017 22:36:57 +0000 (18:36 -0400)] 
Protect against cls weakref becoming None

Protected against testing "None" as a class in the case where
declarative classes are being garbage collected and new
automap prepare() operations are taking place concurrently, very
infrequently hitting a weakref that has not been fully acted upon
after gc.

Change-Id: I32e1dfc5ac46bac4127fe808cfd18368e2fad9dd

8 years agoMerge branch 'master' of https://github.com/aflyhorse/sqlalchemy
Mike Bayer [Mon, 8 May 2017 21:55:28 +0000 (17:55 -0400)] 
Merge branch 'master' of https://github.com/aflyhorse/sqlalchemy

8 years ago- add 1.2 forwards-port version
Mike Bayer [Mon, 8 May 2017 21:54:15 +0000 (17:54 -0400)] 
- add 1.2 forwards-port version

Change-Id: I093f3939be8858a2f327c5ee5884b9629b216855

8 years agoMerge branch 'patch-1' of https://github.com/UnquietCode/sqlalchemy
Mike Bayer [Mon, 8 May 2017 20:21:20 +0000 (16:21 -0400)] 
Merge branch 'patch-1' of https://github.com/UnquietCode/sqlalchemy

8 years agoBreak the lines to fit pdf and fix another broken syntax
LunarShaddow [Mon, 8 May 2017 04:31:50 +0000 (12:31 +0800)] 
Break the lines to fit pdf and fix another broken syntax

8 years ago- big rewrite of the Sequence documentation:
Mike Bayer [Fri, 5 May 2017 18:59:39 +0000 (14:59 -0400)] 
- big rewrite of the Sequence documentation:

1. Sequence should be associated with MetaData always,
except in the really weird case someone is sharing a Sequence
among multiple metadatas.  Make this a "best practice", end the
confusion of #3951, #3979

2. "optional" is not a thing people use, trim this way down

3. remove confusing language

Change-Id: Iab5aec319da2582092fe2615ee50430f76441aff
(cherry picked from commit a1dcf23e371695d8d3be2e1d7875fad10f16a656)

8 years ago- add another note re: 339e2c13b0fc8e95a47d00c0f8fc5afc4b6dff9a
Mike Bayer [Fri, 5 May 2017 14:39:18 +0000 (10:39 -0400)] 
- add another note re: 339e2c13b0fc8e95a47d00c0f8fc5afc4b6dff9a
which clarifies that ForeignKey circumvents this logic as a
"convenience".   issue #3978 is updated to address trying to make
this consistent.

Change-Id: I089acaa89f11b7a6310c2bf32916e26eb62ab9c0

8 years ago- add a note to MetaData.schema indicating that the Table
Mike Bayer [Fri, 5 May 2017 13:19:18 +0000 (09:19 -0400)] 
- add a note to MetaData.schema indicating that the Table
will be cataloged in the .tables collection with its fully
qualified name.   Fixes #3978

Change-Id: I65fa063918efc22658e93c39a0680cb83553dec8

8 years agoremove ambiguous line breakers to help sphinx identify code block
LunarShaddow [Fri, 5 May 2017 06:38:41 +0000 (14:38 +0800)] 
remove ambiguous line breakers to help sphinx identify code block

8 years agofixes a typo
Ben Fagin [Mon, 1 May 2017 17:30:11 +0000 (10:30 -0700)] 
fixes a typo

8 years ago- typo
Mike Bayer [Fri, 28 Apr 2017 14:36:15 +0000 (10:36 -0400)] 
- typo

Change-Id: Iab741ce3739ed4172196f99c519c9333637383fd

8 years agoCall proxied collection before invoking creator in associationlist.append()
Mike Bayer [Thu, 27 Apr 2017 15:24:41 +0000 (11:24 -0400)] 
Call proxied collection before invoking creator in associationlist.append()

Improved the association proxy list collection so that premature
autoflush against a newly created association object can be prevented
in the case where ``list.append()`` is being used, and a lazy load
would be invoked when the association proxy accesses the endpoint
collection.  The endpoint collection is now accessed first before
the creator is invoked to produce the association object.

Change-Id: I008a6dbdfe5b1c0dfd02189c3d954d83a65f3fc5
Fixes: #3941
8 years ago- keep trying to identify the race here. can reproduce locally
Mike Bayer [Thu, 27 Apr 2017 21:44:29 +0000 (17:44 -0400)] 
- keep trying to identify the race here.  can reproduce locally
now and it seems like mock might not be doing the right thing.

Change-Id: I5c108d82631c9217da54a8ace68d7728c3e204d8

8 years agoEnforce boolean result type for all eq_, is_, isnot, comparison
Mike Bayer [Thu, 27 Apr 2017 14:26:10 +0000 (10:26 -0400)] 
Enforce boolean result type for all eq_, is_, isnot, comparison

Repaired issue where the type of an expression that used
:meth:`.ColumnOperators.is_` or similar would not be a "boolean" type,
instead the type would be "nulltype", as well as when using custom
comparison operators against an untyped expression.   This typing can
impact how the expression behaves in larger contexts as well as
in result-row-handling.

Change-Id: Ib810ff686de500d8db26ae35a51005fab29603b6
Fixes: #3873
8 years ago- try to work around a race that can occur in STP when
Mike Bayer [Thu, 27 Apr 2017 19:26:35 +0000 (15:26 -0400)] 
- try to work around a race that can occur in STP when
used in this intentionally broken scenario

Change-Id: I88ea6fa710da2189e6d47e2d12f5f0fd6f6bb7d4

8 years ago- ensure that sqlalchemy.ext is set up for importlater
Mike Bayer [Thu, 27 Apr 2017 18:33:54 +0000 (14:33 -0400)] 
- ensure that sqlalchemy.ext is set up for importlater

otherwise, it fails if you import from ext before orm:

    from sqlalchemy import *
    from sqlalchemy.ext.declarative import declarative_base
    from sqlalchemy.orm import *

and then do a lazyload, as the ext.baked importlater is not
initialized.

Change-Id: I24dcbfc9ca9022316da28507772562833e45dd95

8 years agoAdd selectin loading
Mike Bayer [Thu, 23 Mar 2017 21:55:43 +0000 (17:55 -0400)] 
Add selectin loading

Adding a new kind of relationship loader that is
a cross between the "immediateload" and the "subquery"
eager loader, using an IN criteria to load related items
in bulk immediately after the lead query result is loaded.

Change-Id: If13713fba9b465865aef8fd50b5b6b977fe3ef7d
Fixes: #3944
8 years agotest / document postgresql_ops against a labeled expression
Mike Bayer [Mon, 24 Apr 2017 20:19:08 +0000 (16:19 -0400)] 
test / document postgresql_ops against a labeled expression

Since postgresql_ops explicitly states that it expects
string keys, to apply to a function call or expression one
needs to give the SQL expression a label that can be referred
to by name in the dictionary.   test / document this.

Change-Id: I4bc4ade46dac27f9c1b92e7823433292beab97b9
Fixes: #3970
8 years ago- edits
Mike Bayer [Sat, 22 Apr 2017 20:43:31 +0000 (16:43 -0400)] 
- edits

Change-Id: If2445c4cbcd7eb18e06823e8821940a391890979