]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
8 years agoCorrect pytest deprecation warning
Gábor Lipták [Tue, 17 Jan 2017 17:13:34 +0000 (12:13 -0500)] 
Correct pytest deprecation warning

WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.

Change-Id: I099c8207730ae1226f7357ff8be0d8ab149878ed
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/334

8 years ago- repair an errant docstring w/o r
Mike Bayer [Tue, 17 Jan 2017 17:08:38 +0000 (12:08 -0500)] 
- repair an errant docstring w/o r

Change-Id: I2e9c8dbc79c00b54520748d1d7cae5230a612c96

8 years ago- update copyright in .c files
Mike Bayer [Tue, 17 Jan 2017 16:45:18 +0000 (11:45 -0500)] 
- update copyright in .c files

Change-Id: If905d1bc026b688ec7203674ff14c72bc4906abf

8 years agoMerge "Parse (but don't record) COMMENT portion of MySQL table key"
mike bayer [Tue, 17 Jan 2017 15:47:33 +0000 (10:47 -0500)] 
Merge "Parse (but don't record) COMMENT portion of MySQL table key"

8 years agoParse (but don't record) COMMENT portion of MySQL table key
Lele Long [Sat, 3 Dec 2016 18:10:07 +0000 (13:10 -0500)] 
Parse (but don't record) COMMENT portion of MySQL table key

The MySQL dialect now will not warn when a reflected column has a
"COMMENT" keyword on it, but note however the comment is not yet
reflected; this is on the roadmap for a future release.  Pull request
courtesy Lele Long.

Fixes: #3867
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/324
Change-Id: I869e29aba6766d0eda1e59af09a3e8e3748a3942

8 years agoAdd support for prefixes on CREATE INDEX statements in MySQL
Joseph Schorr [Tue, 17 Jan 2017 15:02:17 +0000 (10:02 -0500)] 
Add support for prefixes on CREATE INDEX statements in MySQL

Added a new parameter ``mysql_prefix`` supported by the :class:`.Index`
construct, allows specification of MySQL-specific prefixes such as
"FULLTEXT". Pull request courtesy Joseph Schorr.

Change-Id: I5a21fa466fdfd4d9e39e1fb4ecec1eab93b92c36
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/339

8 years ago- correctly document LIKE / ILIKE, fixes #3890
Mike Bayer [Mon, 16 Jan 2017 21:27:48 +0000 (16:27 -0500)] 
- correctly document LIKE / ILIKE, fixes #3890

Change-Id: Ie59e61f53d7c59a4777ab9e6e75a43c71d67523b

8 years agoMerge "Better hide engine password"
mike bayer [Mon, 16 Jan 2017 20:56:02 +0000 (15:56 -0500)] 
Merge "Better hide engine password"

8 years agoBetter hide engine password
Valery Yundin [Fri, 16 Dec 2016 14:22:08 +0000 (09:22 -0500)] 
Better hide engine password

Avoid putting engine password in the exception message in
`MetaData.reflect` (since exception messages often appear in logs).
Use the same redacted `__repr__` implementation in
`TLEngine` as in its base class `Engine`

Change-Id: Ic0a7baea917a9c8d87dffdd82ef566673ab08e02
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/327

8 years agoAdd "existing" populators for subqueryload
Mike Bayer [Mon, 16 Jan 2017 17:10:08 +0000 (12:10 -0500)] 
Add "existing" populators for subqueryload

Fixed bug in subquery loading where an object encountered as an
"existing" row, e.g. already loaded from a different path in the
same query, would not invoke subquery loaders for unloaded attributes
that specified this loading.  This issue is in the same area
as that of :ticket:`3431`, :ticket:`3811` which involved
similar issues with joined loading.

Change-Id: If111a76b0812010905b0ac811276a816779d297f
Fixes: #3854
8 years ago- fix changelog
Mike Bayer [Mon, 16 Jan 2017 14:21:06 +0000 (09:21 -0500)] 
- fix changelog

Change-Id: Ib1da230f6fd691753c4a5056b165d7397d198b09

8 years agoMerge "Use full column->type processing for ON CONFLICT SET clause"
mike bayer [Fri, 13 Jan 2017 20:47:00 +0000 (15:47 -0500)] 
Merge "Use full column->type processing for ON CONFLICT SET clause"

8 years agoMerge "Support python3.6"
mike bayer [Fri, 13 Jan 2017 20:41:20 +0000 (15:41 -0500)] 
Merge "Support python3.6"

8 years agoUse full column->type processing for ON CONFLICT SET clause
Mike Bayer [Fri, 13 Jan 2017 17:43:24 +0000 (12:43 -0500)] 
Use full column->type processing for ON CONFLICT SET clause

Fixed bug in new "ON CONFLICT DO UPDATE" feature where the "set"
values for the UPDATE clause would not be subject to type-level
processing, as normally takes effect to handle both user-defined
type level conversions as well as dialect-required conversions, such
as those required for JSON datatypes.   Additionally, clarified that
the keys in the set_ dictionary should match the "key" of the column,
if distinct from the column name.  A warning is emitted
for remaining column names that don't match column keys; for
compatibility reasons, these are emitted as they were previously.

Fixes: #3888
Change-Id: I67a04c67aa5f65e6d29f27bf3ef2f8257088d073

8 years agoSupport python3.6
Mike Bayer [Wed, 11 Jan 2017 15:12:12 +0000 (10:12 -0500)] 
Support python3.6

Corrects some warnings and adds tox config.  Adds DeprecationWarning
to the error category.   Large sweep for string literals w/ backslashes
as this is common in docstrings

Co-authored-by: Andrii Soldatenko
Fixes: #3886
Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337

8 years ago- document how to use autocommit isolation level for CONCURRENTLY,
Mike Bayer [Thu, 12 Jan 2017 20:57:46 +0000 (15:57 -0500)] 
- document how to use autocommit isolation level for CONCURRENTLY,
fixes #3887

Change-Id: I6d1a13b7bb4169204105c7a100d17cfed3ded9d1

8 years agoMerge "Pass **kw to bound params in multi values"
mike bayer [Thu, 12 Jan 2017 13:38:39 +0000 (08:38 -0500)] 
Merge "Pass **kw to bound params in multi values"

8 years agoSet autoincrement to False; use sqlite_autoincrement in versioned_history
Carlos García Montoro [Mon, 9 Jan 2017 22:46:25 +0000 (17:46 -0500)] 
Set autoincrement to False; use sqlite_autoincrement in versioned_history

Ensure that the history table sets autoincrement=False, since these values
are copied in all cases; the flag will emit an error as of 1.1 if the
primary key is composite.   Additionally, use the sqlite_autoincrement flag
so that SQLite uses unique primary key identifiers for new rows even if
some rows have been deleted.

Fixes: #3872
Change-Id: I65912eb394b3b69d7f4e3c098f4f948b0a7a5374
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/93

8 years agoMerge "Adapt from "localparent" in joinedloader"
mike bayer [Mon, 9 Jan 2017 22:42:03 +0000 (17:42 -0500)] 
Merge "Adapt from "localparent" in joinedloader"

8 years agoPass **kw to bound params in multi values
Mike Bayer [Wed, 28 Dec 2016 21:32:53 +0000 (16:32 -0500)] 
Pass **kw to bound params in multi values

Fixed bug where literal_binds compiler flag was not honored by the
:class:`.Insert` construct for the "multiple values" feature; the
subsequent values are now rendered as literals.

Change-Id: I81ac358fd59995885d482e7571620090210865d2
Fixes: #3880
8 years agoMerge "Tighten rules for order_by(Label) resolution"
mike bayer [Mon, 9 Jan 2017 19:25:13 +0000 (14:25 -0500)] 
Merge "Tighten rules for order_by(Label) resolution"

8 years agoMerge "update for 2017 copyright"
mike bayer [Mon, 9 Jan 2017 19:24:46 +0000 (14:24 -0500)] 
Merge "update for 2017 copyright"

8 years agoAdapt from "localparent" in joinedloader
Mike Bayer [Mon, 9 Jan 2017 19:16:22 +0000 (14:16 -0500)] 
Adapt from "localparent" in joinedloader

Fixed bug involving joined eager loading against multiple entities
when polymorphic inheritance is also in use which would throw
"'NoneType' object has no attribute 'isa'".  The issue was introduced
by the fix for :ticket:`3611`.

Change-Id: I296ecda38c01ec8f69dcd843beaebed6949cecfa
Fixes: #3884
8 years agoTighten rules for order_by(Label) resolution
Mike Bayer [Fri, 6 Jan 2017 22:02:32 +0000 (17:02 -0500)] 
Tighten rules for order_by(Label) resolution

- Fixed bug originally introduced in 0.9 via :ticket:`1068` where
order_by(<some Label()>) would order by the label name based on name
alone, that is, even if the labeled expression were not at all the same
expression otherwise present, implicitly or explicitly, in the
selectable.  The logic that orders by label now ensures that the
labeled expression is related to the one that resolves to that name
before ordering by the label name; additionally, the name has to
resolve to an actual label explicit in the expression elsewhere, not
just a column name.  This logic is carefully kept separate from the
order by(textual name) feature that has a slightly different purpose.

Change-Id: I44fc36dab34380cc238c1e79ecbe23f1628d588a
Fixes: #3882
8 years ago- add a section for ARRAY of JSON to complement ARRAY of ENUM. references #3467
Mike Bayer [Thu, 5 Jan 2017 15:02:58 +0000 (10:02 -0500)] 
- add a section for ARRAY of JSON to complement ARRAY of ENUM. references #3467

Change-Id: I9836b842be01ef24138071fa022d80f5f77be14f

8 years agoupdate for 2017 copyright
Mike Bayer [Wed, 4 Jan 2017 17:39:24 +0000 (12:39 -0500)] 
update for 2017 copyright

Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de

8 years agoEnsure session.no_autoflush uses finally
plumSemPy [Wed, 4 Jan 2017 17:06:48 +0000 (12:06 -0500)] 
Ensure session.no_autoflush uses finally

The :attr:`.Session.no_autoflush` context manager now ensures that
the autoflush flag is reset within a "finally" block, so that if
an exception is raised within the block, the state still resets
appropriately.  Pull request courtesy Emin Arakelian.

Change-Id: Ib19ddf32074b1df82a6a1f1ae14e3a962cd31a5f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/335

8 years agoMerge "Correct any_, all_ spelling"
mike bayer [Wed, 28 Dec 2016 21:50:09 +0000 (16:50 -0500)] 
Merge "Correct any_, all_ spelling"

8 years ago- fix bad merge to changelog
Mike Bayer [Wed, 28 Dec 2016 21:15:22 +0000 (16:15 -0500)] 
- fix bad merge to changelog

Change-Id: I1e7444d722414627ba2a31bce13bd737950abb0c

8 years agoCorrect any_, all_ spelling
Mike Bayer [Wed, 28 Dec 2016 21:14:31 +0000 (16:14 -0500)] 
Correct any_, all_ spelling

- Fixed 1.1 regression where "import *" would not work for
sqlalchemy.sql.expression, due to mis-spelled "any_" and "all_"
functions.

Change-Id: I25d1cd34c9239dbdcdb1889c5cda2474557e1418
Fixes: #3878
8 years agoTypo
Francisco Capdevila [Thu, 22 Dec 2016 18:08:23 +0000 (15:08 -0300)] 
Typo

8 years agoDon't select lastrowid for inline=True
Mike Bayer [Wed, 21 Dec 2016 15:16:31 +0000 (10:16 -0500)] 
Don't select lastrowid for inline=True

- Fixed bug where SQL Server dialects would attempt to select the
last row identity for an INSERT from SELECT, failing in the case when
the SELECT has no rows.  For such a statement,
the inline flag is set to True indicating no last primary key
should be fetched.

Change-Id: Ic40d56d9eadadc3024a4d71245f9eed4c420024a
Fixes: #3876
8 years agoCall nextval() on sequence when doing INSERT from SELECT
Mike Bayer [Wed, 21 Dec 2016 18:39:56 +0000 (13:39 -0500)] 
Call nextval() on sequence when doing INSERT from SELECT

Fixed bug where an INSERT from SELECT where the source table contains
an autoincrementing Sequence would fail to compile correctly.

Change-Id: I41eb9f65789a4007712ae61ed5fa23a9839a5128
Fixes: #3877
8 years ago- these two tests require sane rowcount at the base
Mike Bayer [Wed, 21 Dec 2016 15:31:33 +0000 (10:31 -0500)] 
- these two tests require sane rowcount at the base

Change-Id: I7efcfb56826963e4702d19107db3c9d37c4fcb64

8 years agoUse session for exec check
Mike Bayer [Wed, 21 Dec 2016 15:20:19 +0000 (10:20 -0500)] 
Use session for exec check

This was using a different connection which could deadlock on
SQL Server.

Change-Id: Ia7953f362c99d9247dd47c3f5c3b0b91c96db1a5

8 years agoBump "table compression" flag to Oracle 10.1
Mike Bayer [Tue, 20 Dec 2016 14:15:55 +0000 (09:15 -0500)] 
Bump "table compression" flag to Oracle 10.1

- Fixed bug where the "COMPRESSION" keyword was used in the ALL_TABLES
query on Oracle 9.2; even though Oracle docs state table compression
was introduced in 9i, the actual column is not present until
10.1.

Change-Id: Iebfa59bfcfdff859169df349a5426137ab006e67
Fixes: #3875
8 years agoAdd real .entities to _BundleEntity
Mike Bayer [Mon, 19 Dec 2016 17:39:15 +0000 (12:39 -0500)] 
Add real .entities to _BundleEntity

Fixed bug where the single-table inheritance query criteria would not
be inserted into the query in the case that the :class:`.Bundle`
construct were used as the selection criteria.

Change-Id: Ib7c128ceef5c3220a098cdfd0270c43a2a67716d
Fixes: #3874
8 years ago- xmin example requires a server default declaration to function
Mike Bayer [Mon, 12 Dec 2016 17:07:11 +0000 (12:07 -0500)] 
- xmin example requires a server default declaration to function
correctly

Change-Id: I1cc50da6fe1c0eeef1d00201b45d998daddfd8ac

8 years agoAdd _extend_on deduplicating set for metadata.reflect()
Mike Bayer [Wed, 23 Nov 2016 14:14:02 +0000 (09:14 -0500)] 
Add _extend_on deduplicating set for metadata.reflect()

The "extend_existing" option of :class:`.Table` reflection would
cause indexes and constraints to be doubled up in the case that the parameter
were used with :meth:`.MetaData.reflect` (as the automap extension does)
due to tables being reflected both within the foreign key path as well
as directly.  A new de-duplicating set is passed through within the
:meth:`.MetaData.reflect` sequence to prevent double reflection in this
way.

Change-Id: Ibf6650c1e76a44ccbe15765fd79df2fa53d6bac7
Fixes: #3861
8 years agoAllow the value 0 for Postgresql TIME/TIMESTAMP precision
Ionuț Ciocîrlan [Wed, 23 Nov 2016 14:43:47 +0000 (09:43 -0500)] 
Allow the value 0 for Postgresql TIME/TIMESTAMP precision

Change-Id: Ie38c48369222d95849645f027e2c659f503cfd53
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/322

8 years agoEnsure Variant passes along impl right-hand type
Mike Bayer [Tue, 22 Nov 2016 20:36:32 +0000 (15:36 -0500)] 
Ensure Variant passes along impl right-hand type

Fixed issue in :class:`.Variant` where the "right hand coercion" logic,
inherited from :class:`.TypeDecorator`, would
coerce the right-hand side into the :class:`.Variant` itself, rather than
what the default type for the :class:`.Variant` would do.   In the
case of :class:`.Variant`, we want the type to act mostly like the base
type so the default logic of :class:`.TypeDecorator` is now overridden
to fall back to the underlying wrapped type's logic.   Is mostly relevant
for JSON at the moment.

This patch additionally adds documentation and basic tests to allow
for backend-agnostic comparison of JSON index elements to other objects.
A future version should attempt to improve upon this by providing
"astext", "asint" types of operators.

Change-Id: I7b7b45d604a4ae8d1dc236a5a1248695aab5232e
Fixes: #3859
8 years agoDisable single-inheritance critera on the outside of UNION
Mike Bayer [Fri, 18 Nov 2016 16:49:00 +0000 (11:49 -0500)] 
Disable single-inheritance critera on the outside of UNION

Fixed bug related to :ticket:`3177`, where a UNION or other set operation
emitted by a :class:`.Query` would apply "single-inheritance" criteria
to the outside of the union (also referencing the wrong selectable),
even though this criteria is now expected to
be already present on the inside subqueries.  The single-inheritance
criteria is now omitted once union() or another set operation is
called against :class:`.Query` in the same way as :meth:`.Query.from_self`.

Change-Id: I0fd1331c7ba85a758a1c15e06c271914f2c717f3
Fixes: #3856
8 years agoPort lower case quoted name fix to firebird
Mike Bayer [Wed, 16 Nov 2016 14:57:36 +0000 (09:57 -0500)] 
Port lower case quoted name fix to firebird

Ported the fix for Oracle quoted-lowercase names to Firebird, so that
a table name that is quoted as lower case can be reflected properly
including when the table name comes from the get_table_names()
inspection function.

Also genericize the test to the test suite for denormlized name
dialects.

Fixes: #3548
Change-Id: I8ca62e8d2b359e363ccb01cfe2daa0995354a3cb

8 years ago- 1.1.5 setup
Mike Bayer [Wed, 16 Nov 2016 14:58:35 +0000 (09:58 -0500)] 
- 1.1.5 setup

Change-Id: I937b12e464944221c2870e2fc62be15187c76b52

8 years ago- 1.1.4 rel_1_1_4
Mike Bayer [Tue, 15 Nov 2016 17:58:52 +0000 (12:58 -0500)] 
- 1.1.4

8 years ago- 1.0.16 release date
Mike Bayer [Tue, 15 Nov 2016 17:57:24 +0000 (12:57 -0500)] 
- 1.0.16 release date

8 years agoMerge "Add missing items to collection.__getstate__"
mike bayer [Tue, 15 Nov 2016 01:47:42 +0000 (20:47 -0500)] 
Merge "Add missing items to collection.__getstate__"

8 years ago- experiment with union merge for changelog
Mike Bayer [Mon, 14 Nov 2016 21:26:50 +0000 (16:26 -0500)] 
- experiment with union merge for changelog

Change-Id: Ieed0199c58d7eacdb26db6e1754c1ef3ee5c8c7d

8 years agoAdd missing items to collection.__getstate__
Mike Bayer [Mon, 14 Nov 2016 21:09:13 +0000 (16:09 -0500)] 
Add missing items to collection.__getstate__

the refactor in b606e47ddc54 / ticket:3457 failed
to adjust __getstate__ / __setstate__.  need to memoize
a few more things including the class itself so that we
can navigate back to "attr".

Change-Id: I4ece2a616cb8b9dac7b50763ca59e47d0f26cfdf
Fixes: #3852
8 years agoCount columns using PrimaryKeyConstraint.__len__ directly
Mike Bayer [Sat, 12 Nov 2016 17:34:01 +0000 (12:34 -0500)] 
Count columns using PrimaryKeyConstraint.__len__ directly

PrimaryKeyConstraint is present on Table however
on table() and others it's a ColumnSet.  The warning
here only needs len() and PrimaryKeyConstraint supports that
directly in the same way as ColumnSet.

Change-Id: I19c11a39110bfef48cdea49a471e7ab80b537538
Fixes: #3842
8 years agoMerge remote-tracking branch 'origin/pr/318'
Mike Bayer [Fri, 11 Nov 2016 21:33:01 +0000 (16:33 -0500)] 
Merge remote-tracking branch 'origin/pr/318'

8 years agoQuote URL tokens with semicolons for pyodbc, adodbapi
Mike Bayer [Thu, 10 Nov 2016 22:08:06 +0000 (17:08 -0500)] 
Quote URL tokens with semicolons for pyodbc, adodbapi

Fixed bug in pyodbc dialect (as well as in the mostly non-working
adodbapi dialect) whereby a semicolon present in the password
or username fields could be interpreted as a separator for another
token; the values are now quoted when semicolons are present.

Change-Id: I5f99fd8db53ebf8e805e7d9d60bc09b8f1af603f
Fixes: #3762
8 years ago- oragnize the changelog with tokens per .. change:: to allow
Mike Bayer [Fri, 11 Nov 2016 17:03:13 +0000 (12:03 -0500)] 
- oragnize the changelog with tokens per .. change:: to allow
three way merges to succeed (hopefully). requires bump of changelog
package.

Change-Id: Icd9bb7f4a4e01cc6ac66e8c7bb6631c3f6bb1d2c

8 years agoUse configured props for mapper.attrs, mapper.all_orm_descriptors
Mike Bayer [Thu, 10 Nov 2016 19:24:48 +0000 (14:24 -0500)] 
Use configured props for mapper.attrs, mapper.all_orm_descriptors

Fixed bug where the :attr:`.Mapper.attrs`,
:attr:`.Mapper.all_orm_descriptors` and other derived attributes would
fail to refresh when mapper properties or other ORM constructs were
added to the mapper/class after these  accessors were first called.

(also trying different ways to get the changelog to merge cleanly)

Change-Id: Iaecdb4b3d8c3a3b44302a5880476e60a1f4e27d9
Fixes: #3778
8 years agoMerge "Consider version_id_prop when emitting bulk UPDATE"
mike bayer [Thu, 10 Nov 2016 22:22:41 +0000 (17:22 -0500)] 
Merge "Consider version_id_prop when emitting bulk UPDATE"

8 years agoConsider version_id_prop when emitting bulk UPDATE
Mike Bayer [Wed, 5 Oct 2016 20:55:43 +0000 (16:55 -0400)] 
Consider version_id_prop when emitting bulk UPDATE

The version id needs to be part of _changed_dict()
so that the value is present to send to
_emit_update_statements()

Change-Id: Ia85f0ef7714296a75cdc6c88674805afbbe752c8
Fixes: #3781
8 years agoAdd conditional import for pysqlcipher3
Kevin Jurczyk [Thu, 10 Nov 2016 16:21:14 +0000 (11:21 -0500)] 
Add conditional import for pysqlcipher3

This is a Py3K supporting DBAPI for pysqlcipher.

Change-Id: I2a625274a371908f4de9d37f33e05408894b334b
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/320

8 years agoMerge "Remove non-working Connection.default_schema_name() method"
mike bayer [Thu, 10 Nov 2016 20:30:04 +0000 (15:30 -0500)] 
Merge "Remove non-working Connection.default_schema_name() method"

8 years agoAdd support for server side cursors to mysqldb and pymysql
Roman Podoliaka [Thu, 3 Nov 2016 22:31:05 +0000 (00:31 +0200)] 
Add support for server side cursors to mysqldb and pymysql

This allows to skip buffering of the results on the client side, e.g.
the following snippet:

    table = sa.Table(
        'testtbl', sa.MetaData(),
        sa.Column('id', sa.Integer, primary_key=True),
        sa.Column('a', sa.Integer),
        sa.Column('b', sa.String(512))
    )
    table.create(eng, checkfirst=True)

    with eng.connect() as conn:
        result = conn.execute(table.select().limit(1)).fetchone()
        if result is None:
            for _ in range(1000):
                conn.execute(
                    table.insert(),
                    [{'a': random.randint(1, 100000),
                      'b': ''.join(random.choice(string.ascii_letters) for _ in range(100))}
                      for _ in range(1000)]
                )

    with eng.connect() as conn:
        for row in conn.execution_options(stream_results=True).execute(table.select()):
            pass

now uses ~23 MB of memory instead of ~327 MB on CPython 3.5.2 and
PyMySQL 0.7.9.

psycopg2 implementation and execution options (stream_results,
server_side_cursors) are reused.

Change-Id: I4dc23ce3094f027bdff51b896b050361991c62e2

8 years agoRemove non-working Connection.default_schema_name() method
Benjamin Dopplinger [Thu, 10 Nov 2016 16:15:37 +0000 (11:15 -0500)] 
Remove non-working Connection.default_schema_name() method

The method `engine.base.Connection.default_schema_name` is broken since
4b532e2 (this was when `engine.dialect.get_default_schema_name` was
replaced with `engine.dialect.default_schema_name`).  The method is
unused and also is not functional for end-user use, so remove it
for now.

Change-Id: I6ffbd9ce1b9b54ff6df63ed45d7d33591f183933
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/321

8 years agoEnsure attribute keys used for bulk update pk set
Mike Bayer [Thu, 10 Nov 2016 16:08:52 +0000 (11:08 -0500)] 
Ensure attribute keys used for bulk update pk set

Fixed bug in :meth:`.Session.bulk_update_mappings` where an alternate-named
primary key attribute would not track properly into the UPDATE statement.

Change-Id: I33e9140f45827772768fa548adcfeb4dbfc2208d
Fixes: #3849
8 years agoAdd quotes around PRAGMA values in pysqlcipher connect.
Kevin Jurczyk [Tue, 8 Nov 2016 17:12:16 +0000 (12:12 -0500)] 
Add quotes around PRAGMA values in pysqlcipher connect.

Arguments such as cipher, kdf_iter, cipher_page_size and
cipher_use_hmac may (always?) require quotes within the
PRAGMA directive.

Change-Id: I2c808f34e1c44f0593b72b304e170e4af0a6035a
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/319

8 years agoPut include_table=True for DO UPDATE..WHERE, but not ON CONFLICT
Mike Bayer [Tue, 8 Nov 2016 02:41:11 +0000 (21:41 -0500)] 
Put include_table=True for DO UPDATE..WHERE, but not ON CONFLICT

Fixed regression caused by the fix in :ticket:`3807` (version 1.1.0)
where we ensured that the tablename was qualified in the WHERE clause
of the DO UPDATE portion of PostgreSQL's ON CONFLICT, however you
*cannot* put the table name in the  WHERE clause in the actual ON
CONFLICT itself.   This was an incorrect assumption, so that portion
of the change in :ticket:`3807` is rolled back.

Change-Id: I442d8629496a8e405b54711cfcf487761810ae8a
Fixes: #3846
Fixes: #3807
8 years agoMove setup functionality into _register_attribute
Mike Bayer [Sun, 6 Nov 2016 17:46:28 +0000 (12:46 -0500)] 
Move setup functionality into _register_attribute

Options like uselist and backref can be determined from
within _register_attribute based on parent_property
given; move this logic inside so that individual strategies
have less responsibility.  Also don't require that
_register_attribute consider the "strategy" itself
at all; it would be better if we could no longer require
that Joined/Subquery/etc loaders call upon the "lazy" strategy
in order to initialize attribute instrumentation and
this could be done more generically.

Fixes long-standing bug where the "noload" relationship loading
strategy would cause backrefs and/or back_populates options to be
ignored.   There is concern that some application that uses
"noload" might be surprised at a back-populating attribute
appearing suddenly, which may have side effects.  However,
"noload" itself must be extremely seldom used since as a
strategy, it already disables loading, population of attributes
is the only behavior that is even supported, so that this issue has existed
for at least through 0.7 four years ago without ever being
reported indicates extremely low use of this option.

Change-Id: Icffb9c83ac5782b76ce882ed1df4361a1efbfba3
Fixes: #3845
8 years agoAdds missing word "of" in docs
jfinkels [Mon, 31 Oct 2016 02:22:54 +0000 (22:22 -0400)] 
Adds missing word "of" in docs

8 years agoAdd check for blank string coming from MySQL's enum
Mike Bayer [Fri, 28 Oct 2016 18:13:31 +0000 (14:13 -0400)] 
Add check for blank string coming from MySQL's enum

MySQL's native ENUM type supports any non-valid value being sent, and
in response will return a blank string.  A hardcoded rule to check for
"is returning the blank string" has been added to the  MySQL
implementation for ENUM so that this blank string is returned to the
application rather than being rejected as a non-valid value.  Note that
if your MySQL enum is linking values to objects, you still get the
blank string back.

Change-Id: I61f85c20293a48b0c11a31f2a19f6756c206bd20
Fixes: #3841
8 years ago- 1.1.4 versioning
Mike Bayer [Fri, 28 Oct 2016 18:14:32 +0000 (14:14 -0400)] 
- 1.1.4 versioning

Change-Id: I6545ebfeeee103cac133d0b8270a860cba2d2996

8 years ago- 1.1.3 rel_1_1_3
Mike Bayer [Thu, 27 Oct 2016 14:47:26 +0000 (10:47 -0400)] 
- 1.1.3

8 years agoMerge "Restore object to the identity_map upon delete() unconditionally"
mike bayer [Thu, 27 Oct 2016 14:46:15 +0000 (10:46 -0400)] 
Merge "Restore object to the identity_map upon delete() unconditionally"

8 years agoRestore object to the identity_map upon delete() unconditionally
Mike Bayer [Thu, 27 Oct 2016 13:51:50 +0000 (09:51 -0400)] 
Restore object to the identity_map upon delete() unconditionally

Fixed regression caused by :ticket:`2677` whereby calling
:meth:`.Session.delete` on an object that was already flushed as
deleted in that session would fail to set up the object in the
identity map (or reject the object), causing flush errors as the
object were in a state not accommodated by the unit of work.
The pre-1.1 behavior in this case has been restored, which is that
the object is put back into the identity map so that the DELETE
statement will be attempted again, which emits a warning that the number
of expected rows was not matched (unless the row were restored outside
of the session).

Change-Id: I9a8871f82cb1ebe67a7ad54d888d5ee835a9a40a
Fixes: #3839
8 years agoMinor fixes in the ext.hybrid documentation.
Randy Barlow [Sun, 23 Oct 2016 14:34:25 +0000 (10:34 -0400)] 
Minor fixes in the ext.hybrid documentation.

8 years agoEnsure .mapper is set on _ColumnEntity
Mike Bayer [Fri, 21 Oct 2016 13:34:32 +0000 (09:34 -0400)] 
Ensure .mapper is set on _ColumnEntity

_ColumnEntity didn't seem to have .mapper present, which
due to the way _mapper_zero() worked didn't tend to come
across it.   With :ticket:`3608` _mapper_zero() has
been simplified so make sure this is now present.
Also ensure that _select_from_entity is an entity and
not a mapped class, though this does not seem to matter
at the moment.

Fixes: #3836
Change-Id: Id6dae8e700269b97de3b01562edee95ac1e01f80

8 years agoDon't set pg autoincrement if type affinity is not Integer
Mike Bayer [Thu, 20 Oct 2016 21:36:59 +0000 (17:36 -0400)] 
Don't set pg autoincrement if type affinity is not Integer

Postgresql table reflection will ensure that the
:paramref:`.Column.autoincrement` flag is set to False when reflecting
a primary key column that is not of an :class:`.Integer` datatype,
even if the default is related to an integer-generating sequence.
This can happen if a column is created as SERIAL and the datatype
is changed.  The autoincrement flag can only be True if the datatype
is of integer affinity in the 1.1 series.

This bug is related to a test failure in downstream sqlalchemy_migrate.

Change-Id: I40260e47e1927a1ac940538408983c943bbdba28
Fixes: #3835
8 years agoMerge "Convert expression type for concat + Enum"
mike bayer [Thu, 20 Oct 2016 20:37:00 +0000 (16:37 -0400)] 
Merge "Convert expression type for concat + Enum"

8 years agoDocument Enum.enums is now a list
Mike Bayer [Thu, 20 Oct 2016 20:29:30 +0000 (16:29 -0400)] 
Document Enum.enums is now a list

Change-Id: I27251c262f919df1b084cbb08759f672f05cd3f7
Fixes: #3834
8 years agoConvert expression type for concat + Enum
Mike Bayer [Thu, 20 Oct 2016 19:59:46 +0000 (15:59 -0400)] 
Convert expression type for concat + Enum

Fixed bug involving new value translation and validation feature
in :class:`.Enum` whereby using the enum object in a string
concatenation would maintain the :class:`.Enum` type as the type
of the expression overall, producing missing lookups.  A string
concatenation against an :class:`.Enum`-typed column now uses
:class:`.String` as the datatype of the expression itself.

Change-Id: Id402054e3ef008e0250c740dbb7e1c80f339fe78
Fixes: #3833
8 years agoEnsure TypeDecorator delegates _set_parent_with_dispatch
Mike Bayer [Thu, 20 Oct 2016 14:24:40 +0000 (10:24 -0400)] 
Ensure TypeDecorator delegates _set_parent_with_dispatch

Ensure TypeDecorator delegates _set_parent_with_dispatch as well as
_set_parent to itself as well as its impl, as the TypeDecorator
class itself may have an active SchemaType implementation as well.

Fixed regression which occurred as a side effect of :ticket:`2919`,
which in the less typical case of a user-defined
:class:`.TypeDecorator` that was also itself an instance of
:class:`.SchemaType` (rather than the implementation being such)
would cause the column attachment events to be skipped for the
type itself.

Change-Id: I0afb498fd91ab7d948e4439e7323a89eafcce0bc
Fixes: #3832
8 years ago- open for 1.1.3
Mike Bayer [Thu, 20 Oct 2016 15:46:41 +0000 (11:46 -0400)] 
- open for 1.1.3

Change-Id: I283e52a7a63ec4f7a285aba1b41627f11b7ad41b

8 years agoRewrite migration notes for [ticket:3514]
Mike Bayer [Wed, 19 Oct 2016 16:52:55 +0000 (12:52 -0400)] 
Rewrite migration notes for [ticket:3514]

The change to "evaluates none" datatypes in the ORM was
not fully described in the migration notes, missing the
key behavioral change that a column which is missing a default
entirely will not receive a value for a missing JSON column now.
The issue here touched upon a revisit of the assumptions
in [ticket:3514], but overall the old behavior "worked" mostly
because the ORM wants to explicitly render NULL into an INSERT
for column values that are missing, which itself is a legacy
behavior which should be considered for possible removal in
a future major release.  Given that "missing ORM value + no
column default set up == dont put it in the INSERT" would be
the most intuitive behavior, the move in [ticket:3514] represents
a step in this direction.

Change-Id: I454d5bb0773bd73d9864925dcc47f1f0810e33ba
Fixes: #3830
8 years ago- 1.1.2 rel_1_1_2
Mike Bayer [Mon, 17 Oct 2016 18:29:01 +0000 (14:29 -0400)] 
- 1.1.2

8 years ago- correct ticket link markup
Mike Bayer [Mon, 17 Oct 2016 18:27:53 +0000 (14:27 -0400)] 
- correct ticket link markup

Change-Id: I49df318c77f9f539541e7edea857bd256aca2844

8 years agoMerge "Add a qualifying character to multi INSERT..VALUES parameter names"
mike bayer [Mon, 17 Oct 2016 16:49:12 +0000 (12:49 -0400)] 
Merge "Add a qualifying character to multi INSERT..VALUES parameter names"

8 years agoRemove the use of the word "fundamental" to describe ColumnElements
Mike Bayer [Mon, 17 Oct 2016 16:35:26 +0000 (12:35 -0400)] 
Remove the use of the word "fundamental" to describe ColumnElements

The context is unclear if "fundamental" refers to the object's
role within a SELECT composition or within the class hierarchy
of ClauseElement classes.

Change-Id: I10bbf324fc09034cc27398867b7eca6b6f127abe
Fixes: #3793
8 years agoAdd a qualifying character to multi INSERT..VALUES parameter names
Mike Bayer [Mon, 17 Oct 2016 15:07:14 +0000 (11:07 -0400)] 
Add a qualifying character to multi INSERT..VALUES parameter names

Changed the naming convention used when generating bound parameters
for a multi-VALUES insert statement, so that the numbered parameter
names don't conflict with the anonymized parameters of a WHERE clause,
as is now common in a PostgreSQL ON CONFLICT construct.

Change-Id: I3188d100fe4d322a47d344d6a63d3e40b915f228
Fixes: #3828
8 years agoAdd explicit copy() to Enum
Mike Bayer [Mon, 17 Oct 2016 04:22:38 +0000 (00:22 -0400)] 
Add explicit copy() to Enum

The Boolean and Enum types both place SchemaType second in the
inheritance hierarchy.  In the case of Enum, this works
out that the copy() method is called from the base TypeEngine
which fails to transfer _create_events.   The test suite
doesn't seem to work with the inhertance hierarchy set up like
this as the event listeners don't work out, the _on_metadata_create
and _on_table_create hooks cause the production of an adapted type
which then adds event listeners that cause deque changed while
iteration.  It's not clear why Enum /Boolean don't have this problem.
But in any case it seems like the class mechanics for these types
remains fragile and would benefit from yet another refactor someday.

Change-Id: Ib641a5d2321b00f58bbe98dd0c5e789374db32b2
Fixes: #3827
8 years agoMemoize load_path in all cases, run quick populators for path change
Mike Bayer [Thu, 13 Oct 2016 16:27:18 +0000 (12:27 -0400)] 
Memoize load_path in all cases, run quick populators for path change

Adds a new variant to the "isnew" state within entity loading
for isnew=False, but the load path is new.  This is to address
the use case of an entity appearing in multiple places in
the row in a more generalized way than the fixes in [ticket:3431],
[ticket:3811] in that loading.py will be able to tell the
populator that this row is not "isnew" but is a "new" path
for the entity.   For the moment, the new information is only
being applied to the use of "quick" populators so that
simple column loads can take place on top of a deferred loader
from elsewhere in the row.

As part of this change, state.load_path() will now always
be populated with the "path" that was in effect when this state
was originally loaded, which for multi-path loads of the
same entity is still non-deterministic.  Ideally there'd be some
kind of "here's all the paths that loaded this state and how"
type of data structure though it's not clear if that could be
done while maintaining performance.

Fixes: #3822
Change-Id: Ib915365353dfcca09e15c24001a8581113b97d5e

8 years agoAssemble "don't joinedload other side" rule using query._current_path
Mike Bayer [Fri, 14 Oct 2016 21:06:07 +0000 (17:06 -0400)] 
Assemble "don't joinedload other side" rule using query._current_path

Discovered during testing for [ticket:3822], the rule added
for [ticket:1495] will fail if the source object has propagated
options set up, which add elements to query._current_path.

Fixes: #3824
Change-Id: I3d96c96fee5f9b247f739d2136d18681ac61f2fe

8 years agoMerge "Check for __module__ not present in util.wrap_callable()"
mike bayer [Mon, 17 Oct 2016 15:28:43 +0000 (11:28 -0400)] 
Merge "Check for __module__ not present in util.wrap_callable()"

8 years agoRemove some legacy dead code from the declared_attr logic
Pierre Jaury [Sun, 16 Oct 2016 14:45:54 +0000 (16:45 +0200)] 
Remove some legacy dead code from the declared_attr logic

The second 'if' condition was never called because the original
condition always returns.

8 years agoCheck for __module__ not present in util.wrap_callable()
Mike Bayer [Fri, 14 Oct 2016 17:26:35 +0000 (13:26 -0400)] 
Check for __module__ not present in util.wrap_callable()

The newly added wrap_callable() function assumes __module__
is present when this is not the case for objects such as
functools.partial.

Change-Id: Ia226260e9a65419e26d5c1f7187512f7fd4bb7c1
Fixes: #3823
8 years agoFix a minor grammatical error in the ORM tutorial.
Randy Barlow [Thu, 13 Oct 2016 16:58:14 +0000 (12:58 -0400)] 
Fix a minor grammatical error in the ORM tutorial.

Change-Id: I50daaee2645dd8aa2ee7217f4065589492ed0b7d

8 years ago- setup for next version
Mike Bayer [Thu, 13 Oct 2016 16:27:51 +0000 (12:27 -0400)] 
- setup for next version

Change-Id: I4a7ef54bec3891821954061a9b4ed19d398989f3

8 years agoUpdate the Column.nullable docstring for the primary_key=True case
Matt Riedemann [Mon, 10 Oct 2016 15:43:07 +0000 (11:43 -0400)] 
Update the Column.nullable docstring for the primary_key=True case

While reviewing a change that created a new table, the
primary_key column value was set to True but nullable was not
explicitly set, which led to some confusion over the default
behavior for the nullable column value when setting a primary_key.

Looking at the docs it's not clear, but the code shows that if
nullable is not specified, then nullable = not primary_key, so
nullable defaults to False when primary_key is True.

This patch adds a simple clarification to the docs so people
don't have to check the code.

Change-Id: I8553339d56fbae11370c7c6af6d8d4723163be1c
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/312

8 years agospelling: Mysql -> MySQL
Ville Skyttä [Fri, 7 Oct 2016 10:21:30 +0000 (13:21 +0300)] 
spelling: Mysql -> MySQL

8 years agospelling: Postgis -> PostGIS
Ville Skyttä [Fri, 7 Oct 2016 10:20:24 +0000 (13:20 +0300)] 
spelling: Postgis -> PostGIS

8 years agospelling: Postgresql -> PostgreSQL
Ville Skyttä [Fri, 7 Oct 2016 10:18:58 +0000 (13:18 +0300)] 
spelling: Postgresql -> PostgreSQL

8 years agoSpelling fixes
Ville Skyttä [Fri, 7 Oct 2016 10:06:09 +0000 (13:06 +0300)] 
Spelling fixes

8 years ago- 1.1.1 rel_1_1_1
Mike Bayer [Fri, 7 Oct 2016 15:04:37 +0000 (11:04 -0400)] 
- 1.1.1

8 years agoChange autoincrement compileerror to a warning
Mike Bayer [Fri, 7 Oct 2016 13:05:34 +0000 (09:05 -0400)] 
Change autoincrement compileerror to a warning

Users are complaining that IntegrityError is no longer
raised.

Change-Id: I0855d5b7a98d4338f0910501b6e6d404ba33634d
Fixes: #3216
8 years agoCatch DBAPIError instead of ProgrammingError for pyodbc fail
Mike Bayer [Fri, 7 Oct 2016 13:16:22 +0000 (09:16 -0400)] 
Catch DBAPIError instead of ProgrammingError for pyodbc fail

Change-Id: Ide9e916d02fbbef549aa2838d1402c2b091e701d
Fixes: #3820