]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
6 years agocherry-pick changelog from 1.2.18
Mike Bayer [Fri, 15 Feb 2019 18:08:57 +0000 (13:08 -0500)] 
cherry-pick changelog from 1.2.18

6 years ago- formatting fix
Mike Bayer [Fri, 15 Feb 2019 17:38:49 +0000 (12:38 -0500)] 
- formatting fix

Change-Id: I93126865ffb5cc6486464402ed7ef17027441886

6 years agoMerge "Adding setter to should_evaluate_none property"
mike bayer [Thu, 14 Feb 2019 15:40:06 +0000 (15:40 +0000)] 
Merge "Adding setter to should_evaluate_none property"

6 years agoAdding setter to should_evaluate_none property
sanjana [Wed, 13 Feb 2019 15:17:46 +0000 (10:17 -0500)] 
Adding setter to should_evaluate_none property

Fixed issue where the :class:`.JSON` type had a read-only
:attr:`.JSON.should_evaluate_none` attribute, which would cause failures
when making use of the :meth:`.TypeEngine.evaluates_none` method in
conjunction with this type.  Pull request courtesy Sanjana S.

Fixes: #4485
Closes: #4496
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4496
Pull-request-sha: 044beb23982d411be6fe640716b1b693df0f7189

Change-Id: I1f3e1d7dec9d2ceb6ccaaa8cac158a062cf02710

6 years agoSet IDENTITY_INSERT for insert.values({column: expr})
Mike Bayer [Wed, 13 Feb 2019 16:26:54 +0000 (11:26 -0500)] 
Set IDENTITY_INSERT for insert.values({column: expr})

Fixed bug where the SQL Server "IDENTITY_INSERT" logic that allows an INSERT
to proceed with an explicit value on an IDENTITY column was not detecting
the case where :meth:`.Insert.values` were used with a dictionary that
contained a :class:`.Column` as key and a SQL expression as a value.

Fixes: #4499
Change-Id: Ia61cd6524b030b40a665db9c20771f0c5aa5fcd7

6 years agoMerge "Allow SQL expression for ORM primary keys"
mike bayer [Wed, 13 Feb 2019 01:35:15 +0000 (01:35 +0000)] 
Merge "Allow SQL expression for ORM primary keys"

6 years agoAllow SQL expression for ORM primary keys
Mike Bayer [Mon, 11 Feb 2019 22:00:47 +0000 (17:00 -0500)] 
Allow SQL expression for ORM primary keys

A SQL expression can now be assigned to a primary key attribute for an ORM
flush in the same manner as ordinary attributes as described in
:ref:`flush_embedded_sql_expressions` where the expression will be evaulated
and then returned to the ORM using RETURNING, or in the case of pysqlite,
works using the cursor.lastrowid attribute.Requires either a database that
supports RETURNING (e.g. Postgresql, Oracle, SQL Server) or pysqlite.

Fixes: #3133
Fixes: #4494
Change-Id: I83da8357354de002cb04fa4a553f2a2f90c5157d

6 years agoMerge "Add complete coverage and fix lower() for MySQL 88718 workaround"
mike bayer [Mon, 11 Feb 2019 20:22:27 +0000 (20:22 +0000)] 
Merge "Add complete coverage and fix lower() for MySQL 88718 workaround"

6 years agoAdd complete coverage and fix lower() for MySQL 88718 workaround
Mike Bayer [Mon, 11 Feb 2019 14:07:03 +0000 (09:07 -0500)] 
Add complete coverage and fix lower() for MySQL 88718 workaround

Fixed a second regression caused by :ticket:`4344` (the first was
:ticket:`4361`), which works around MySQL issue 88718, where the lower
casing function used was not correct for Python 2 with OSX/Windows casing
conventions, which would then raise ``TypeError``.  Full coverage has been
added to this logic so that every codepath is exercised in a mock style for
all three casing conventions on all versions of Python. MySQL 8.0 has
meanwhile fixed issue 88718 so the workaround is only applies to a
particular span of MySQL 8.0 versions.

Fixes: #4492
Change-Id: I14e7237e0be4a9c21c58c921066304ae99ac4dc6

6 years agoMerge "Don't run pending_to_persistent for non-new objects"
mike bayer [Sun, 10 Feb 2019 03:57:10 +0000 (03:57 +0000)] 
Merge "Don't run pending_to_persistent for non-new objects"

6 years agoDon't run pending_to_persistent for non-new objects
Mike Bayer [Sat, 9 Feb 2019 06:46:06 +0000 (01:46 -0500)] 
Don't run pending_to_persistent for non-new objects

Fixed fairly simple but critical issue where the
:meth:`.SessionEvents.pending_to_persistent` event would be invoked for
objects not just when they move from pending to persistent, but when they
were also already persistent and just being updated, thus causing the event
to be invoked for all objects on every update.

Fixes: #4489
Change-Id: Ibe147020aa62f7d605cb1029b7f3b776f42e6b43

6 years agoNote for history methods that history is reset per-flush.
Mike Bayer [Sat, 9 Feb 2019 17:22:39 +0000 (12:22 -0500)] 
Note for history methods that history is reset per-flush.

Change-Id: I9bc4d0ddfa93f13e6717b89fa9934f1b8052147f

6 years agomention no_autoflush in the flush section of the docs
Mike Bayer [Fri, 8 Feb 2019 22:48:51 +0000 (17:48 -0500)] 
mention no_autoflush in the flush section of the docs

also remove link to wiki which is obsolete

Change-Id: I9ebd578923c3eba6e35f3b6203c01ba003dd4115

6 years agoVersion 1.3.0 placeholder
Mike Bayer [Fri, 8 Feb 2019 20:19:40 +0000 (15:19 -0500)] 
Version 1.3.0 placeholder

6 years ago- 1.3.0b3 rel_1_3_0b3
Mike Bayer [Fri, 8 Feb 2019 20:12:18 +0000 (15:12 -0500)] 
- 1.3.0b3

6 years agoAdd type stubs link to the docs
Ivan Levkivskyi [Fri, 8 Feb 2019 19:10:19 +0000 (19:10 +0000)] 
Add type stubs link to the docs

Moved by Mike to be a sidebar in the Declarative docs, as
the plugin appears to be specific to Declarative.  These docs will
eventually be moved out of the "extension" section and merged
into the primary narrative documentation.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: Idba4c13ffc920b1140b5e51d206ab02f19015e8e

6 years agoUse declarative mapping for the embedded SQL expressions example
Mike Bayer [Thu, 7 Feb 2019 15:19:08 +0000 (10:19 -0500)] 
Use declarative mapping for the embedded SQL expressions example

Change-Id: I1e778409f2d6e50dfba40bafc58e56f3625e7a27
(cherry picked from commit 7816476cdd0a6c83cdd0eeab8698c2469aa0197b)

6 years agoMerge "Remove all remaining text() coercions and ensure identifiers are safe"
mike bayer [Thu, 7 Feb 2019 03:54:44 +0000 (03:54 +0000)] 
Merge "Remove all remaining text() coercions and ensure identifiers are safe"

6 years agoRemove all remaining text() coercions and ensure identifiers are safe
Mike Bayer [Mon, 4 Feb 2019 20:50:29 +0000 (15:50 -0500)] 
Remove all remaining text() coercions and ensure identifiers are safe

Fully removed the behavior of strings passed directly as components of a
:func:`.select` or :class:`.Query` object being coerced to :func:`.text`
constructs automatically; the warning that has been emitted is now an
ArgumentError or in the case of order_by() / group_by() a CompileError.
This has emitted a warning since version 1.0 however its presence continues
to create concerns for the potential of mis-use of this behavior.

Note that public CVEs have been posted for order_by() / group_by() which
are resolved by this commit:  CVE-2019-7164  CVE-2019-7548

Added "SQL phrase validation" to key DDL phrases that are accepted as plain
strings, including :paramref:`.ForeignKeyConstraint.on_delete`,
:paramref:`.ForeignKeyConstraint.on_update`,
:paramref:`.ExcludeConstraint.using`,
:paramref:`.ForeignKeyConstraint.initially`, for areas where a series of SQL
keywords only are expected.Any non-space characters that suggest the phrase
would need to be quoted will raise a :class:`.CompileError`.   This change
is related to the series of changes committed as part of :ticket:`4481`.

Fixed issue where using an uppercase name for an index type (e.g. GIST,
BTREE, etc. ) or an EXCLUDE constraint would treat it as an identifier to
be quoted, rather than rendering it as is. The new behavior converts these
types to lowercase and ensures they contain only valid SQL characters.

Quoting is applied to :class:`.Function` names, those which are usually but
not necessarily generated from the :attr:`.sql.func` construct,  at compile
time if they contain illegal characters, such as spaces or punctuation. The
names are as before treated as case insensitive however, meaning if the
names contain uppercase or mixed case characters, that alone does not
trigger quoting. The case insensitivity is currently maintained for
backwards compatibility.

Fixes: #4481
Fixes: #4473
Fixes: #4467
Change-Id: Ib22a27d62930e24702e2f0f7c74a0473385a08eb

6 years agoRemove all occurrences of the word "password" from all examples and tutorials
Mike Bayer [Tue, 5 Feb 2019 23:24:29 +0000 (18:24 -0500)] 
Remove all occurrences of the word "password" from all examples and tutorials

Fixes: #4484
Change-Id: I97e8cbd9f4906332ac0a4fe9c8496a0147fc9a9b

6 years agoMerge "Improve support for with_polymorphic in mapper options"
mike bayer [Mon, 4 Feb 2019 19:27:31 +0000 (19:27 +0000)] 
Merge "Improve support for with_polymorphic in mapper options"

6 years agoImprove support for with_polymorphic in mapper options
Mike Bayer [Sun, 27 Jan 2019 00:49:44 +0000 (19:49 -0500)] 
Improve support for with_polymorphic in mapper options

Improved the behavior of :func:`.orm.with_polymorphic` in conjunction with
loader options, in particular wildcard operations as well as
:func:`.orm.load_only`.  The polymorphic object will be more accurately
targeted so that column-level options on the entity will correctly take
effect.The issue is a continuation of the same kinds of things fixed in
:ticket:`4468`.

The path logic when using chained mapper options is improved
to be more accurate in terms of the entities being linked
in the path; when using :func:`.with_polymorphic`, mapper
options against this entity need to specify attributes
in terms of the with_polymorphic() object and not against the
base mappings.  New error conditions are raised which were previously
more than likely silenty failures.

Fixes: #4469
Change-Id: Ie8d802879663b4ff6f6ac1438c885c06d78ae2a0

6 years agoAdd bulk_replace to AssociationSet, AssociationDict
Mike Bayer [Sun, 3 Feb 2019 18:29:06 +0000 (13:29 -0500)] 
Add bulk_replace to AssociationSet, AssociationDict

Implemented a more comprehensive assignment operation (e.g. "bulk replace")
when using association proxy with sets or dictionaries.  Fixes the problem
of redundant proxy objects being created to replace the old ones, which
leads to excessive events and SQL and in the case of unique constraints
will cause the flush to fail.

Fixes: #2642
Change-Id: I57ab27dd9feba057e539267722cce92254fca777

6 years agoRepair incorrect issue number
Mike Bayer [Sun, 3 Feb 2019 17:50:09 +0000 (12:50 -0500)] 
Repair incorrect issue number

This reopens #4406 inadvertently closed and fixes #4464, already
released in 1.3.0b2.

Fixes: #4464
Change-Id: I82f3dbdff01fe24ea51a4dda0608c0a284320a57

6 years agoMerge "Remove Nose support"
mike bayer [Sun, 3 Feb 2019 17:45:28 +0000 (17:45 +0000)] 
Merge "Remove Nose support"

6 years agoRemove Nose support
Parth Shandilya [Fri, 1 Feb 2019 04:24:29 +0000 (23:24 -0500)] 
Remove Nose support

The test system has removed support for Nose, which is unmaintained for
several years and is producing warnings under Python 3. The test suite is
currently standardized on Pytest.  Pull request courtesy Parth Shandilya.

Fixes: #4460
Closes: #4476
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4476
Pull-request-sha: e857af9c7d07355e52841149ee2e5d4448409e1e

Change-Id: I76516fae1cf0eb58f2e9fc9f692e591e0fcf39a4

6 years agoRender parenthesis around sqlite expression defaults
Bartlomiej Biernacki [Thu, 31 Jan 2019 14:33:01 +0000 (09:33 -0500)] 
Render parenthesis around sqlite expression defaults

Fixed bug in SQLite DDL where using an expression as a server side default
required that it be contained within parenthesis to be accepted by the
sqlite parser.  Pull request courtesy Bartlomiej Biernacki.

Fixes: #4474
Closes: #4475
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4475
Pull-request-sha: 0af3238c69c2610333cf62082c12047d45c31ce0

Change-Id: I888c69bfba5a5ab8ffa420f512557ac311a36b31
(cherry picked from commit f7ce37e9dd493d4b60b3156f08ef4c98fd63904d)

6 years agorepair F632 issue
Mike Bayer [Sat, 2 Feb 2019 02:34:53 +0000 (21:34 -0500)] 
repair F632 issue

in b8f9517cddf41dbb47ae4ad120141c7ab1a29ac5 we disabled this new error
coming up, but it's just this one line in a test that is in fact wrong.

Change-Id: I4e3612596e9735c7db066832d13ccb454c93808f

6 years agoMerge "Add informative failure modes to _DeferredMapperConfig"
mike bayer [Thu, 31 Jan 2019 16:09:41 +0000 (16:09 +0000)] 
Merge "Add informative failure modes to _DeferredMapperConfig"

6 years agoAdded a link for Candidate Keys
Ben Brumm [Wed, 30 Jan 2019 19:05:01 +0000 (06:05 +1100)] 
Added a link for Candidate Keys

(cherry picked from commit 4421688162302af2c90ed7d1daf17161daded1e6)

Change-Id: Ifb74aec34c4db27cd496f081c8fd6d872b9addd4

6 years agoAdd informative failure modes to _DeferredMapperConfig
Mike Bayer [Wed, 30 Jan 2019 05:53:10 +0000 (23:53 -0600)] 
Add informative failure modes to _DeferredMapperConfig

Added some helper exceptions that invoke when a mapping based on
:class:`.AbstractConcreteBase`, :class:`.DeferredReflection`, or
:class:`.AutoMap` is used before the mapping is ready to be used, which
contain descriptive information on the class, rather than falling through
into other failure modes that are less informative.

Fixes: #4470
Change-Id: I9bc51697f63cedaa7809a0adb17b2398c209e289

6 years agoAdd F632 another issue that just popped up
Mike Bayer [Thu, 31 Jan 2019 03:04:47 +0000 (21:04 -0600)] 
Add F632 another issue that just popped up

Change-Id: I4658615f450ed670bbde39e085e1b1f913e3736f

6 years agoadd F821 which for some reason is some new thing flake8 wants to complain about
Mike Bayer [Thu, 31 Jan 2019 03:00:36 +0000 (21:00 -0600)] 
add F821 which for some reason is some new thing flake8 wants to complain about

Change-Id: I27df129ae883d75217ec07ff6d0139447444cc60

6 years agoFix typo: issue is #4442, not #4222 4471/head
Ville Brofeldt [Tue, 29 Jan 2019 10:50:43 +0000 (12:50 +0200)] 
Fix typo: issue is #4442, not #4222

6 years agoremove py36 from test profiles
Mike Bayer [Sun, 27 Jan 2019 05:55:54 +0000 (00:55 -0500)] 
remove py36 from test profiles

Since we aren't regenerating for py36 we need to take the
obsolete numbers out also.

Change-Id: I67c4268bcec63d7d3a03ab757674780ee8693677

6 years agoMerge "Ensure of_type subclass taken into account with wildcards"
mike bayer [Sat, 26 Jan 2019 22:21:46 +0000 (22:21 +0000)] 
Merge "Ensure of_type subclass taken into account with wildcards"

6 years agoEnsure of_type subclass taken into account with wildcards
Mike Bayer [Sat, 26 Jan 2019 19:53:45 +0000 (14:53 -0500)] 
Ensure of_type subclass taken into account with wildcards

Fixed a regression in 1.2 where a wildcard/load_only loader option would
not work correctly against a loader path where of_type() were used to limit
to a particular subclass.  The fix only works for of_type() of a simple
subclass so far, not a with_polymorphic entity which will be addressed in a
separate issue; it is unlikely this latter case was working previously.

Since we ensure that the entity is broken out into its superclasses
when a wilcard is encountered, we can limit the entity path to the
specific entity given in this case.

Within this issue some additional issues with with_polymorphic()
loaders were found which will be addressed in #4469.

Fixes: #4468
Change-Id: Ie91ec27b49104e019636f870776e294321586a9e

6 years agoVersion 1.3.0b3 placeholder
Mike Bayer [Sat, 26 Jan 2019 02:51:35 +0000 (21:51 -0500)] 
Version 1.3.0b3 placeholder

6 years ago- 1.3.0b2 rel_1_3_0b2
Mike Bayer [Sat, 26 Jan 2019 02:40:01 +0000 (21:40 -0500)] 
- 1.3.0b2

6 years agoVersion 1.2.18 placeholder
Mike Bayer [Sat, 26 Jan 2019 02:32:00 +0000 (21:32 -0500)] 
Version 1.2.18 placeholder

(cherry picked from commit d196c49918ee1e7fbce12e228aa7db33d098908f)

6 years ago- 1.2.17
Mike Bayer [Sat, 26 Jan 2019 02:16:56 +0000 (21:16 -0500)] 
- 1.2.17

(cherry picked from commit 47c245b90cd3cfe76bc0cf078f740d12bf7ba2d1)

6 years agoFix timeout method doc to be for QueuePool
Mike Bayer [Sat, 26 Jan 2019 02:30:55 +0000 (21:30 -0500)] 
Fix timeout method doc to be for QueuePool

Change-Id: I14d4e623a5761963e10bb8f5d99a8ca3684db61b

6 years agoImprove error messages in the area of loader options
Mike Bayer [Wed, 9 Jan 2019 07:01:16 +0000 (02:01 -0500)] 
Improve error messages in the area of loader options

Improved error messages emitted by the ORM in the area of loader option
traversal.  This includes early detection of mis-matched loader strategies
along with a clearer explanation why these strategies don't match.

Fixes: #4433
Change-Id: I3351b64241f7f62ca141a0be95085e6ef8ca6d32

6 years agoFix some long lines that sneaked in with the spelling fixes change
Mike Bayer [Fri, 25 Jan 2019 20:13:48 +0000 (15:13 -0500)] 
Fix some long lines that sneaked in with the spelling fixes change

Change-Id: Icc6d8e564c9d31da2adc39d060e077c3d4811186

6 years agoFix many spell glitches
Lele Gaifax [Mon, 14 Jan 2019 16:26:33 +0000 (11:26 -0500)] 
Fix many spell glitches

This affects mostly docstrings, except in orm/events.py::dispose_collection()
where one parameter gets renamed: given that the method is
empty, it seemed reasonable to me to fix that too.

Closes: #4440
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4440
Pull-request-sha: 779ed75acb6142e1f1daac467b5b14134529bb4b

Change-Id: Ic0553fe97853054b09c2453af76d96363de6eb0e

6 years agoMerge "Add getters for all execution_options"
mike bayer [Fri, 25 Jan 2019 19:55:25 +0000 (19:55 +0000)] 
Merge "Add getters for all execution_options"

6 years agoMerge "Fix mssql quote schema warning"
mike bayer [Fri, 25 Jan 2019 19:54:14 +0000 (19:54 +0000)] 
Merge "Fix mssql quote schema warning"

6 years agoMerge "Implement relationship to AliasedClass; deprecate non primary mappers"
mike bayer [Fri, 25 Jan 2019 16:58:08 +0000 (16:58 +0000)] 
Merge "Implement relationship to AliasedClass; deprecate non primary mappers"

6 years agoFix mssql quote schema warning
Mike Bayer [Fri, 25 Jan 2019 16:36:54 +0000 (11:36 -0500)] 
Fix mssql quote schema warning

The deprecations review didn't include tests of identifier_preparer.quote.force
for backends, so MSSQL slipped through.  We have to fully reimplement
the deprecation warning here so that it passes tests which are now
enabled for all backends.

Change-Id: I9d07e6766e16b5a35b7f7566f1daf94b04346270

6 years agoAdd getters for all execution_options
Daniel Lister [Thu, 24 Jan 2019 21:35:16 +0000 (16:35 -0500)] 
Add getters for all execution_options

Added accessors for execution options to Core and ORM, via
:meth:`.Query.get_execution_options`,
:meth:`.Connection.get_execution_options`,
:meth:`.Engine.get_execution_options`, and
:meth:`.Executable.get_execution_options`.  PR courtesy Daniel Lister.

Fixes: #4406
Closes: #4465
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4465
Pull-request-sha: 9674688bb5e80471a6a421bac06f995c2e64f8f7

Change-Id: I93ba51d7a2d687e255edd6938db15615e56dd237

6 years agoMerge "Use pg_get_constraintdef for CHECK constraint reflection"
mike bayer [Fri, 25 Jan 2019 14:30:54 +0000 (14:30 +0000)] 
Merge "Use pg_get_constraintdef for CHECK constraint reflection"

6 years agoImplement relationship to AliasedClass; deprecate non primary mappers
Mike Bayer [Sun, 30 Dec 2018 01:54:29 +0000 (20:54 -0500)] 
Implement relationship to AliasedClass; deprecate non primary mappers

Implemented a new feature whereby the :class:`.AliasedClass` construct can
now be used as the target of a :func:`.relationship`.  This allows the
concept of "non primary mappers" to no longer be necessary, as the
:class:`.AliasedClass` is much easier to configure and automatically inherits
all the relationships of the mapped class, as well as preserves the
ability for loader options to work normally.

- introduce new name for mapped_table, "persist_selectable".  this is
the selectable that selects against the local mapper and its superclasses,
but does not include columns local only to subclasses.

- relationship gains "entity" which is the mapper or aliasedinsp.

- clarfiy name "entity" vs. "query_entity" in loader strategies.

Fixes: #4423
Fixes: #4422
Fixes: #4421
Fixes: #3348
Change-Id: Ic3609b43dc4ed115006da9ad9189e574dc0c72d9

6 years ago- this is a meth, not a ref
Mike Bayer [Fri, 25 Jan 2019 00:38:42 +0000 (19:38 -0500)] 
- this is a meth, not a ref

Change-Id: I6761732fe0a93673dff27fdf15287b189f31784b

6 years agoUse pg_get_constraintdef for CHECK constraint reflection
Mike Bayer [Thu, 24 Jan 2019 21:56:44 +0000 (16:56 -0500)] 
Use pg_get_constraintdef for CHECK constraint reflection

Revised the query used when reflecting CHECK constraints to make use of the
``pg_get_constraintdef`` function, as the ``consrc`` column is being
deprecated in PG 12.  Thanks to John A Stevenson for the tip.

Fixes: #4463
Change-Id: Ie0ee9bdfddb0635db72b35c2e2e4b27f154162fd

6 years agoMerge "Provide public accessor for Pool.timeout()."
mike bayer [Thu, 24 Jan 2019 21:35:55 +0000 (21:35 +0000)] 
Merge "Provide public accessor for Pool.timeout()."

6 years agoProvide public accessor for Pool.timeout().
Irina Delamare [Thu, 24 Jan 2019 00:23:59 +0000 (19:23 -0500)] 
Provide public accessor for Pool.timeout().

Added public accessor :meth:`.Pool.timeout` that returns the configured
timeout for a :class:`.Pool` object.  Pull request courtesy Irina Delamare.

Fixes: #3689
Closes: #4447
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4447
Pull-request-sha: 0179b0a829e9609429dc698992670d2e6749c10c

Change-Id: I402b065cf9183160f71d9de73e308268356b7deb

6 years ago- all the checkboxes are just embarassing, just do something simple
Mike Bayer [Thu, 24 Jan 2019 17:41:51 +0000 (12:41 -0500)] 
- all the checkboxes are just embarassing, just do something simple

Change-Id: Icb689ffbc780016ec59c549c65e6add20c96951e

6 years agoMerge "Add deprecation warnings to all deprecated APIs"
mike bayer [Thu, 24 Jan 2019 08:08:22 +0000 (08:08 +0000)] 
Merge "Add deprecation warnings to all deprecated APIs"

6 years agoAdd deprecation warnings to all deprecated APIs
Mike Bayer [Fri, 21 Dec 2018 03:05:36 +0000 (22:05 -0500)] 
Add deprecation warnings to all deprecated APIs

A large change throughout the library has ensured that all objects, parameters,
and behaviors which have been noted as deprecated or legacy now emit
``DeprecationWarning`` warnings when invoked.   As the Python 3 interpreter now
defaults to displaying deprecation warnings, as well as that modern test suites
based on tools like tox and pytest tend to display deprecation warnings,
this change should make it easier to note what API features are obsolete.

See the notes added to the changelog and migration notes for further
details.

Fixes: #4393
Change-Id: If0ea11a1fc24f9a8029352eeadfc49a7a54c0a1b

6 years agoAdd QueryEvents before_compile_update / before_compile_delete
Mike Bayer [Wed, 23 Jan 2019 02:49:07 +0000 (21:49 -0500)] 
Add QueryEvents before_compile_update / before_compile_delete

Added new event hooks :meth:`.QueryEvents.before_compile_update` and
:meth:`.QueryEvents.before_compile_delete` which complement
:meth:`.QueryEvents.before_compile` in the case of the :meth:`.Query.update`
and :meth:`.Query.delete` methods.

Fixes: #4461
Change-Id: I47884f0e1f07d7e62870c2a918b15f917f9245ab

6 years agoDon't use cx_Oracle.NATIVE_INT in output type handlers
Mike Bayer [Sat, 19 Jan 2019 02:30:21 +0000 (21:30 -0500)] 
Don't use cx_Oracle.NATIVE_INT in output type handlers

Fixed regression in integer precision logic due to the refactor of the
cx_Oracle dialect in 1.2.  We now no longer apply the cx_Oracle.NATIVE_INT
type to result columns sending integer values (detected as positive
precision with scale ==0) which encounters integer overflow issues with
values that go beyond the 32 bit boundary.  Instead, the output variable
is left untyped so that cx_Oracle can choose the best option.

Fixes: #4457
Change-Id: I1e3114c2f37bf028fb1f521a3e9789a77e3a7491

6 years agoCleanup with query aliasing
Mike Bayer [Fri, 18 Jan 2019 04:38:40 +0000 (23:38 -0500)] 
Cleanup with query aliasing

Try to simplify some of the "adapter" stuff in query:

1. identify that join(.., aliased=True) doesn't work if the
right side has no mapper.   The adaption of the right side is
done via the mapper with aliased(), so that doesn't effect
a selectable only.  raise an error, so we can simplify
the code.

2. build fewer adapter objects.   these are confusing to follow
and we should try to figure out exactly what purpose which
one serves where and make that clear.

Change-Id: I18dfcd01e6ad533aa0b8d557fc637ee2766ed050

6 years agoRegenerate callcounts for mysqlclient 1.4.0
Mike Bayer [Fri, 18 Jan 2019 20:46:41 +0000 (15:46 -0500)] 
Regenerate callcounts for mysqlclient 1.4.0

Fixes: #4455
Change-Id: I396230f649f6bb5e396798e63339fcecb3b85eaf

6 years agoMerge "Adapt single inh criteria more specifically"
mike bayer [Fri, 18 Jan 2019 16:31:14 +0000 (16:31 +0000)] 
Merge "Adapt single inh criteria more specifically"

6 years agoFeature mysqlclient
Mike Bayer [Fri, 18 Jan 2019 06:02:07 +0000 (01:02 -0500)] 
Feature mysqlclient

MySQL-Python hasn't been released in about five years and there
is no reason that it should be listed as a viable DBAPI;
all MySQL / MariaDB users should be using mysqlclient or PyMySQL today.

Change-Id: I2f12babe6e60bc7393398400a125d0592e86dbb8

6 years agoAdd example of password URL encoding
Mike Bayer [Fri, 18 Jan 2019 05:53:55 +0000 (00:53 -0500)] 
Add example of password URL encoding

Fixes: #4452
Change-Id: I6d6ef36c4a0aa1e7c064b8aed289a1ce79b5120f

6 years agolink the psycopg2 fast execution document to the Core tutorial executemany section
Mike Bayer [Fri, 18 Jan 2019 05:35:00 +0000 (00:35 -0500)] 
link the psycopg2 fast execution document to the Core tutorial executemany section

Fixes: #4109
Change-Id: I62fcb703b552db842be335c8f9257cc0e8c5cdd5

6 years agoAdapt single inh criteria more specifically
Mike Bayer [Fri, 18 Jan 2019 01:08:10 +0000 (20:08 -0500)] 
Adapt single inh criteria more specifically

Fixed issue where when using single-table inheritance in conjunction with a
joined inheritance hierarchy that uses "with polymorphic" loading, the
"single table criteria" for that single-table entity could get confused for
that of other entities from the same hierarchy used in the same query.The
adaption of the "single table criteria" is made more specific to the target
entity to avoid it accidentally getting adapted to other tables in the
query.

Change-Id: Ia9f915a4b01e8bb9cee365c4c70e00c626f103c4
Fixes: #4454
6 years agoRepair use of deprecated text() typemap, bindparams parameters
Mike Bayer [Thu, 17 Jan 2019 18:16:04 +0000 (13:16 -0500)] 
Repair use of deprecated text() typemap, bindparams parameters

These will emit a deprecation warning once
If0ea11a1fc24f9a8029352eeadfc49a7a54c0a1b is merged, modernize these
ahead of time as this should likely be backported to 1.2 as well.

Change-Id: Iae4426a856d5617e8a325b14d8b6fc22333f2cda

6 years agoReinstate elementtree example
Vraj Mohan [Wed, 16 Jan 2019 20:36:54 +0000 (15:36 -0500)] 
Reinstate elementtree example

Partially fixes sqlalchemy/sqlalchemy#4426.

Closes: #4441
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4441
Pull-request-sha: ed90f3b77c2d0f4cc2cd54f40f5af29b489977d2

Change-Id: Ic32e5d8020073da055b12a6aeb61e698a97dc504

6 years ago- pep8 fix
Mike Bayer [Thu, 17 Jan 2019 01:20:45 +0000 (20:20 -0500)] 
- pep8 fix

Change-Id: I5e2e013c3460c035ad80dae7fd08efe5d1676a5d

6 years agoConvert most "See also" phrases into .. seealso::
Mike Bayer [Tue, 15 Jan 2019 21:12:39 +0000 (16:12 -0500)] 
Convert most "See also" phrases into .. seealso::

Change-Id: Ie32598b895c1c5f5bce7c8e1573abbcfe9d434a8
(cherry picked from commit e81d3815abb36c52b0019dee6e4f67990e3d1c7d)

6 years agoMerge "Render N'' for SQL Server unicode literals"
mike bayer [Tue, 15 Jan 2019 17:47:14 +0000 (17:47 +0000)] 
Merge "Render N'' for SQL Server unicode literals"

6 years agoRemove version directives for 0.6, 0.7, 0.8
Mike Bayer [Tue, 15 Jan 2019 15:49:36 +0000 (10:49 -0500)] 
Remove version directives for 0.6, 0.7, 0.8

- fix a few "seealso"s
- ComparableProprerty's "superseded in 0.7" becomes deprecated in 0.7

Backport to currently maintained doc versions 1.2, 1.1

Change-Id: Ib1fcb2df8673dbe5c4ffc47f3896a60d1dfcb4b2

6 years agoPR template tweaks
Mike Bayer [Tue, 15 Jan 2019 15:10:56 +0000 (10:10 -0500)] 
PR template tweaks

Change-Id: I49557362057fef3ea151bc2f4bd8c3c96cdf5935

6 years agoMerge "Relax "ambiguous" association proxy restrictions, support Proxy"
mike bayer [Tue, 15 Jan 2019 15:06:05 +0000 (15:06 +0000)] 
Merge "Relax "ambiguous" association proxy restrictions, support Proxy"

6 years agoRender N'' for SQL Server unicode literals
Mike Bayer [Sun, 13 Jan 2019 23:15:52 +0000 (18:15 -0500)] 
Render N'' for SQL Server unicode literals

The ``literal_processor`` for the :class:`.Unicode` and
:class:`.UnicodeText` datatypes now render an ``N`` character in front of
the literal string expression as required by SQL Server for Unicode string
values rendered in SQL expressions.

Note that this adds full unicode characters to the standard test suite,
which means we also need to bump MySQL provisioning up to utf8mb4.
Modern installs do not seem to be reproducing the 1271 issue locally,
if it reproduces in CI it would be better for us to skip those ORM-centric
tests for MySQL.

Also remove unused _StringType from SQL Server dialect

Fixes: #4442
Change-Id: Id55817b3e8a2d81ddc8b7b27f85e3f1dcc1cea7e

6 years agoMerge "move to inspect_getfullargspec"
mike bayer [Tue, 15 Jan 2019 15:02:17 +0000 (15:02 +0000)] 
Merge "move to inspect_getfullargspec"

6 years agomove to inspect_getfullargspec
Mike Bayer [Mon, 14 Jan 2019 17:22:40 +0000 (12:22 -0500)] 
move to inspect_getfullargspec

Replace inspect_getargspec with inspect_getfullargspec
including a compatibility fallback for Py2k and use
getfullargspec fully.

Change-Id: I92bce0aafc37ce1a360b4f61b75f5892d0911c7e

6 years agoRelax "ambiguous" association proxy restrictions, support Proxy
Mike Bayer [Mon, 14 Jan 2019 23:53:58 +0000 (18:53 -0500)] 
Relax "ambiguous" association proxy restrictions, support Proxy

Fixed issue in association proxy due to :ticket:`3423` which caused the use
of custom :class:`.PropComparator` objects with hybrid attribites, such as
the one demonstrated in  the ``dictlike-polymorphic`` example to not
function within an association proxy.  The strictness that was added in
:ticket:`3423` has been relaxed, and additional logic to accomodate for
an association proxy that links to a custom hybrid have been added.

Fixes: #4446
Change-Id: I8addc80f51094769915ac2dce1a301bd72ee7433

6 years agoPull request template final
Mike Bayer [Mon, 14 Jan 2019 21:51:04 +0000 (16:51 -0500)] 
Pull request template final

Change-Id: Id94b90a58753e044ec3495601fea4c12e79d6e3d

6 years agoanother change to the PR template
Mike Bayer [Mon, 14 Jan 2019 21:38:14 +0000 (16:38 -0500)] 
another change to the PR template

Change-Id: I29b0f60d3ec32249333edaeb6550147bd740d893

6 years agoTry a new pull request template
Mike Bayer [Mon, 14 Jan 2019 21:32:16 +0000 (16:32 -0500)] 
Try a new pull request template

Change-Id: I4c2c176c30eb99157bd037035501f876cb344823

6 years agocorrect paramref to property links to refer to creation function
Mike Bayer [Sun, 13 Jan 2019 17:36:21 +0000 (12:36 -0500)] 
correct paramref to property links to refer to creation function

Change-Id: I2c528bd4639863aa7b8a592beed776d53bab3e5c

6 years agoMerge "Add standalone orm.close_all method and deprecate SessionMaker.close_all"
mike bayer [Sun, 13 Jan 2019 02:46:08 +0000 (02:46 +0000)] 
Merge "Add standalone orm.close_all method and deprecate SessionMaker.close_all"

6 years agoMerge "use ..deprecated directive w/ version in all cases"
mike bayer [Sat, 12 Jan 2019 23:22:47 +0000 (23:22 +0000)] 
Merge "use ..deprecated directive w/ version in all cases"

6 years agoAdd standalone orm.close_all method and deprecate SessionMaker.close_all
Augustin Trancart [Sat, 12 Jan 2019 15:46:01 +0000 (10:46 -0500)] 
Add standalone orm.close_all method and deprecate SessionMaker.close_all

Added a new function :func:`.close_all_sessions` which takes
over the task of the :meth:`.Session.close_all` method, which
is now deprecated as this is confusing as a classmethod.
Pull request courtesy Augustin Trancart.

Fixes: #4412
Closes: #4438
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4438
Pull-request-sha: 7833d12a9898c82d50716427144bf3276c22ab3f

Change-Id: Ib35eaa520ae886f3f8f550f9712fc3b139e00b60

6 years agouse ..deprecated directive w/ version in all cases
Mike Bayer [Tue, 8 Jan 2019 22:46:55 +0000 (17:46 -0500)] 
use ..deprecated directive w/ version in all cases

These changes should be ported from 1.3 back to 1.0 or
possibly 0.9 to the extent they are relevant in each
version. In 1.3 we hope to turn all deprecation documentation
into warnings.

Change-Id: I205186cde161af9389af513a425c62ce90dd54d8

6 years agocherry-pick changelog update for 1.2.17
Mike Bayer [Fri, 11 Jan 2019 15:15:39 +0000 (10:15 -0500)] 
cherry-pick changelog update for 1.2.17

6 years agocherry-pick changelog from 1.2.16
Mike Bayer [Fri, 11 Jan 2019 15:15:38 +0000 (10:15 -0500)] 
cherry-pick changelog from 1.2.16

6 years agohappy new year
Mike Bayer [Fri, 11 Jan 2019 15:06:10 +0000 (10:06 -0500)] 
happy new year

Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911

6 years agoLeave bytestring exception messages as bytestrings
Mike Bayer [Thu, 10 Jan 2019 17:03:40 +0000 (12:03 -0500)] 
Leave bytestring exception messages as bytestrings

Fixed a regression introduced in version 1.2 where a refactor
of the :class:`.SQLAlchemyError` base exception class introduced an
inappropriate coercion of a plain string message into Unicode under
python 2k, which is not handled by the Python interpreter for characters
outside of the platform's encoding (typically ascii).  The
:class:`.SQLAlchemyError` class now passes a bytestring through under
Py2K for ``__str__()`` as is the behavior of exception objects in general
under Py2K, does a safe coercion to unicode utf-8 with
backslash fallback for ``__unicode__()``.  For Py3K the message is
typically unicode already, but if not is again safe-coerced with utf-8
with backslash fallback for the ``__str__()`` method.

Fixes: #4429
Change-Id: I2289da3f2c45c7d0041fa43d838958f7614defc3

6 years agoMerge "Skip expression-based index reflection for SQLite"
mike bayer [Thu, 10 Jan 2019 02:07:24 +0000 (02:07 +0000)] 
Merge "Skip expression-based index reflection for SQLite"

6 years agoSkip expression-based index reflection for SQLite
Mike Bayer [Wed, 9 Jan 2019 16:42:02 +0000 (11:42 -0500)] 
Skip expression-based index reflection for SQLite

Reflection of an index based on SQL expressions are now skipped with a
warning, in the same way as that of the Postgresql dialect, where we currently
do not support reflecting indexes that have SQL expressions within them.
Previously, an index with columns of None were produced which would break
tools like Alembic.

Fixes: #4431
Change-Id: I1363ade912d206b42669331e2be2bb6f444b65a2

6 years agoRender correct DDL for unsetting table comments
Mike Bayer [Wed, 9 Jan 2019 16:18:02 +0000 (11:18 -0500)] 
Render correct DDL for unsetting table comments

Fixed issue where the DDL emitted for :class:`.DropTableComment`, which
will be used by an upcoming version of Alembic, was incorrect for the MySQL
and Oracle databases.

Fixes: #4436
Change-Id: I196de09495a37adface4caa9dcbc29a6d0ad159a

6 years agoUpdate index.rst - Added link to Drill dialect. 4432/head
Charles S. Givre [Tue, 8 Jan 2019 19:45:19 +0000 (14:45 -0500)] 
Update index.rst - Added link to Drill dialect.

Added link to Apache Drill dialect.

6 years agoPost black reformatting
Mike Bayer [Sun, 6 Jan 2019 06:19:47 +0000 (01:19 -0500)] 
Post black reformatting

Applied on top of a pure run of black -l 79 in
I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9,  this set of changes
resolves all remaining flake8 conditions for those codes
we have enabled in setup.cfg.

Included are resolutions for all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.

Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe

6 years agoRun black -l 79 against all source files
Mike Bayer [Sun, 6 Jan 2019 06:14:26 +0000 (01:14 -0500)] 
Run black -l 79 against all source files

This is a straight reformat run using black as is, with no edits
applied at all.

The black run will format code consistently, however in
some cases that are prevalent in SQLAlchemy code it produces
too-long lines.   The too-long lines will be resolved in the
following commit that will resolve all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.

Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9

6 years agoAssorted pre-Black fixes
Mike Bayer [Sun, 6 Jan 2019 03:42:08 +0000 (22:42 -0500)] 
Assorted pre-Black fixes

Fixes to the test suite, a few errant imports, and setup.py:

- mysql and postgresql have unused 'json' imports; remove
- postgresql is exporting the 'json' symbol, remove
- make sure setup.py can find __version__ using " or '
- retry logic in provision create database for postgresql fixed
- refactor test_magazine to use cls.tables rather than globals
- remove unused class in test_scoping
- add a comment to test_deprecations that this test suite itself
  is deprecated
- don't use mapper() and orm_mapper() in test_unitofwork, just
  use mapper()
- remove dupe test_scalar_set_None test in test_attributes
- Python 2.7 and above includes unittest.SkipTest, remove pre-2.7
  fallback
- use imported SkipTest in profiling
- declarative test_reflection tests with "reflectable_autoincrement"
  already don't run on oracle or firebird; remove conditional logic
  for these, which also removes an "id" symbol
- clean up test in test_functions, remove print statement
- remove dupe test_literal_processor_coercion_native_int_out_of_range
  in test/sql/test_types.py
- fix psycopg2_hstore ref

Change-Id: I7b3444f8546aac82be81cd1e7b6d8b2ad6834fe6

6 years agoPrep for flake8 refactoring
Mike Bayer [Fri, 4 Jan 2019 03:28:09 +0000 (22:28 -0500)] 
Prep for flake8 refactoring

a few code changes ahead of time to handle some __all__
issues better.  also include new flake8 rules, since the
existing flake8 doesn't pass in any case.

Change-Id: I1efdf75124ae7bcac719c22e505bb5b13db06c04