]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
7 years agoMerge "Track if we're rendering within the CTE recursively"
mike bayer [Fri, 16 Mar 2018 20:38:02 +0000 (16:38 -0400)] 
Merge "Track if we're rendering within the CTE recursively"

7 years agoTrack if we're rendering within the CTE recursively
Mike Bayer [Wed, 14 Mar 2018 15:04:43 +0000 (11:04 -0400)] 
Track if we're rendering within the CTE recursively

Fixed a regression that occurred from the previous fix to :ticket:`4204` in
version 1.2.5, where a CTE that refers to itself after the
:meth:`.CTE.alias` method has been called would not refer to iself
correctly.

Change-Id: Iaa63d65ad2b90c8693f9953fbb32dbb10c73a037
Fixes: #4204
7 years agoIgnore non-primary mappers within mutable instrumentation
Mike Bayer [Mon, 12 Mar 2018 16:50:52 +0000 (12:50 -0400)] 
Ignore non-primary mappers within mutable instrumentation

Fixed bug where using :meth:`.Mutable.associate_with` or
:meth:`.Mutable.as_mutable` in conjunction with a class that has non-
primary mappers set up with alternatively-named attributes would produce an
attribute error.  Since non-primary mappers are not used for persistence,
the mutable extension now excludes non-primary mappers from its
instrumentation steps.

Change-Id: I2630d9f771a171aece03181ccf9159885f68f25e
Fixes: #4215
7 years agoMerge "Raise cx_Oracle minimum version to 5.2"
mike bayer [Thu, 8 Mar 2018 17:36:38 +0000 (12:36 -0500)] 
Merge "Raise cx_Oracle minimum version to 5.2"

7 years agoMake it much more clear that concrete mapping is limited
Mike Bayer [Wed, 7 Mar 2018 23:05:07 +0000 (18:05 -0500)] 
Make it much more clear that concrete mapping is limited

Change-Id: Icb2ea787b0defbf5f1244b144759c1e8acff3f0f

7 years agoRaise cx_Oracle minimum version to 5.2
Mike Bayer [Wed, 7 Mar 2018 21:27:26 +0000 (16:27 -0500)] 
Raise cx_Oracle minimum version to 5.2

The minimum cx_Oracle version supported is 5.2 (June 2015).  Previously,
the dialect asserted against version 5.0 but as of 1.2.2 we are using some
symbols that did not appear until 5.2.

Change-Id: I6fa4238f1722789924f4a6473fdce6f524333825
Fixes: #4211
7 years agoAdd notes regarding flat=True
Mike Bayer [Wed, 7 Mar 2018 21:03:07 +0000 (16:03 -0500)] 
Add notes regarding flat=True

Start documenting that flat=True and aliased=True don't work
with selectable particularly when selectable is an aliased select
already.  References #4212

Change-Id: I6e576165f06387350ae97e43ad979e575a4912b9
(cherry picked from commit 39d7dfa08accf6cce6d53b0807603bf43d580791)

7 years agocherry-pick changelog update for 1.1.19
Mike Bayer [Tue, 6 Mar 2018 19:10:39 +0000 (14:10 -0500)] 
cherry-pick changelog update for 1.1.19

7 years agocherry-pick changelog from 1.1.18
Mike Bayer [Tue, 6 Mar 2018 19:10:39 +0000 (14:10 -0500)] 
cherry-pick changelog from 1.1.18

7 years agocherry-pick changelog update for 1.2.6
Mike Bayer [Tue, 6 Mar 2018 18:58:22 +0000 (13:58 -0500)] 
cherry-pick changelog update for 1.2.6

7 years agocherry-pick changelog from 1.2.5
Mike Bayer [Tue, 6 Mar 2018 18:58:22 +0000 (13:58 -0500)] 
cherry-pick changelog from 1.2.5

7 years ago- add missing versions for #4208
Mike Bayer [Tue, 6 Mar 2018 18:18:30 +0000 (13:18 -0500)] 
- add missing versions for #4208

Change-Id: I307b4b81e472cb6473d201fece26753878dd38f1

7 years agoMerge "Add Query.enable_single_entity()"
mike bayer [Tue, 6 Mar 2018 17:50:04 +0000 (12:50 -0500)] 
Merge "Add Query.enable_single_entity()"

7 years agoMerge "Clone _cte_alias instead of assigning "self""
mike bayer [Tue, 6 Mar 2018 17:49:22 +0000 (12:49 -0500)] 
Merge "Clone _cte_alias instead of assigning "self""

7 years agoAdd Query.enable_single_entity()
Eric Atkin [Wed, 28 Feb 2018 21:00:38 +0000 (16:00 -0500)] 
Add Query.enable_single_entity()

Added new feature :meth:`.Query.only_return_tuples`.  Causes the
:class:`.Query` object to return keyed tuple objects unconditionally even
if the query is against a single entity.   Pull request courtesy Eric
Atkin.

Change-Id: Ib0b7f5f78431aa68082e5b200ed577daa4222336
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/425

7 years agoClone _cte_alias instead of assigning "self"
Mike Bayer [Tue, 6 Mar 2018 02:36:18 +0000 (21:36 -0500)] 
Clone _cte_alias instead of assigning "self"

Fixed bug in :class:.`CTE` construct along the same lines as that of
:ticket:`4204` where a :class:`.CTE` that was aliased would not copy itself
correctly during a "clone" operation as is frequent within the ORM as well
as when using the :meth:`.ClauseElement.params` method.

Change-Id: Id68d72dd244dedfc7bd6116c9a5123c51a55ea20
Fixes: #4210
7 years agoDon't include AliasedClass when pickling options
Mike Bayer [Mon, 5 Mar 2018 19:48:00 +0000 (14:48 -0500)] 
Don't include AliasedClass when pickling options

Fixed 1.2 regression where a mapper option that contains an
:class:`.AliasedClass` object, as is typical when using the
:meth:`.QueryableAttribute.of_type` method, could not be pickled.   1.1's
behavior was to omit the aliased class objects from the path, so this
behavior is restored.

Change-Id: I4b36a422b7c0e6a6da7ee3ba3ab282c13917a31f
Fixes: #4209
7 years agoMerge "Only replace first occurrence for COLLATE/ARRAY syntax"
mike bayer [Mon, 5 Mar 2018 23:03:53 +0000 (18:03 -0500)] 
Merge "Only replace first occurrence for COLLATE/ARRAY syntax"

7 years agofix version type in doc
Asif Saifuddin Auvi [Mon, 5 Mar 2018 18:08:47 +0000 (00:08 +0600)] 
fix version type in doc

7 years agoOnly replace first occurrence for COLLATE/ARRAY syntax
Mike Bayer [Mon, 5 Mar 2018 16:33:30 +0000 (11:33 -0500)] 
Only replace first occurrence for COLLATE/ARRAY syntax

Fixed bug in Postgresql COLLATE / ARRAY adjustment first introduced
in :ticket:`4006` where new behaviors in Python 3.7 regular expressions
caused the fix to fail.

Change-Id: Ied3893d7cac210befa0277b55b3b895b0ba1f0d2
Fixes: #4208
7 years agoAdd python 3.7 environment
Mike Bayer [Mon, 5 Mar 2018 14:43:26 +0000 (09:43 -0500)] 
Add python 3.7 environment

Change-Id: I4ed7bd6ffd1c8c9b5169cf21709ec19801580126

7 years agoGet MySQL version info from @@version
Mike Bayer [Fri, 2 Mar 2018 20:08:08 +0000 (15:08 -0500)] 
Get MySQL version info from @@version

MySQL dialects now query the server version using ``SELECT @@version``
explicitly to the server to ensure we are getting the correct version
information back.   Proxy servers like MaxScale interfere with the value
that is passed to the DBAPI's connection.server_version value so this
is no longer reliable.

Change-Id: Iafd39be8c9bf1982d58b34cc997ae1016ad6c48c
Fixes: #4205
(cherry picked from commit 9ba77e8d3b682bff89fdab5e80271a96a52fe8c8)
(cherry picked from commit 5c1ebbc3706c810f936d9e252ee5d16800e561ea)

7 years agoSetup master as 1.3
Mike Bayer [Fri, 2 Mar 2018 19:41:03 +0000 (14:41 -0500)] 
Setup master as 1.3

Change-Id: I1e8240d19f891cb6575f10d93524b551d74864ea

7 years ago- add some seealsos for the transient object that loads use case
Mike Bayer [Fri, 2 Mar 2018 16:58:52 +0000 (11:58 -0500)] 
- add some seealsos for the transient object that loads use case

Change-Id: Ibfa79a3721f31806223906cccf4547673b3d42f1
(cherry picked from commit 5de2e17b6e6686adf0a87038e90b001978187c0a)

7 years agoFix enable_relationship_loading() works fine w/ one-to-many
Mike Bayer [Fri, 2 Mar 2018 15:45:42 +0000 (10:45 -0500)] 
Fix enable_relationship_loading() works fine w/ one-to-many

Change-Id: I6efb62afa02be4d42482cfdbec739a5c6ab32bd7

7 years agoMerge "Check existing CTE for an alias name when rendering FROM clause"
mike bayer [Thu, 1 Mar 2018 17:38:45 +0000 (12:38 -0500)] 
Merge "Check existing CTE for an alias name when rendering FROM clause"

7 years agoCheck existing CTE for an alias name when rendering FROM clause
Mike Bayer [Thu, 1 Mar 2018 15:45:39 +0000 (10:45 -0500)] 
Check existing CTE for an alias name when rendering FROM clause

Fixed bug in CTE rendering where a :class:`.CTE` that was also turned into
an :class:`.Alias` would not render its "ctename AS aliasname" clause
appropriately if there were more than one reference to the CTE in a FROM
clause.

Change-Id: If8cff27a2f4faa5eceb59aa86398db6edb3b9e72
Fixes: #4204
7 years agoMerge "Merge existing query params in baked lazy load"
mike bayer [Wed, 28 Feb 2018 15:53:53 +0000 (10:53 -0500)] 
Merge "Merge existing query params in baked lazy load"

7 years agoMerge existing query params in baked lazy load
Mike Bayer [Mon, 26 Feb 2018 00:54:37 +0000 (19:54 -0500)] 
Merge existing query params in baked lazy load

Fixed a long-standing regression that occurred in version
1.0, which prevented the use of a custom :class:`.MapperOption`
that alters the _params of a :class:`.Query` object for a
lazy load, since the lazy loader itself would overwrite those
parameters.   This applies to the "temporal range" example
on the wiki.  Note however that the
:meth:`.Query.populate_existing` method is now required in
order to rewrite the mapper options associated with an object
already loaded in the identity map.  Also, a custom defined
:class:`.MapperOption` will now cause lazy loaders related to
the target object to use a non-baked query by default unless
the :meth:`.MapperOption._generate_cache_key` method is implemented.

Fixed bug where the new :meth:`.baked.Result.with_post_criteria`
method would not interact with a subquery-eager loader correctly,
in that the "post criteria" would not be applied to embedded
subquery eager loaders.   This is related to :ticket:`4128` in that
the post criteria feature is now used by the lazy loader.

Change-Id: I899808734458e25a023142c2c5bb37cbed869479
Fixes: #4128
7 years agoMerge remote-tracking branch 'origin/pr/421'
Mike Bayer [Tue, 27 Feb 2018 19:46:30 +0000 (14:46 -0500)] 
Merge remote-tracking branch 'origin/pr/421'

7 years agoMerge "Ensure we have states to load when doing poly post load"
mike bayer [Fri, 23 Feb 2018 20:14:46 +0000 (15:14 -0500)] 
Merge "Ensure we have states to load when doing poly post load"

7 years agoMerge "Allow bind processors to work with expanding IN"
mike bayer [Fri, 23 Feb 2018 19:21:44 +0000 (14:21 -0500)] 
Merge "Allow bind processors to work with expanding IN"

7 years agoEnsure we have states to load when doing poly post load
Mike Bayer [Fri, 23 Feb 2018 18:55:17 +0000 (13:55 -0500)] 
Ensure we have states to load when doing poly post load

Fixed bug in new "polymorphic selectin" loading when a selection of
polymorphic objects were to be partially loaded from a relationship
lazy loader, leading to an "empty IN" condition within the load that
raises an error for the "inline" form of "IN".

Change-Id: I721cf5fdf0b9fd2289067d5d2c6bc87fb2436f07
Fixes: #4199
7 years agoAllow bind processors to work with expanding IN
Mike Bayer [Fri, 23 Feb 2018 00:47:24 +0000 (19:47 -0500)] 
Allow bind processors to work with expanding IN

Fixed bug in new "expanding IN parameter" feature where the bind parameter
processors for values wasn't working at all, tests failed to cover this
pretty basic case which includes that ENUM values weren't working.

Change-Id: I8e2420d7229a3e253e43b5227ebb98f9fe0bd14a
Fixes: #4198
7 years agocherry-pick changelog update for 1.1.18
Mike Bayer [Thu, 22 Feb 2018 21:16:11 +0000 (16:16 -0500)] 
cherry-pick changelog update for 1.1.18

7 years agocherry-pick changelog from 1.1.17
Mike Bayer [Thu, 22 Feb 2018 21:16:11 +0000 (16:16 -0500)] 
cherry-pick changelog from 1.1.17

7 years agoVersion 1.2.5 placeholder
Mike Bayer [Thu, 22 Feb 2018 21:05:34 +0000 (16:05 -0500)] 
Version 1.2.5 placeholder

7 years ago- 1.2.4 rel_1_2_4
Mike Bayer [Thu, 22 Feb 2018 20:57:22 +0000 (15:57 -0500)] 
- 1.2.4

7 years agoQuote cte alias if needed
Eric Atkin [Thu, 22 Feb 2018 19:16:14 +0000 (14:16 -0500)] 
Quote cte alias if needed

Fixed bug where CTE expressions would not have their name or alias name
quoted when the given name is case sensitive or otherwise requires quoting.
Pull request courtesy Eric Atkin.

Fixes: #4197
Change-Id: Ib8573e82b9a1ca94b50c7c5d73ee98b79465d689
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/426

7 years agoMerge "Ensure mapping has no version_id_generator when checking missing version_id"
mike bayer [Thu, 22 Feb 2018 18:41:14 +0000 (13:41 -0500)] 
Merge "Ensure mapping has no version_id_generator when checking missing version_id"

7 years agoEnsure mapping has no version_id_generator when checking missing version_id
Mike Bayer [Wed, 21 Feb 2018 16:16:09 +0000 (11:16 -0500)] 
Ensure mapping has no version_id_generator when checking missing version_id

Fixed 1.2 regression in ORM versioning feature where a mapping against a
:func:`.select` or :func:`.alias` that also used a versioning column
against the underlying table would fail due to the check added as part of
:ticket:`3673`.

See also #4194 and #4195 for related issues found regarding
mapped selects and versioning.

Change-Id: Ifabe9a5c8c1bfa72db5029faa7a5dbf71f0a7ca0
Fixes: #4193
7 years agoMerge "Default to using current mapped class as owner if none found"
mike bayer [Tue, 20 Feb 2018 22:52:11 +0000 (17:52 -0500)] 
Merge "Default to using current mapped class as owner if none found"

7 years agoDefault to using current mapped class as owner if none found
Mike Bayer [Tue, 20 Feb 2018 17:15:57 +0000 (12:15 -0500)] 
Default to using current mapped class as owner if none found

Repaired regression caused in 1.2.3 and 1.1.16 regarding association proxy
objects, revising the approach to :ticket:`4185` when calculating the
"owning class" of an association proxy to default to choosing the current
class if the proxy object is not directly associated with a mapped class,
such as a mixin.

Change-Id: I87d0ac09f695dc285bd4bbe0a547f1d5ce23e068
Fixes: #4185
7 years agoMerge "Implement remove() for _empty_collection"
mike bayer [Mon, 19 Feb 2018 23:19:01 +0000 (18:19 -0500)] 
Merge "Implement remove() for _empty_collection"

7 years agoRewrite the "deleting from collections" section
Mike Bayer [Mon, 19 Feb 2018 23:13:24 +0000 (18:13 -0500)] 
Rewrite the "deleting from collections" section

This section documents an aspect of the ORM that is
more generalized than just collections as well as more general
than just using session.delete(), even though session.delete()
with collections is the most common use case.   Try to expand
out the scope here to explain the situation from the perspective
of any kind of relationship, include example with delete cascade
with many-to-one as well.

Change-Id: Ifacb91f90951d1b0da6dbadc2d72273d79b756e2
Fixes: #4191
7 years agoImplement remove() for _empty_collection
Mike Bayer [Mon, 19 Feb 2018 21:59:42 +0000 (16:59 -0500)] 
Implement remove() for _empty_collection

Fixed regression caused in 1.2.3 due to fix from :ticket:`4181` where
the changes to the event system involving :class:`.Engine` and
:class:`.OptionEngine` did not accommodate for event removals, which
would raise an ``AttributeError`` when invoked at the class
level.

Change-Id: I1c9083829d74dd710716d28b0eaca4fa15e86313
Fixes: #4190
7 years agoVersion 1.2.4 placeholder
Mike Bayer [Fri, 16 Feb 2018 23:22:07 +0000 (18:22 -0500)] 
Version 1.2.4 placeholder

7 years ago- 1.2.3 rel_1_2_3
Mike Bayer [Fri, 16 Feb 2018 23:15:47 +0000 (18:15 -0500)] 
- 1.2.3

7 years agoRemove erroneous skip message
Mike Bayer [Fri, 16 Feb 2018 23:13:30 +0000 (18:13 -0500)] 
Remove erroneous skip message

The logic here seems to try to say something different when
__backend__ is True but it produces a nonsensical message,
since __only_on__ doesn't tell us about the implementation
we are actually running.

Change-Id: I14e20cadcba975f8efe8fdefa439c8b8c480b3ed

7 years ago- add missing forwards ports for bug fixes
Mike Bayer [Fri, 16 Feb 2018 22:52:23 +0000 (17:52 -0500)] 
- add missing forwards ports for bug fixes

Change-Id: If94964cb0294f7f082759ecce71771c35ea4a2bd

7 years agocherry-pick changelog update for 1.1.17
Mike Bayer [Fri, 16 Feb 2018 22:36:46 +0000 (17:36 -0500)] 
cherry-pick changelog update for 1.1.17

7 years agocherry-pick changelog from 1.1.16
Mike Bayer [Fri, 16 Feb 2018 22:36:45 +0000 (17:36 -0500)] 
cherry-pick changelog from 1.1.16

7 years agofix formatting
Mike Bayer [Fri, 16 Feb 2018 21:54:43 +0000 (16:54 -0500)] 
fix formatting

Change-Id: Ie4687c970508cf8bf183e342db6b89a8aca9d6f9
(cherry picked from commit 055821630bb43d6dccce36f814c55ba306eb9363)

7 years agoMerge "Test attributes for being non-mapped column properties more closely"
mike bayer [Fri, 16 Feb 2018 14:39:26 +0000 (09:39 -0500)] 
Merge "Test attributes for being non-mapped column properties more closely"

7 years agoTest attributes for being non-mapped column properties more closely
Mike Bayer [Thu, 15 Feb 2018 22:42:48 +0000 (17:42 -0500)] 
Test attributes for being non-mapped column properties more closely

Fixed bug in concrete inheritance mapping where user-defined
attributes such as hybrid properties that mirror the names
of mapped attributes from sibling classes would be overwritten by
the mapper as non-accessible at the instance level.  Also
ensured that user-bound descriptors are not implicitly invoked at the class
level during the mapper configuration stage.

Change-Id: I52b84a15c296b14efeaffb72941fc941d1d52c0d
Fixes: #4188
7 years agoAdd ssl "operation timed out" message for psycopg2
André Cruz [Thu, 15 Feb 2018 16:09:47 +0000 (11:09 -0500)] 
Add ssl "operation timed out" message for psycopg2

Added "SSL SYSCALL error: Operation timed out" to the list
of messages that trigger a "disconnect" scenario for the
psycopg2 driver.  Pull request courtesy André Cruz.

Change-Id: Ie1a8fc97e74b6906ccacf53dad70fed973c42b7f
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/3

7 years agoMerge remote-tracking branch 'origin/pr/416'
Mike Bayer [Wed, 14 Feb 2018 16:03:37 +0000 (11:03 -0500)] 
Merge remote-tracking branch 'origin/pr/416'

7 years agoFix typo in python example
Anton Vlasenko [Wed, 14 Feb 2018 10:31:36 +0000 (11:31 +0100)] 
Fix typo in python example

7 years agoAllow multiple plugin names
Mike Bayer [Tue, 13 Feb 2018 20:11:53 +0000 (15:11 -0500)] 
Allow multiple plugin names

The :class:`.URL` object now allows query keys to be specified multiple
times where their values will be joined into a list.  This is to support
the plugins feature documented at :class:`.CreateEnginePlugin` which
documents that "plugin" can be passed multiple times. Additionally, the
plugin names can be passed to :func:`.create_engine` outside of the URL
using the new :paramref:`.create_engine.plugins` parameter.

Change-Id: Ifc48ad120bd6c6204eda567492caf79832aeeaa5
Fixes: #4170
7 years agoMerge "Add dependency for parent_pre post updates to parent deletes"
mike bayer [Tue, 13 Feb 2018 03:22:44 +0000 (22:22 -0500)] 
Merge "Add dependency for parent_pre post updates to parent deletes"

7 years agoAdd dependency for parent_pre post updates to parent deletes
Mike Bayer [Mon, 12 Feb 2018 21:45:39 +0000 (16:45 -0500)] 
Add dependency for parent_pre post updates to parent deletes

Fixed issue in post_update feature where an UPDATE is emitted
when the parent object has been deleted but the dependent object
is not.   This issue has existed for a long time however
since 1.2 now asserts rows matched for post_update, this
was raising an error.

Change-Id: I31b1d22408e358962577435f0c4cb9a456ba0872
Fixes: #4187
7 years agoSearch through mapper superclass hierarchy for owner
Mike Bayer [Fri, 9 Feb 2018 21:12:31 +0000 (16:12 -0500)] 
Search through mapper superclass hierarchy for owner

Fixed regression caused by fix for issue :ticket:`4116` affecting versions
1.2.2 as well as 1.1.15, which had the effect of mis-calculation of the
"owning class" of an :class:`.AssociationProxy` as the ``NoneType`` class
in some declarative mixin/inheritance situations as well as if the
association proxy were accessed off of an un-mapped class.  The "figure out
the owner" logic has been replaced by an in-depth routine that searches
through the complete mapper hierarchy assigned to the class or subclass to
determine the correct (we hope) match; will not assign the owner if no
match is found.  An exception is now raised if the proxy is used
against an un-mapped instance.

Change-Id: I611b590df2babe077ce6c19bea89e84251d1a7f4
Fixes: #4185
7 years agoMerge "Add initiator argument to set_attribute"
mike bayer [Fri, 9 Feb 2018 13:41:33 +0000 (08:41 -0500)] 
Merge "Add initiator argument to set_attribute"

7 years agoAdd initiator argument to set_attribute
Mike Bayer [Thu, 8 Feb 2018 14:16:39 +0000 (09:16 -0500)] 
Add initiator argument to set_attribute

Added new argument :paramref:`.attributes.set_attribute.inititator`
to the :func:`.attributes.set_attribute` function, allowing an
event token received from a listener function to be propagated
to subsequent set events.

Change-Id: I6ede21e42153026ab46a1d2ec33aa3f999db98e2

7 years agoEnsure weakref finalize_fairy operates upon the current connection
Mike Bayer [Thu, 8 Feb 2018 19:52:29 +0000 (14:52 -0500)] 
Ensure weakref finalize_fairy operates upon the current connection

Fixed a fairly serious connection pool bug where a connection that is
acquired after being refreshed as a result of a user-defined
:class:`.DisconnectionError` or due to the 1.2-released "pre_ping" feature
would not be correctly reset if the connection were returned to the pool by
weakref cleanup (e.g. the front-facing object is garbage collected); the
weakref would still refer to the previously invalidated DBAPI connection
which would have the reset operation erroneously called upon it instead.
This would lead to stack traces in the logs and a connection being checked
into the pool without being reset, which can cause locking issues.

Change-Id: Iabd9f3a63a1d0207d0de0054a6ced3560818cf9c
Fixes: #4184
7 years ago- re-disable oracle tests here as we are getting lots
Mike Bayer [Thu, 8 Feb 2018 22:39:19 +0000 (17:39 -0500)] 
- re-disable oracle tests here as we are getting lots
of oracle timeouts on CI now

Change-Id: I021d304d6aaf6bfa223dd0e5bb6b0c20e9c8657f

7 years ago- fix formatting
Mike Bayer [Thu, 8 Feb 2018 21:46:56 +0000 (16:46 -0500)] 
- fix formatting

Change-Id: Ic919048462520de8de84174a5e366d6c85316e87

7 years agoAdd values_callable feature to Enum
Jon Snyder [Wed, 17 Jan 2018 21:37:59 +0000 (16:37 -0500)] 
Add values_callable feature to Enum

Added support for :class:`.Enum` to persist the values of the enumeration,
rather than the keys, when using a Python pep-435 style enumerated object.
The user supplies a callable function that will return the string values to
be persisted.  This allows enumerations against non-string values to be
value-persistable as well.  Pull request courtesy Jon Snyder.

Pull-request: https://github.com/zzzeek/sqlalchemy/pull/410
Fixes: #3906
Change-Id: Id385465d215d1e5baaad68368b168afdd846b82c

7 years agoMerge "Add flag for class-level disallow of events, apply to OptionEngine"
mike bayer [Thu, 8 Feb 2018 01:58:47 +0000 (20:58 -0500)] 
Merge "Add flag for class-level disallow of events, apply to OptionEngine"

7 years agoAdd flag for class-level disallow of events, apply to OptionEngine
Mike Bayer [Tue, 6 Feb 2018 23:13:27 +0000 (18:13 -0500)] 
Add flag for class-level disallow of events, apply to OptionEngine

Fixed bug where events associated with an :class:`Engine`
at the class level would be doubled when the
:meth:`.Engine.execution_options` method were used.  To
achieve this, the semi-private class :class:`.OptionEngine`
no longer accepts events directly at the class level
and will raise an error; the class only propagates class-level
events from its parent :class:`.Engine`.   Instance-level
events continue to work as before.

The comments present another way of doing this where we would
copy events from the parent engine at option time rather
than linking the event listeners, but this would be a behavioral
change that adding new events to the parent engine would not
take effect for an already-created OptionEngine.

Change-Id: Id128516f54103fbad9a2210d6571eceb59c8b0cb
Fixes: #4181
7 years agoMerge "Check cx_Oracle error code on all exception classes"
mike bayer [Thu, 8 Feb 2018 01:54:10 +0000 (20:54 -0500)] 
Merge "Check cx_Oracle error code on all exception classes"

7 years agoCheck cx_Oracle error code on all exception classes
Mike Bayer [Tue, 6 Feb 2018 20:47:43 +0000 (15:47 -0500)] 
Check cx_Oracle error code on all exception classes

Fixed bug in cx_Oracle disconnect detection, used by pre_ping and other
features, where an error could be raised as DatabaseError which includes a
numeric error code; previously we weren't checking in this case for a
disconnect code.

Change-Id: I359bb5ede25a4726ea632b81af83c6391f405ae1
Fixes: #4182
7 years agoMerge "Support foreign key option reflection for Oracle"
mike bayer [Tue, 6 Feb 2018 20:53:59 +0000 (15:53 -0500)] 
Merge "Support foreign key option reflection for Oracle"

7 years agoMerge "fix handling of native enum aliases in sqlalchemy enum columns"
mike bayer [Tue, 6 Feb 2018 20:51:03 +0000 (15:51 -0500)] 
Merge "fix handling of native enum aliases in sqlalchemy enum columns"

7 years agoSupport foreign key option reflection for Oracle
Miroslav Shubernetskiy [Mon, 5 Feb 2018 14:07:30 +0000 (09:07 -0500)] 
Support foreign key option reflection for Oracle

The ON DELETE options for foreign keys are now part of
Oracle reflection.  Oracle does not support ON UPDATE
cascades.  Pull request courtesy Miroslav Shubernetskiy.

Change-Id: I135cd6cd3436354a86b2c1e1437c3785c38eed26
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/418

7 years agofix handling of native enum aliases in sqlalchemy enum columns
Daniel Knell [Mon, 5 Feb 2018 14:25:47 +0000 (09:25 -0500)] 
fix handling of native enum aliases in sqlalchemy enum columns

Fixed bug where the :class:`.Enum` type wouldn't handle
enum "aliases" correctly, when more than one key refers to the
same value.  Pull request courtesy Daniel Knell.

Fixes: #4180
Change-Id: Ia716c00ca6c67aeab56965f0fdd575ecb7c71416
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/420

7 years agoConvert dialect modules to relative imports and test
Mike Bayer [Mon, 5 Feb 2018 14:03:08 +0000 (09:03 -0500)] 
Convert dialect modules to relative imports and test

For some reason the dialects were not consistently
converted to relative imports.  Also added a test to
ensure that __all__ is functioning within each dialect.

Change-Id: I8450ed724473be7e17678e9aba7ba0f661fdf134

7 years ago- ensure it's clear that all DDLEvents can be associated
Mike Bayer [Fri, 2 Feb 2018 20:46:30 +0000 (15:46 -0500)] 
- ensure it's clear that all DDLEvents can be associated
using propagate=True, which is consulted within the scope
of Table.tometadata().  Fixes: #4179

Change-Id: I0cb0d8f6a894bb645cfc94b3d9083339039c9193

7 years agoLook for __sa_reconstructor__ on original_init
Mike Bayer [Fri, 2 Feb 2018 14:36:25 +0000 (09:36 -0500)] 
Look for __sa_reconstructor__ on original_init

Fixed bug where the :func:`.orm.reconstructor` event
helper would not be recognized if it were applied to the
``__init__()`` method of the mapped class.

It's not clear when this bug appeared, but was likely
during a refactoring of instrumentation mechanics somewhere
between 0.8 and 1.0.

Change-Id: Iaeb3baffef9e1b40a336d44294e68479f5d65fd3
Fixes: #4178
7 years ago- don't scare off developers with the word "advanced" here
Mike Bayer [Wed, 31 Jan 2018 14:27:03 +0000 (09:27 -0500)] 
- don't scare off developers with the word "advanced" here

Change-Id: I72a0295634e228bacf6c92088e650183f91e4585

7 years agoMerge "Disable set eq test for python < 2.7.8"
mike bayer [Tue, 30 Jan 2018 22:29:55 +0000 (17:29 -0500)] 
Merge "Disable set eq test for python < 2.7.8"

7 years agoDisable set eq test for python < 2.7.8
Mike Bayer [Tue, 30 Jan 2018 20:51:30 +0000 (15:51 -0500)] 
Disable set eq test for python < 2.7.8

A test added in 1.2 thought to confirm a Python 2.7 behavior turns out to
be confirming the behavior only as of Python 2.7.8. Python bug #8743 still
impacts set comparison in Python 2.7.7 and earlier, so the test in question
involving AssociationSet no longer runs for these older Python 2.7
versions.

Change-Id: I4e5ab650fdcbfd215535c58438878e98ef924a9b
Fixes: #3265
7 years agoEnsure _BundleEntity provides .mapper
Mike Bayer [Mon, 29 Jan 2018 23:07:19 +0000 (18:07 -0500)] 
Ensure _BundleEntity provides .mapper

Fixed bug where the :class:`.Bundle` object did not
correctly report upon the primary :class:`.Mapper` object
represened by the bundle, if any.   An immediate
side effect of this issue was that the new selectinload
loader strategy wouldn't work with the horizontal sharding
extension.

Change-Id: I54a626100b2f4da497597e8944fa8dd853de47a3
Fixes: #4175
7 years agoRaise the sqlite3 import error, not the pysqlite2 one
robin [Sat, 27 Jan 2018 18:02:30 +0000 (13:02 -0500)] 
Raise the sqlite3 import error, not the pysqlite2 one

Fixed the import error raised when a platform
has neither pysqlite2 nor sqlite3 installed, such
that the sqlite3-related import error is raised,
not the pysqlite2 one which is not the actual
failure mode.  Pull request courtesy Robin.

Origin version only print `No module named pysqlite2` even
it's actually the import error of line 337: `from
sqlite3 import dbapi2 as sqlite` which point user
to the wrong debug direction.

It should raise `e.message` as `No module named _sqlite3`.

Change-Id: Idc39cd0d226957fd670859df23a2386dea6eb3cc
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/417

7 years agoAdd a new FAQ section explaining how to ensure parenthesis
Mike Bayer [Thu, 25 Jan 2018 21:11:29 +0000 (16:11 -0500)] 
Add a new FAQ section explaining how to ensure parenthesis
with op().

Not sure if this can be further improved at some point, such
as if a BinaryExpression automatically applied self_group()
when op() is called, however for the moment op() behaves consistently
as with all other operators without any ad-hoc effects.

Change-Id: Ia7f1ab43990450bd96757848b77a35e8fedeab63
References: #4174

7 years agoFurther refine map_column verbiage
Mike Bayer [Thu, 25 Jan 2018 14:17:41 +0000 (09:17 -0500)] 
Further refine map_column verbiage

The verbiage here continues to be misleading as it implies that
a MapperProperty already exists for the Column when this is not
the case.

Change-Id: Iaa6990dc9693d47d50b15c4815c3c7f6f34d8577

7 years agoVersion 1.2.3 placeholder
Mike Bayer [Thu, 25 Jan 2018 02:30:47 +0000 (21:30 -0500)] 
Version 1.2.3 placeholder

Change-Id: Ic957e27114d3c22b7413255c188cea0b2ebc35a6

7 years ago- 1.2.2 rel_1_2_2
Mike Bayer [Thu, 25 Jan 2018 02:24:36 +0000 (21:24 -0500)] 
- 1.2.2

7 years agoEnsure backrefs accommodate for op_bulk_replace
Mike Bayer [Wed, 24 Jan 2018 16:09:47 +0000 (11:09 -0500)] 
Ensure backrefs accommodate for op_bulk_replace

Fixed 1.2 regression regarding new bulk_replace event
where a backref would fail to remove an object from the
previous owner when a bulk-assignment assigned the
object to a new owner.

As this revisits the Event tokens associated with
AttributeImpl objects, remove the verbosity of the
"inline lazy init" pattern; the Event token is a simple
slotted object and should have minimal memory overhead.

Change-Id: Id188b4026fc2f3500186548008f4db8cdf7afecc
Fixes: #4171
7 years agoMerge "Adjust tests for pyodbc 4.0.22"
mike bayer [Wed, 24 Jan 2018 23:57:12 +0000 (18:57 -0500)] 
Merge "Adjust tests for pyodbc 4.0.22"

7 years agoAdjust tests for pyodbc 4.0.22
Mike Bayer [Wed, 24 Jan 2018 22:27:10 +0000 (17:27 -0500)] 
Adjust tests for pyodbc 4.0.22

pyodbc 4.0.22 is no longer allowing a datetime to be truncated
into a date, and additionally is asserting that numeric truncation
is not occurring; previously, it looks like we could send a
decimal of -1E-25 through the driver but we were only getting
back -1E-20, the test failed to check this.  Not clear if the
larger precision worked fully at some point, but in any case,
it doesn't work now so just remove those values from the test.

Change-Id: I66c7863b1708eb72f48173083b4ef78c93893b52

7 years agoRework synonym, synonym_for documentation
Mike Bayer [Wed, 24 Jan 2018 23:03:04 +0000 (18:03 -0500)] 
Rework synonym, synonym_for documentation

The map_column example was incorrect, and overall the purpose
of this parameter as well as that of synonym_for was not explained;
examples added along with more encouragement to use hybrids.

Change-Id: I20bd286f541f798daa81fa598c0f31db1f5aa6ed

7 years agoMerge "Add a few more MySQL 8.0 reserved words"
mike bayer [Fri, 19 Jan 2018 17:05:44 +0000 (12:05 -0500)] 
Merge "Add a few more MySQL 8.0 reserved words"

7 years agoAdd a few more MySQL 8.0 reserved words
Riccardo Magliocchetti [Wed, 17 Jan 2018 22:30:36 +0000 (17:30 -0500)] 
Add a few more MySQL 8.0 reserved words

Reference: https://dev.mysql.com/doc/refman/8.0/en/keywords.html

Change-Id: I3f2f1827b659559cbee0f2b8aa3573ddfd551289
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/414

7 years agoMerge "Normalize check constraints even more radically"
mike bayer [Wed, 17 Jan 2018 23:09:00 +0000 (18:09 -0500)] 
Merge "Normalize check constraints even more radically"

7 years agoNormalize check constraints even more radically
Florian Apolloner [Wed, 17 Jan 2018 21:38:50 +0000 (16:38 -0500)] 
Normalize check constraints even more radically

This is the only way I could get this test pass on informix, basically I strip every whitespace.
The sql text as recorded in informix is:
```
((a > 1 ) AND (a < 5 ) )
((a = 1 ) OR ((a > 2 ) AND (a <5 ) ) )
```
Yes, this is absolutely bonkers, but that is what I get :(

Change-Id: I936e860f2b75b521e5560c05c452dbe72f0d3812
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/413

7 years agoMerge "Use NCHAR + setinputsizes() for all NVARCHAR2"
mike bayer [Wed, 17 Jan 2018 21:36:36 +0000 (16:36 -0500)] 
Merge "Use NCHAR + setinputsizes() for all NVARCHAR2"

7 years agoUse NCHAR + setinputsizes() for all NVARCHAR2
Mike Bayer [Tue, 16 Jan 2018 17:41:29 +0000 (12:41 -0500)] 
Use NCHAR + setinputsizes() for all NVARCHAR2

The cx_Oracle dialect now calls setinputsizes() with cx_Oracle.NCHAR
unconditionally when the NVARCHAR2 datatype, in SQLAlchemy corresponding
to sqltypes.Unicode(), is in use.  Per cx_Oracle's author this allows
the correct conversions to occur within the Oracle client regardless
of the setting for NLS_NCHAR_CHARACTERSET.

Change-Id: I3989b7aaf2178c263015a7433939196b76baf1e4
Fixes: #4163
7 years agoFixed link to Flask-SQLAlchemy in documentation
Tim Shaffer [Wed, 17 Jan 2018 12:04:16 +0000 (07:04 -0500)] 
Fixed link to Flask-SQLAlchemy in documentation

7 years agoAdd 10054 to ODBC / SQL Server disconnect codes
Mike Bayer [Tue, 16 Jan 2018 18:02:17 +0000 (13:02 -0500)] 
Add 10054 to ODBC / SQL Server disconnect codes

Change-Id: I6e2518232608f47515b96984b4b7a41b8385975a
Fixes: #4164