]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
5 years agoRun search and replace of symbolic module names
Mike Bayer [Tue, 14 Apr 2020 17:21:22 +0000 (13:21 -0400)] 
Run search and replace of symbolic module names

Replaces a wide array of Sphinx-relative doc references
with an abbreviated absolute form now supported by
zzzeeksphinx.

Change-Id: I94bffcc3f37885ffdde6238767224296339698a2

5 years agoMerge "Enable zzzeeksphinx module prefixes" into rel_1_3
mike bayer [Tue, 14 Apr 2020 17:04:43 +0000 (17:04 +0000)] 
Merge "Enable zzzeeksphinx module prefixes" into rel_1_3

5 years agoEnable zzzeeksphinx module prefixes
Mike Bayer [Sun, 12 Apr 2020 19:18:02 +0000 (15:18 -0400)] 
Enable zzzeeksphinx module prefixes

zzzeeksphinx 1.1.2 in git can now convert short
prefix names in a configured lookup to fully qualified module
names, so that
we can have succinct and portable pyrefs
that still resolve absolutely.
It also includes a formatter that will format all pyrefs
in a fully consistent way regardless of the package path,
by unconditionally removing all package tokens but always
leaving class names in place including for methods, which
means we no longer have to deal with tildes in pyrefs.

The most immediate goal of the absolute prefixes is
that we have lots of
"ambiguous" names that appear in muliple places, like select(),
ARRAY, ENUM etc.   With the incoming future packages there
is going to be lots of name overlap so it is necessary
that all names eventually use absolute package paths
when Sphinx receives them.

In multiple stages, pyrefs will be converted using the
zzzeeksphinx tools/fix_xrefs.py tool so that doclinks can
be made absolute using symbolic prefixes.

For this review, the actual search and replace of symbols
is not performed, instead some general cleanup to prepare
the docs as well as a lookup file used by the tool
to do the conversion.   this relatively small patch will
be backported
with appropriate changes to 1.3, 1.2, 1.1 and the tool
can then be run on each branch individually.  We are shooting
for almost no warnings at all for master (still a handful
I can't figure out which don't seem to have any impact)
, very few for 1.3,
and for 1.2 / 1.1 we hope for a significant reduction
in warnings.

Overall for all versions pyrefs should
always point to the correct target, if they are in fact
hyperlinked.  it's better for a ref to go nowhere and
be plain text than go to the wrong thing.  Right now,
hundreds of API links are pointing to the wrong thing
as they are ambiguous names such as refresh(), insert(),
update(), select(), join(), JSON etc. and Sphinx sends these all
to essesntially random destinations among as many as five
or six possible choices per symbol.  A shorthand system
that allows us to use absolute refs without having
to type out a full blown absoulte module is the only
way this is going to work, and we should ultimately
seek to abandon any use of prefix dot for lookups.  Everything
should be on an underscore token so at the very least the module
spaces can be reorganized without having to search and replace
the entire documentation every time.

Change-Id: I484a7329034af275fcdb322b62b6255dfeea9151
(cherry picked from commit d8d755ad619e2ee78f2c7cb60ae9a1feee4c6d76)

5 years agoAdjust changelog files for removed directories
Mike Bayer [Mon, 13 Apr 2020 22:39:47 +0000 (18:39 -0400)] 
Adjust changelog files for removed directories

unreleased_11 and unreleased_12 are gone so remove these

also there's no place for the 4065 file to go, this is an old
and very small change and it looks like the file was not published in any
case, so just remove it.

Change-Id: I2b890ac4c7142e7b4462a7f45d7caa856edf3d4f
(cherry picked from commit b289fb032ead703eb131ad1b0d0e0dcba8617ca3)

5 years agoSquashed commit of the following:
Mike Bayer [Mon, 13 Apr 2020 22:29:46 +0000 (18:29 -0400)] 
Squashed commit of the following:

commit 571da00f2c6fe905591b398a1e2fbc8ee2d05873
Author: jonathan vanasco <jonathan@2xlp.com>
Date:   Mon Apr 13 18:16:23 2020 -0400

    more examples, as suggested

commit c7b154eaf47719923c41498453571e04b6de1141
Author: jonathan vanasco <jonathan@2xlp.com>
Date:   Mon Apr 13 17:24:47 2020 -0400

    consolidating README

commit ff294507b664e9c414944a7509a0f71338957fbf
Author: jonathan vanasco <jonathan@2xlp.com>
Date:   Mon Apr 6 14:59:45 2020 -0400

    adding example readme

plus some mike changes

Change-Id: I09a11164df034ddcfe7c4e7d52308ea0b1ec509c
(cherry picked from commit 4e5b7e6e62461d2685c1586dbb4cb1db88ff4ab0)

5 years agoAdd missing definitions to glossary
Mike Bayer [Mon, 13 Apr 2020 19:24:23 +0000 (15:24 -0400)] 
Add missing definitions to glossary

improve formatting

Change-Id: Iea3b72187d7c8020e18babb72a53c39c5aeec68c
(cherry picked from commit 1b1fe518512441959f4ac9c9b715271e2b6d7977)

5 years agoMerge "A few adjustments for tests to succeed on python 3.5" into rel_1_3
mike bayer [Mon, 13 Apr 2020 15:29:36 +0000 (15:29 +0000)] 
Merge "A few adjustments for tests to succeed on python 3.5" into rel_1_3

5 years agoMerge "Add ``comment`` attribute to :class:`.Column` ``__repr__`` method." into rel_1_3
mike bayer [Mon, 13 Apr 2020 15:28:19 +0000 (15:28 +0000)] 
Merge "Add ``comment`` attribute to :class:`.Column` ``__repr__`` method." into rel_1_3

5 years agoA few adjustments for tests to succeed on python 3.5
Federico Caselli [Wed, 8 Apr 2020 18:54:26 +0000 (20:54 +0200)] 
A few adjustments for tests to succeed on python 3.5

Ported from Change-Id: Ia93ee1cb5c52e51e72eb0a24c100421c5157d04b

Change-Id: Ia1086d3013b74ef0b2b69381483a9501288853a9

5 years agoMerge "Use define_tables for IsOrIsNotDistinctFromTest" into rel_1_3
mike bayer [Mon, 13 Apr 2020 01:34:04 +0000 (01:34 +0000)] 
Merge "Use define_tables for IsOrIsNotDistinctFromTest" into rel_1_3

5 years agoAdd ``comment`` attribute to :class:`.Column` ``__repr__`` method.
Federico Caselli [Sat, 11 Apr 2020 18:52:12 +0000 (20:52 +0200)] 
Add ``comment`` attribute to :class:`.Column` ``__repr__`` method.

Fixes #4138

Change-Id: Iad3604ce054aaac36fc93d623ae5058852875d97

5 years agoFix almost all read-level sphinx warnings
Mike Bayer [Sat, 11 Apr 2020 17:53:41 +0000 (13:53 -0400)] 
Fix almost all read-level sphinx warnings

Partial backport of 43bcb0de1ecc1dc2abd7e7c3eb0c39f3eab9adc0.

Also enables sphinx multiprocess.

Change-Id: I49b1959b9a5fe84fb4c74366da2724284a804936

5 years agoUse define_tables for IsOrIsNotDistinctFromTest
Mike Bayer [Fri, 10 Apr 2020 20:58:41 +0000 (16:58 -0400)] 
Use define_tables for IsOrIsNotDistinctFromTest

In Ie8127ef29f1ec91e7afb88e1429538c27a321784 Mike
failed to notice that this test is build on TablesTest and
has just the one test function, which means the table is
built up by the fixture.

Change-Id: I855431bc976fe8ec96559ec1a22bb294aecf3c40
(cherry picked from commit e228b4143274152aae599b3dbbcaa4ad7178147b)

5 years agoMerge "Fix distinct_from test for Firebird et al." into rel_1_3
mike bayer [Fri, 10 Apr 2020 20:54:10 +0000 (20:54 +0000)] 
Merge "Fix distinct_from test for Firebird et al." into rel_1_3

5 years agoEvaluate fixes for cx_Oracle 8 API changes
Mike Bayer [Fri, 10 Apr 2020 16:23:32 +0000 (12:23 -0400)] 
Evaluate fixes for cx_Oracle 8 API changes

in [1] we have reported some behavioral changes in cx_Oracle
symbols.   As it is unclear if these are intended changes in
cx_Oracle, test workarounds for these changes against
cx_Oracle master.

[1] https://github.com/oracle/python-cx_Oracle/issues/415

Fixes: #5246
Change-Id: If63f92553c46484bf2b61b53a9e6d85cb08e800a
(cherry picked from commit 24137da80da879e7792f45302ae5c100524253be)

5 years agoRepair CTE a in b tests
Mike Bayer [Fri, 10 Apr 2020 18:28:54 +0000 (14:28 -0400)] 
Repair CTE a in b tests

In I27cac9bd265c86ff2a3381ff9f844f60ef991cfc we modernized
the default tests and converted the "a in b" CTE tests to combinations,
however apparently the existing tests were not testing all
combinations and had repeats instead.   The combinations
decorator has made this much easier to spot, so use
the correct combinations that were originally intended.

Change-Id: Icd904887bff00c31525497d0b1508fabaf052dc9
(cherry picked from commit 046934083bbf0193e29c990bed0527fdac56f9a8)

5 years agoModernize test_defaults
Mike Bayer [Thu, 9 Apr 2020 22:03:30 +0000 (18:03 -0400)] 
Modernize test_defaults

Use modern execution patterns, goal is so that these same tests
can work for the future engine

break sequence tests into test_sequences suite

sequence tests that are testing implicit execution patterns
at least move into their own suite that will go into test_deprecations
eventually.

Change-Id: I27cac9bd265c86ff2a3381ff9f844f60ef991cfc
(cherry picked from commit 4cadeaf6e68d71c2cb36219f72cc4d337e31df88)

5 years agoFix distinct_from test for Firebird et al.
Gord Thompson [Wed, 8 Apr 2020 11:40:36 +0000 (05:40 -0600)] 
Fix distinct_from test for Firebird et al.

Firebird (and perhaps others) allow us to CREATE TABLE inside a transaction but we can't INSERT INTO that table unless we COMMIT first.

Change-Id: Ie8127ef29f1ec91e7afb88e1429538c27a321784
(cherry picked from commit 10fb4d4d2f755d813993852b8cb9de3a9c0a2b3f)

5 years agoAdd github action workflow to run tests on master and on pr to master
Federico Caselli [Fri, 3 Apr 2020 18:11:24 +0000 (14:11 -0400)] 
Add github action workflow to run tests on master and on pr to master

Trying the pr to check if it works right away

<!-- Describe your changes in detail -->

<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #5222
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5222
Pull-request-sha: afbb8567525f3841554d3ba599ef4d713c78e647

Change-Id: I4981b02f900e76e446cf42e6cc6495ffc0883951
(cherry picked from commit c658540b9ae36e86a92e11667d3679ac1f3eac2e)

5 years agoVersion 1.3.17 placeholder
Mike Bayer [Wed, 8 Apr 2020 02:47:20 +0000 (22:47 -0400)] 
Version 1.3.17 placeholder

5 years ago- 1.3.16 rel_1_3_16
Mike Bayer [Wed, 8 Apr 2020 02:41:36 +0000 (22:41 -0400)] 
- 1.3.16

5 years agoMerge "Use dot-separated name resolution for relationship target" into rel_1_3
mike bayer [Wed, 8 Apr 2020 01:48:33 +0000 (01:48 +0000)] 
Merge "Use dot-separated name resolution for relationship target" into rel_1_3

5 years agoUse dot-separated name resolution for relationship target
Mike Bayer [Tue, 7 Apr 2020 21:37:14 +0000 (17:37 -0400)] 
Use dot-separated name resolution for relationship target

The string argument accepted as the first positional argument by the
:func:`.relationship` function when using the Declarative API is no longer
interpreted using the Python ``eval()`` function; instead, the name is dot
separated and the names are looked up directly in the name resolution
dictionary without treating the value as a Python expression.  However,
passing a string argument to the other :func:`.relationship` parameters
that necessarily must accept Python expressions will still use ``eval()``;
the documentation has been clarified to ensure that there is no ambiguity
that this is in use.

Fixes: #5238
Change-Id: Id802f403190adfab0ca034afe2214ba10fd9cfbb
(cherry picked from commit 17e31604ae13ebd58b148a4319cfed09e5448ee2)

5 years agoGracefully skip isolation level if no row returned
Mike Bayer [Tue, 7 Apr 2020 23:21:01 +0000 (19:21 -0400)] 
Gracefully skip isolation level if no row returned

Fixed issue in MySQL dialect when connecting to a psuedo-MySQL database
such as that provided by ProxySQL, the up front check for isolation level
when it returns no row will not prevent the dialect from continuing to
connect. A warning is emitted that the isolation level could not be
detected.

Fixes: #5239
Change-Id: I4a240386a0d38bd90733819495ce50e37fe2234c
(cherry picked from commit 978755e851e505e2715e71efcb51b0904ded9f80)

5 years agoBroaden is[not]_distinct_from support
Gord Thompson [Thu, 2 Apr 2020 17:51:11 +0000 (11:51 -0600)] 
Broaden is[not]_distinct_from support

Added support for .is[not]_distinct_from to SQL Server, MySQL, and Oracle.

Fixes: #5137
Change-Id: I3b4d3b199821a55687f83c9a5b63a95d07a64cd5
(cherry picked from commit 207e0b2fc0b36acca398b163c698412deec7077e)

5 years agoMerge "Replace engine.execute w/ context manager (step1)" into rel_1_3
mike bayer [Mon, 6 Apr 2020 21:57:11 +0000 (21:57 +0000)] 
Merge "Replace engine.execute w/ context manager (step1)" into rel_1_3

5 years agoEnsure length parameter of Enum is adapted to new objects
Mike Bayer [Mon, 6 Apr 2020 20:19:23 +0000 (16:19 -0400)] 
Ensure length parameter of Enum is adapted to new objects

Ensure length parameter added to Enum in
Iea05dc8cd9e33959bb968b394fb10a7dd068c873 is correctly propagated
to new enum objects adapted from this one.

Fixes: #5183
`

Change-Id: I7f20d926f73ec8260938963df87e29894c7e55e2
(cherry picked from commit 9243f6feea676bbaada52293d44e5d069b0f0574)

5 years agoMerge "Add length parameter in `Enum`" into rel_1_3
mike bayer [Mon, 6 Apr 2020 20:10:51 +0000 (20:10 +0000)] 
Merge "Add length parameter in `Enum`" into rel_1_3

5 years agoReplace engine.execute w/ context manager (step1)
Gord Thompson [Thu, 13 Feb 2020 19:14:42 +0000 (12:14 -0700)] 
Replace engine.execute w/ context manager (step1)

First (baby) step at replacing engine.execute
calls in test code with the new preferred way
of executing. MSSQL was targeted because it was
the easiest for me to test locally.

Change-Id: Id2e02f0e39007cbfd28ca6a535115f53c6407015
(cherry picked from commit 60f627cbd0d769e65353e720548efac9d8ab95d9)

5 years agoAdd length parameter in `Enum`
Federico Caselli [Tue, 24 Mar 2020 20:06:04 +0000 (21:06 +0100)] 
Add length parameter in `Enum`

The `Enum` type now supports the parameter `Enum.length`
to specify the length of the VARCHAR column to create when using
non native enums by setting `Enum.native_enum` to `False`

Fixes: #5183
Change-Id: Iea05dc8cd9e33959bb968b394fb10a7dd068c873
(cherry picked from commit 3e2af98adfdcbf33ff5d8c2da15962c001344d64)

5 years agoApply fix to ComputedReflectionFixtureTest
Gord Thompson [Sat, 4 Apr 2020 19:39:50 +0000 (13:39 -0600)] 
Apply fix to ComputedReflectionFixtureTest

Avoid errors for dialects without schema support.
Also fix typo in test name.

Fixes: #5230
Change-Id: Id0f759b591a6119069b0fc5fc3b02addb85b0597
(cherry picked from commit 50f1e1392a92f31f1f2d5110e6632bc5a32467e7)

5 years agoEnsure context.attrbutes dictionary is reset each time
Mike Bayer [Sat, 4 Apr 2020 21:18:46 +0000 (17:18 -0400)] 
Ensure context.attrbutes dictionary is reset each time

A memory growth issue was identified in this test which
caused the profiling results to be inaccurate.

Change-Id: I248dcce5833feada947bc91bdf09a8f925d31d65
(cherry picked from commit 139aac4aba98b170787a63f0f0ca785c1fdfc63b)

5 years agoKey subqueryloaders on the property object, not string key
Mike Bayer [Fri, 3 Apr 2020 20:00:22 +0000 (16:00 -0400)] 
Key subqueryloaders on the property object, not string key

Fixed bug in :func:`.orm.selectinload` loading option where two or more
loaders that represent different relationships with the same string key
name as referenced from a single :func:`.orm.with_polymorphic` construct
with multiple subclass mappers would fail to invoke each subqueryload
separately, instead making use of a single string-based slot that would
prevent the other loaders from being invoked.

Fixes: #5228
Change-Id: Id0d1db8029ca88c13c0068115fe673adb7a68407
(cherry picked from commit a32c528c541670c0c4469523a3964712d79b7edd)

5 years agoFix sqlite memory req
Mike Bayer [Mon, 30 Mar 2020 19:04:53 +0000 (15:04 -0400)] 
Fix sqlite memory req

this is only used by test/requirements.py right now for the
profiling tests but it was not returning the correct answer
during a regenerate operation.

Change-Id: Id9747b4fe562b8bea9b21c465b626b1b19e6956b
(cherry picked from commit 379e878c5854f8d0b4e65338571ba03986901ba8)

5 years agoRemove ORDER BY pk from subqueryload, selectinload
Mike Bayer [Mon, 30 Mar 2020 15:04:24 +0000 (11:04 -0400)] 
Remove ORDER BY pk from subqueryload, selectinload

Modified the queries used by subqueryload and selectinload to no longer
ORDER BY the primary key of the parent entity;  this ordering was there to
allow the rows as they come in to be copied into lists directly with a
minimal level of Python-side collation.   However, these ORDER BY clauses
can negatively impact the performance of the query as in many scenarios
these columns are derived from a subquery or are otherwise not actual
primary key columns such that SQL planners cannot make use of indexes. The
Python-side collation uses the native itertools.group_by() to collate the
incoming rows, and has been modified to allow multiple
row-groups-per-parent to be assembled together using list.extend(), which
should still allow for relatively fast Python-side performance.  There will
still be an ORDER BY present for a relationship that includes an explicit
order_by parameter, however this is the only ORDER BY that will be added to
the query for both kinds of loading.

Fixes: #5162
Change-Id: I8befd1303c1af7cc24cbf005f39bc01c8b2745f3
(cherry picked from commit f86ee556add28afd4de31c10fce56b00a0014a4e)

5 years agoString compiler can now literal compile datetime objects
Federico Caselli [Tue, 24 Mar 2020 21:55:46 +0000 (22:55 +0100)] 
String compiler can now literal compile datetime objects

Add ability to literal compile a :class:`DateTime`, :class:`Date`
or :class:"Time" when using the string dialect for debugging purposes.
This change does not impact real dialect implementation that retain
their current behavior.

Fixes: #5052
Change-Id: Ia3fad2be905c6d35b0106b9a2388c7508f067e90
(cherry picked from commit 83eb1b23cbe5a7ee0f2534256cf16f0f865bdbbb)

5 years agotypo: missing comma
michitaro.koike [Thu, 26 Mar 2020 07:09:42 +0000 (16:09 +0900)] 
typo: missing comma

(cherry picked from commit 2d4171ec8c85a468bdbdcf55e8d053b1586747ff)

5 years agoImplement autocommit isolation level for pysqlite
Gord Thompson [Sat, 22 Feb 2020 13:44:05 +0000 (06:44 -0700)] 
Implement autocommit isolation level for pysqlite

Fixes: #5164
Change-Id: I190b9de552dfed9f2a33babf82e42465ef09c82a
(cherry picked from commit 64e8303debd8064d7d9c01c3300cca5f54c02db1)

5 years agoReword changelog for issue #5207
Mike Bayer [Tue, 24 Mar 2020 16:51:53 +0000 (12:51 -0400)] 
Reword changelog for issue #5207

SQLAlchemy can remain using setuptools even when pep-517 is
the standard installation process.   We are omitting the file
for now because it leads to new pip installation issues that need
to be worked out in the greater pip community before SQLAlchemy
opts into this system.

Change-Id: I40b196100c6f16ae1291fcb7f8b5196bba14a300
(cherry picked from commit e12707263717161950e0c9817758d3240666ed83)

5 years agoImplement autocommit isolation level for cx_oracle
Gord Thompson [Thu, 12 Mar 2020 18:54:37 +0000 (12:54 -0600)] 
Implement autocommit isolation level for cx_oracle

As part of this change Oracle also gets the concept of a
default isolation level, however since Oracle does not provide a
fixed method of knowing what the isolation level would be without a
server side transaction actually in progress, for now we hardcode
just to "READ COMMITTED".

Enhanced the test suite for isolation level testing in the dialect
test suite and added features to requirements so that the supported
isolation levels can be reported generically for dialects.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #5200
Change-Id: I2c4d49da9ff80ccc228c21e196ec9a961de53478
(cherry picked from commit 1afca5823efe22c0f8cbc01455bafc573254ab55)

5 years agoTest instance for matching class hierarchy on get_from_identity
Mike Bayer [Sat, 21 Mar 2020 21:26:24 +0000 (17:26 -0400)] 
Test instance for matching class hierarchy on get_from_identity

Fixed issue where a lazyload that uses session-local "get" against a target
many-to-one relationship where an object with the correct primary key is
present, however it's an instance of a sibling class, does not correctly
return None as is the case when the lazy loader actually emits a load for
that row.

Fixes: #5210
Change-Id: I89f9946cfeba61d89a272435f76a5a082b1da30c
(cherry picked from commit 900402b9aa901bc9b1ae3f6b525f076076c52529)

5 years agoRemove pyproject.toml from distribution
Mike Bayer [Sat, 21 Mar 2020 14:16:47 +0000 (10:16 -0400)] 
Remove pyproject.toml from distribution

SQLAlchemy does not want to opt-in to pep-517 at this time
as this would require a custom build backend interface
which we have not built yet, and the standard is not
widely adopted at this time in any case.  Per
[1] [2], the presence of this file indicates a positive opt-in
to pep-517, so it must be omitted from source distributions.

[1] https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
[2] https://www.python.org/dev/peps/pep-0517/#id5

Fixes: #5207
Change-Id: If8d26a9edf942047920d273d8be778df7a018b3e
(cherry picked from commit f2a817dd7cde50988839750b9c2464675fb4f069)

5 years agoClarify Alembic vs. Migrate
Mike Bayer [Fri, 20 Mar 2020 20:40:47 +0000 (16:40 -0400)] 
Clarify Alembic vs. Migrate

Migrate is fully legacy at this point so continue to mention
it to provide clarity, but ensure it isn't suggested
as a real alternative.  It's unclear if Migrate will be able
to support SQLAlchemy 2.0.

Change-Id: Ia81aaccbd18f197ab533b083e87cc4d04ea05839
(cherry picked from commit a25e2e02e108551d2910171202fd91fdaeb8162c)

5 years agoEmphasize context managers when working with Core
Mike Bayer [Fri, 20 Mar 2020 19:21:10 +0000 (15:21 -0400)] 
Emphasize context managers when working with Core

Prep the main documentation for the changes coming up in 1.4
by first removing references to engine.execute() outside
of the "connectionless" section, and using context managers
in all cases.  For features that have always been confusing
and are going away, add a note that this feature will
be going away.

Change-Id: I94583444734e36f5432c32cb37f88a9fad15634a
(cherry picked from commit 376708f4a4958bf2559c14900c52aa6fc7fd05b3)

5 years agoCorrect misleading guidance on multiprocessing
Mike Bayer [Fri, 20 Mar 2020 15:17:47 +0000 (11:17 -0400)] 
Correct misleading guidance on multiprocessing

Link the connections intro to the dedicated section
on multiprocessing rather than stating that a separate
engine per process is needed, since this is inaccurate
and vague.

Change-Id: I48c66f88a90db918e864cd198c6aed335e28c7e6
(cherry picked from commit 491333858c46fae8c7f8d0ee6dec1be7c81b83da)

5 years agoDon't include PG INCLUDE columns as regular index columns
mike bayer [Wed, 18 Mar 2020 23:05:20 +0000 (19:05 -0400)] 
Don't include PG INCLUDE columns as regular index columns

Fixed issue where a "covering" index, e.g. those which have an  INCLUDE
clause, would be reflected including all the columns in INCLUDE clause as
regular columns.  A warning is now emitted if these additional columns are
detected indicating that they are currently ignored.  Note that full
support for "covering" indexes is part of :ticket:`4458`.  Pull request
courtesy Marat Sharafutdinov.

Fixes: #5205
Closes: #5206
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5206
Pull-request-sha: 512a3817bb21991142add2d192fa7ce9b285369d

Change-Id: I3196a2bf77dc5a6abd85b2fbf0ebff1b30d4fb00
(cherry picked from commit ee9bd719b7fc5f9ad34df8815ccca56d5a7a65cc)

5 years agoFix "special_key" attribute name in association proxy documentation
Mike Bayer [Tue, 17 Mar 2020 02:06:15 +0000 (22:06 -0400)] 
Fix "special_key" attribute name in association proxy documentation

Fixes: #5204
Change-Id: I1366be823d753bdcd92c98b948bdfa7960a27eb7
(cherry picked from commit 1768dd2a08dee92d73d160a5ba437df4ced37d2c)

5 years agoSupport inspection of computed column
Federico Caselli [Sat, 14 Mar 2020 12:57:42 +0000 (13:57 +0100)] 
Support inspection of computed column

Added support for reflection of "computed" columns, which are now returned
as part of the structure returned by :meth:`.Inspector.get_columns`.
When reflecting full :class:`.Table` objects, computed columns will
be represented using the :class:`.Computed` construct.

Also improve the documentation in :meth:`Inspector.get_columns`, correctly
listing all the returned keys.

Fixes: #5063
Fixes: #4051
Closes: #5064
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5064
Pull-request-sha: ba00fc321ce468f8885aad23b3dd33c789e50fbe

Change-Id: I789986554fc8ac7f084270474d0b2c12046b1cc2
(cherry picked from commit 62b7dace0c1d03acf3224085d03a03684a969031)

5 years agoFix tests failing for SQLite file databases; repair provisioning
Gord Thompson [Wed, 26 Feb 2020 19:50:01 +0000 (12:50 -0700)] 
Fix tests failing for SQLite file databases; repair provisioning

1. ensure provision.py loads dialect implementations when running
reap_dbs.py.   Reapers haven't been working since
598f2f7e557073f29563d4d567f43931fc03013f .

2. add some exclusion rules to allow the sqlite_file target to work;
add to tox.

3. add reap dbs target for SQLite, repair SQLite drop_db routine
which also wasn't doing the right thing for memory databases
etc.

4. Fix logging in provision files, as the main provision logger
is the one that's enabled by reap_dbs and maybe others, have all
the provision files use the provision logger.

Fixes: #5180
Fixes: #5168
Change-Id: Ibc1b0106394d20f5bcf847f37b09d185f26ac9b5
(cherry picked from commit 08fdf6da228aab54263abe043c21bcebf3513e72)

5 years agoDisable sqlite_file tests by default, take two
Mike Bayer [Fri, 13 Mar 2020 16:14:12 +0000 (12:14 -0400)] 
Disable sqlite_file tests by default, take two

We need no tests to run for sqlite_file until we merge
a full fix for it.   We'd like Jenkins to include this target.

Change-Id: I2737fa462572f08e2925b232a8f24d1ecd26b3ac
(cherry picked from commit 67e51ea5dcb3955105c35bf8149785bd72c7a521)

5 years agoInclude schema in all_tab_comments query
Mike Bayer [Fri, 13 Mar 2020 03:11:18 +0000 (23:11 -0400)] 
Include schema in all_tab_comments query

Fixed regression / incorrect fix caused by fix for :ticket:`5146` where the
Oracle dialect reads from the "all_tab_comments" view to get table comments
but fails to accommodate for the current owner of the table being
requested, causing it to read the wrong comment if multiple tables of the
same name exist in multiple schemas.

Fixes: #5146
Change-Id: Id79fbaa81b0e36cd4af60c48e4ab35c593ace057
(cherry picked from commit f1429823d31c56b589017e60328f826f5e721f0e)

5 years agoDont raise on pytest deprecation warnings
Mike Bayer [Thu, 12 Mar 2020 23:44:37 +0000 (19:44 -0400)] 
Dont raise on pytest deprecation warnings

py.test 5.4.0 emits deprecation warnings for pytest.Class.
make sure we don't raise for these, and log the code that will
be used for 5.4.0 when we bump requirements.

Fixes: #5201
Change-Id: I83e0402c4a6b2365a63b58d052c6989df3a37328
(cherry picked from commit be26fd13c124d5d53496cca98ce371c45c07c205)

5 years agoRemove trailing slashes in pre-commit config
Mike Bayer [Thu, 12 Mar 2020 00:47:25 +0000 (20:47 -0400)] 
Remove trailing slashes in pre-commit config

See https://github.com/sqlalchemy/dogpile.cache/pull/176

Change-Id: Id9a75546d4d0eae93ad837a77c6ffa9249efff5c
(cherry picked from commit f8a037aa822415d10f0ca8b8be0bb06d49f03d10)

5 years agoFix link in docs of query_expression and with_expression
Federico Caselli [Wed, 11 Mar 2020 18:09:41 +0000 (19:09 +0100)] 
Fix link in docs of query_expression and with_expression

Ref #5198

Change-Id: I566c2f7bbe08e9017e09e133079bef1c38469595
(cherry picked from commit 4cf10e7deb15dc3c5424a209fd243ca760bbbb8b)

5 years agoVersion 1.3.16 placeholder
Mike Bayer [Wed, 11 Mar 2020 16:36:59 +0000 (12:36 -0400)] 
Version 1.3.16 placeholder

5 years ago- 1.3.15 rel_1_3_15
Mike Bayer [Wed, 11 Mar 2020 16:29:27 +0000 (12:29 -0400)] 
- 1.3.15

5 years agoRepair broken call to sys.exc_info()
Mike Bayer [Wed, 11 Mar 2020 14:41:12 +0000 (10:41 -0400)] 
Repair broken call to sys.exc_info()

Fixed regression in 1.3.14 due to :ticket:`4849` where a sys.exc_info()
call failed to be invoked correctly when a flush error would occur. Test
coverage has been added for this exception case.

Fixes: #5196
Change-Id: Ib59a58a3a9d4c9c6f4b751201b794816a9f70225
(cherry picked from commit ceba13d4be5e73fed4522d6f66ab4c54f60fd983)

5 years agoReword implicit left join error; ensure deterministic FROM for columns
Mike Bayer [Tue, 10 Mar 2020 22:48:42 +0000 (18:48 -0400)] 
Reword implicit left join error; ensure deterministic FROM for columns

Adjusted the error message emitted by :meth:`.Query.join` when a left hand
side can't be located that the :meth:`.Query.select_from` method is the
best way to resolve the issue.  Also, within the 1.3 series, used a
deterministic ordering when determining the FROM clause from a given column
entity passed to :class:`.Query` so that the same expression is determined
each time.

Fixes: #5194
Change-Id: I2e4065fd31e98c57edf2f11d5e831be44d2c1ea2
(cherry picked from commit 7d8c64f9087bcde14dc641fe75f93a04823b86d6)

5 years agoVersion 1.3.15 placeholder
Mike Bayer [Tue, 10 Mar 2020 15:57:23 +0000 (11:57 -0400)] 
Version 1.3.15 placeholder

5 years ago- 1.3.14 rel_1_3_14
Mike Bayer [Tue, 10 Mar 2020 15:40:08 +0000 (11:40 -0400)] 
- 1.3.14

5 years agoReflect comments from any table accessible by the current user
Gord Thompson [Mon, 9 Mar 2020 21:50:53 +0000 (17:50 -0400)] 
Reflect comments from any table accessible by the current user

Fixed a reflection bug where table comments could only be retrieved for
tables actually owned by the user but not for tables visible to the user
but owned by someone else.  Pull request courtesy Dave Hirschfeld.

Fixes: #5146
Closes: #5147
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5147
Pull-request-sha: 0651e3bed05923765203b37986a2506dac3e634e

Change-Id: If970fda10d6adf04d926d38df1a567df1de9f7b9
(cherry picked from commit 0c294d356f7cbb22a8da3fc4552a9c4232c3f69a)

5 years agoFix comment re: ODBC driver name on Windows.
Gord Thompson [Fri, 27 Dec 2019 20:39:23 +0000 (13:39 -0700)] 
Fix comment re: ODBC driver name on Windows.

(cherry picked from commit 57fa3c067083a7d5a67301a251e5cd492865401c)

5 years agoClean up list of external dialects
Gord Thompson [Fri, 6 Mar 2020 23:49:22 +0000 (16:49 -0700)] 
Clean up list of external dialects

Fixes: #5190
Change-Id: I3636eeda08bfaa882477397a4cd8064820d25356
(cherry picked from commit 07e1d473c01776640a4e79a54e3cd122a9375d83)

5 years agoRender VALUES within composed MySQL on duplicate key expressions
Mike Bayer [Wed, 4 Mar 2020 22:44:40 +0000 (17:44 -0500)] 
Render VALUES within composed MySQL on duplicate key expressions

Fixed issue in MySQL :meth:`.mysql.Insert.on_duplicate_key_update` construct
where using a SQL function or other composed expression for a column argument
would not properly render the ``VALUES`` keyword surrounding the column
itself.

Fixes: #5173
Change-Id: I16d39c2fdb8bbb7f3d1b2ffdd20e1bf69359ab75
(cherry picked from commit 57b2aae0d9efe91c2338e5a762e04366f86c2651)

5 years agoMerge "Don't import provision.py unconditionally" into rel_1_3
mike bayer [Wed, 4 Mar 2020 21:07:10 +0000 (21:07 +0000)] 
Merge "Don't import provision.py unconditionally" into rel_1_3

5 years agofix typo in PickleType documentation
Federico Caselli [Wed, 4 Mar 2020 12:48:30 +0000 (13:48 +0100)] 
fix typo in PickleType documentation

(cherry picked from commit f9753f5c8f7c4427fa7b21076d3f46177afbfcd0)

5 years agoDon't import provision.py unconditionally
Mike Bayer [Tue, 3 Mar 2020 21:03:39 +0000 (16:03 -0500)] 
Don't import provision.py unconditionally

Removed the imports for provision.py from each dialect
and instead added a call in the central provision.py to
a new dialect level method load_provisioning().  The
provisioning registry works in the same way, so an existing
dialect that is using the provision.py system right now
by importing it as part of the package will still continue to
function.  However, to avoid pulling in the testing package when
the dialect is used in a non-testing context, the new hook may be
used.   Also removed a module-level dependency
of the testing framework on the orm package.

Revised an internal change to the test system added as a result of
:ticket:`5085` where a testing-related module per dialect would be loaded
unconditionally upon making use of that dialect, pulling in SQLAlchemy's
testing framework as well as the ORM into the module import space.   This
would only impact initial startup time and memory to a modest extent,
however it's best that these additional modules aren't reverse-dependent on
straight Core usage.

Fixes: #5180
Change-Id: I6355601da5f6f44d85a2bbc3acb5928559942b9c
(cherry picked from commit 598f2f7e557073f29563d4d567f43931fc03013f)

5 years agoRestore crud flags if visiting_cte is set
Mike Bayer [Tue, 3 Mar 2020 22:22:30 +0000 (17:22 -0500)] 
Restore crud flags if visiting_cte is set

Fixed bug where a CTE of an INSERT/UPDATE/DELETE that also uses RETURNING
could then not be SELECTed from directly, as the internal state of the
compiler would try to treat the outer SELECT as a DELETE statement itself
and access nonexistent state.

Fixes: #5181
Change-Id: Icba76f2148c8344baa1c04bac4ab6c6d24f23072
(cherry picked from commit 7fe400f54632835695f7b98f0c1a54424953dfad)

5 years agoRun handle_error for any exceptions raised in execute_context()
Mike Bayer [Wed, 4 Mar 2020 00:15:55 +0000 (19:15 -0500)] 
Run handle_error for any exceptions raised in execute_context()

Observing a SQLite connection/cursor being hung on
test_resultset -> PositionalTextTest -> test_dupe_col_obj.
this uses connectionless execution and the result object
fails to be constructed.  When that happens, there is no path
for the cursor or connection to be closed / released.
Recent changes with the exception assertions in #4849 seem to
be causing a cycle to last a little longer than usual which
is exposing this issue for one particular test on SQLite.

As we want to get rid of weakref cleanup, evaluate
why we dont have handle_dbapi_exception for this whole
block, as after_cursor_execute can raise, result construction
can raise, autocommit can raise, close can raise, there
does not seem to be a reason these things should be outside
of the block that gets cleaned up.

Fixes: #5182
Change-Id: I640ac55e8c5f39d287f779fbb5dc0ab727218ca3
(cherry picked from commit 4cd33f18a21d9e33b37ef7163822c327453d1e62)

5 years agoMerge "Ensure all nested exception throws have a cause" into rel_1_3
mike bayer [Tue, 3 Mar 2020 17:30:20 +0000 (17:30 +0000)] 
Merge "Ensure all nested exception throws have a cause" into rel_1_3

5 years agoInclude column_property composition examples
Mike Bayer [Tue, 3 Mar 2020 13:58:35 +0000 (08:58 -0500)] 
Include column_property composition examples

Add cross-linking between column_property() and ColumnProperty

Add section to describe using .expression

remove inherited-members from ColumnProperty to greatly
decrease verbosity

Fixes: #5179
Change-Id: Ic477b16350dbf551100b31d14ff3ba8ba8221a43
(cherry picked from commit 4c81d99bab0e884473abfcb573772aa5d94264c7)

5 years agoEnsure all nested exception throws have a cause
Mike Bayer [Sat, 29 Feb 2020 19:40:45 +0000 (14:40 -0500)] 
Ensure all nested exception throws have a cause

Applied an explicit "cause" to most if not all internally raised exceptions
that are raised from within an internal exception catch, to avoid
misleading stacktraces that suggest an error within the handling of an
exception.  While it would be preferable to suppress the internally caught
exception in the way that the ``__suppress_context__`` attribute would,
there does not as yet seem to be a way to do this without suppressing an
enclosing user constructed context, so for now it exposes the internally
caught exception as the cause so that full information about the context
of the error is maintained.

Fixes: #4849
Change-Id: I55a86b29023675d9e5e49bc7edc5a2dc0bcd4751
(cherry picked from commit 8be0dae77a7e0747f0d0fb4282db4aea7f41e03a)

5 years agoUpdate dialect API documentation
Mike Bayer [Mon, 2 Mar 2020 15:28:32 +0000 (10:28 -0500)] 
Update dialect API documentation

The docstrings for connect() and on_connect() were incorrect
between Dialect vs. DefaultDialect.   Redocumented related
methods, clean up formatting, and remove unicode-related
attribute descriptions from the top level Dialect document
as these don't apply to Python 3.

Change-Id: I45baab757f8e20627eba42c30b9e8dbe26356275
(cherry picked from commit 649de79950dcf952d7a44069faf36925c23c4e63)

5 years agoWhile parsing for check constraints, ignore newline characters in the check condition
Eric Borczuk [Fri, 28 Feb 2020 16:05:13 +0000 (11:05 -0500)] 
While parsing for check constraints, ignore newline characters in the check condition

Fixed bug where PostgreSQL reflection of CHECK constraints would fail to
parse the constraint if the SQL text contained newline characters. The
regular expression has been adjusted to accommodate for this case. Pull
request courtesy Eric Borczuk.

Fixes: #5170
Closes: #5172
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5172
Pull-request-sha: 5701b7f09f723b727bbee95d19d107d6cc1d7717

Change-Id: If727e9140b645e8b685c3476fb0fa4417c1e6526
(cherry picked from commit 0fe528483afeb53300ff7a9770f7fb9c81a3a874)

5 years agoRemove print statement in favor of print() function in docs and examples
Albert Tugushev [Wed, 26 Feb 2020 16:09:29 +0000 (11:09 -0500)] 
Remove print statement in favor of print() function in docs and examples

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
<!-- Describe your changes in detail -->
Remove print statements

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [X] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [ ] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #5166
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5166
Pull-request-sha: 04a7394f71298322188f0861b4dfe93e5485839d

Change-Id: Ib90a59fac929661a18748c6e44966fb87e3978c6
(cherry picked from commit a836e3df5d973f75bd8330cecb76511b67c13612)

5 years agoRemove needless clauseelement check for batch
Mike Bayer [Mon, 24 Feb 2020 19:45:38 +0000 (14:45 -0500)] 
Remove needless clauseelement check for batch

Also document more detail as to why SQL expression support
is not turned on for batch.

Fixes: #5165
Change-Id: Ia93bbf75f22b8781400086c45b86a60ef9cec360
(cherry picked from commit 88c23da948e76b1c273b6c48389d6671878696eb)

5 years agoRemove unnecessary tuple; prepare for "iterator" verbiage
Mike Bayer [Thu, 20 Feb 2020 14:01:36 +0000 (09:01 -0500)] 
Remove unnecessary tuple; prepare for "iterator" verbiage

Remove a tuple surrounding a generator expression that
is immediately iterated in any case.   Additionally
note that the bulk methods can likely accept non-list
objects such as arbitrary iterables, however without test
coverage this is not yet guaranteed; use the term "sequence"
for now.

Fixes: #5163
Change-Id: If838fe214da574763115855c1a65171533c96e64
(cherry picked from commit 2db6f20752fd37cbaaad721c74ebfc34675923f4)

5 years agoMerge "Pass DDLCompiler IdentifierPreparer to visit_ENUM" into rel_1_3
mike bayer [Mon, 17 Feb 2020 22:16:47 +0000 (22:16 +0000)] 
Merge "Pass DDLCompiler IdentifierPreparer to visit_ENUM" into rel_1_3

5 years agoMerge "Limit non-backend critical profiling tests to SQLite" into rel_1_3
mike bayer [Mon, 17 Feb 2020 22:14:21 +0000 (22:14 +0000)] 
Merge "Limit non-backend critical profiling tests to SQLite" into rel_1_3

5 years agoMerge "Begin to disallow back_populates with viewonly=True" into rel_1_3
mike bayer [Mon, 17 Feb 2020 21:01:55 +0000 (21:01 +0000)] 
Merge "Begin to disallow back_populates with viewonly=True" into rel_1_3

5 years agoLimit non-backend critical profiling tests to SQLite
Mike Bayer [Mon, 17 Feb 2020 16:51:33 +0000 (11:51 -0500)] 
Limit non-backend critical profiling tests to SQLite

issues with backend-specific profiling should be limited
to tests that are explcitly against resultset, compiler, etc.

MySQL in particular has an often varying callcount that isn't
worth running these tests against nor is it worth profiling
them for other backends like Oracle and SQL Server.

Also add the REQUIRE_SQLALCHEMY_CEXT flag to
the regen_callcounts.tox.ini script, which is part of some review
somewhere but is needed here to generate callcounts correctly.

Add a "warmup" phase for some of the ORM tests for join conditions
that have varying profile counts based on whether mappings have been
used already or not; profiling should always be against the
"warmed up" version of a function.

Change-Id: If483820235fa4cc4360cbd067a9b68d83512d587
(cherry picked from commit 386012597b9e7aa2a7f987930d00b892ed54121d)

5 years agoPass DDLCompiler IdentifierPreparer to visit_ENUM
Mike Bayer [Mon, 17 Feb 2020 20:21:59 +0000 (15:21 -0500)] 
Pass DDLCompiler IdentifierPreparer to visit_ENUM

Fixed issue where the "schema_translate_map" feature would not work with a
PostgreSQL native enumeration type (i.e. :class:`.Enum`,
:class:`.postgresql.ENUM`) in that while the "CREATE TYPE" statement would
be emitted with the correct schema, the schema would not be rendered in
the CREATE TABLE statement at the point at which the enumeration was
referenced.

Fixes: #5158
Change-Id: I41529785de2e736c70a142c2ae5705060bfed73e
(cherry picked from commit 89b8c343ed6247a562e0bcd53ef3fc180d0d4e46)

5 years agoFurther refine fractional seconds datetimeoffset fixture
Mike Bayer [Mon, 17 Feb 2020 14:41:59 +0000 (09:41 -0500)] 
Further refine fractional seconds datetimeoffset fixture

in 55f6d61e85b7f16df0b77f1c55a4fb051cd696e3 we still
forgot to accommodate for Python 3 timezone constructor
rejecting fractional minutes so the test further needs lambdas
to prevent the constructor from invoking for Python versions
less than 3.7

Change-Id: I02a83888f5ffbbe53ed0ce16c46a70942add4a3c
(cherry picked from commit a8b4ea8819e08c0eaa74b53385a91c22916401c7)

5 years agoUpdate test reqs for mariadb 10.4, 10.5
Mike Bayer [Sun, 16 Feb 2020 17:01:17 +0000 (12:01 -0500)] 
Update test reqs for mariadb 10.4, 10.5

A few except / union tests seem to be passing on these two
versions which are now up on CI.

Change-Id: I0d65795357a6d03962d7182dda198d890a4c3f97
(cherry picked from commit 2f27dd35020be46b35717cffdccaefc97b5f67dd)

5 years agoFractional seconds starts at Python 3.7
Mike Bayer [Thu, 13 Feb 2020 20:43:05 +0000 (15:43 -0500)] 
Fractional seconds starts at Python 3.7

CI didn't notice that the fractional seconds in the new SQL Server
DATETIMEOFFSET test are not available on Python 3.6. It was
inadvertently assumed this was a Python 2 incompatibility.

Change-Id: I9839eafbf7c37512eef1ecf666846983f9651c02
(cherry picked from commit 55f6d61e85b7f16df0b77f1c55a4fb051cd696e3)

5 years agoImprove ResultProxy/Row documentation before the API change
Mike Bayer [Thu, 13 Feb 2020 17:48:26 +0000 (12:48 -0500)] 
Improve ResultProxy/Row documentation before the API change

We'd like to merge Ieb9085e9bcff564359095b754da9ae0af55679f0,
however the documentation in that change should be based off
of more comprehensive documentation than what we have already.

Add the notion of "row" to the tutorial and document all
methods.   This will also be backported at least to 1.3
in terms of RowProxy.

Change-Id: I2173aecc86cf15c5a7c473b8f471639ee9082f84
(cherry picked from commit 8fabe50d7a47b50215a7ea4cf1d39409d9529e51)

5 years agoBegin to disallow back_populates with viewonly=True
Mike Bayer [Tue, 11 Feb 2020 17:51:46 +0000 (12:51 -0500)] 
Begin to disallow back_populates with viewonly=True

A viewonly=True relationship should not be mutated and ideally
mutation itself would raise an error, but we're not there yet.
Warn when a viewonly is to be the target of a back_populates
as this only means that it should be locally mutated, which
by definition will not work as expected because post-flush
it will deliver doubled results, due to its state not being
reset.

Setting a relationship to viewonly=True which is also the target of a
back_populates or backref configuration will now emit a warning and
eventually be disallowed. back_populates refers specifically to mutation
of an attribute or collection, which is disallowed when the attribute is
subject to viewonly=True.   The viewonly attribute is not subject to
persistence behaviors which means it will not reflect correct results
when it is locally mutated.

Fixes: #5149
Change-Id: Ie51382a82e1a0ff5f3cf2cdbded780e77ace7f5f
(cherry picked from commit 4376c2e5b016e8dfec7bc1b0d2ebbebae737c063)

5 years agoFix handling of None as parameter for a datetimeoffset column
Gord Thompson [Mon, 3 Feb 2020 23:42:45 +0000 (16:42 -0700)] 
Fix handling of None as parameter for a datetimeoffset column

Fixed issue where the :class:`.mssql.DATETIMEOFFSET` type would not
accommodate for the ``None`` value, introduced as part of the series of
fixes for this type first introduced in :ticket:`4983`, :ticket:`5045`.
Additionally, added support for passing a backend-specific date formatted
string through this type, as is typically allowed for date/time types on
most other DBAPIs.

Fixes: #5132
Change-Id: Iab05d67382e0f550474d50e0c3c1c888521b678a
(cherry picked from commit 532ddb0fa717bc10c3a95b7ddf3a60bbfad7ac56)

5 years agoRework combination exclusions
Mike Bayer [Mon, 10 Feb 2020 20:38:39 +0000 (15:38 -0500)] 
Rework combination exclusions

The technique arrived at for doing exclusions inside of combinations
relies upon comparing all the arguments in a particular combination
to some set of combinations that were gathered as having
"exclusions".   This logic is actually broken for the
case where the @testing.combinations has an "id", but if we fix
that, we still have the issue of all the arguments being
compared, which is complicated and also doesn't work for the
case of a py2/py3 incompatibility like a timezone that has
fractional minutes or seconds in it.   It's also not clear
if a @testing.combinations that uses lambdas will work either
(maybe it does though because lambdax == lambdax compares...).

anyway, this patch reworks it so that we hit this on the decorator
side instead, where we add our own decorator and go through
the extra effort to create a decorator that accepts an extra
argument of "exclusions" which we can then check in a way that
is local to the whole pytest @combinations thing in the first place.
The only difficulty is that pytest is very sneaky about looking
at the test function so we need to make sure __wrapped__ isn't
set when doing this.

Change-Id: Ic57aae15b378e0f4ed009e4e82ae7ba73fb6dfc5
(cherry picked from commit 12ec0e06858d84097a051a50a60fe9a1582ee95c)

5 years agoFixes for public_factory and mysql/pg dml functions
Mike Bayer [Sat, 8 Feb 2020 19:53:21 +0000 (14:53 -0500)] 
Fixes for public_factory and mysql/pg dml functions

* ensure that the location indicated by public_factory is
  importable

* adjust all of sqlalchemy.sql.expression locations to be correct

* support the case where a public_factory is against a function
  that has another public_factory already, and already replaced the
  __init__ on the target class

* Use mysql.insert(), postgresql.insert(), don't include .dml in the
  class path.

Change-Id: Iac285289455d8d7102349df3814f7cedc758e639
(cherry picked from commit 660ff51df0433607b12c58a12c7355107c1773f5)

5 years agoVendor inspect.formatannotation
Mike Bayer [Fri, 7 Feb 2020 22:55:07 +0000 (17:55 -0500)] 
Vendor inspect.formatannotation

Vendored the ``inspect.formatannotation`` function inside of
``sqlalchemy.util.compat``, which is needed for the vendored version of
``inspect.formatargspec``.  The function is not documented in cPython and
is not guaranteed to be available in future Python versions.

Fixes: #5138
Change-Id: I76bdddc28507fb1b4403f1b718d6f9cc2fb6d93c
(cherry picked from commit 47aa62abde6eba67802f2f7126cc79fbd95b5d1a)

5 years agoUpdate basic_relationships.rst
randallk [Mon, 20 Jan 2020 00:11:44 +0000 (17:11 -0700)] 
Update basic_relationships.rst

Fix relationship used in doc.

(cherry picked from commit 698a279c918b2d037fc49700c51126d624db777a)

5 years agoDocument SQLite "mixed binary" behavior
Mike Bayer [Thu, 6 Feb 2020 15:26:50 +0000 (10:26 -0500)] 
Document SQLite "mixed binary" behavior

The Pysqlite driver can store a string value with
or without an indicator that the value is to be retrieved
as bytes or as a unicode string object.    To suit the
use case where a SQLite database has mixed values on a row
by row basis, provide a recipe for a MixedBinary datatype.

Change-Id: I9a166bd6fc673d8d46a53ab9697cb3d412e5fcee
References: #5073
(cherry picked from commit ee1d914888113ceb9928ece6e0a715c813bdfcfa)

5 years agoAdd second section detailing cascade_backrefs to backref section
Mike Bayer [Tue, 4 Feb 2020 21:46:49 +0000 (16:46 -0500)] 
Add second section detailing cascade_backrefs to backref section

We only have docs for "cascade_backrefs" in the session->cascades
documentation, when this really should be mentioned in the chapter
that's all about backrefs.  Add a similar section and link to the
original for further detail.

Fixes: #5130
Change-Id: I58b6dcafd4ce43e4b9ebd86a40123502c01d4e39
(cherry picked from commit e48c685933b3b6f405134b5cb74f488075ae585d)

5 years agoWarn for runid changing in load events; add restore_load_context flag
Mike Bayer [Fri, 31 Jan 2020 16:10:08 +0000 (11:10 -0500)] 
Warn for runid changing in load events; add restore_load_context flag

Added a new flag :paramref:`.InstanceEvents.restore_load_context` and
:paramref:`.SessionEvents.restore_load_context` which apply to the
:meth:`.InstanceEvents.load`, :meth:`.InstanceEvents.refresh`, and
:meth:`.SessionEvents.loaded_as_persistent` events, which when set will
restore the "load context" of the object after the event hook has been
called.  This ensures that the object remains within the "loader context"
of the load operation that is already ongoing, rather than the object being
transferred to a new load context due to refresh operations which may have
occurred in the event. A warning is now emitted when this condition occurs,
which recommends use of the flag to resolve this case.  The flag is
"opt-in" so that there is no risk introduced to existing applications.

The change additionally adds support for the ``raw=True`` flag to
session lifecycle events.

Fixes: #5129
Change-Id: I2912f48ac8c5636297d63ed383454930e8e9a6a3
(cherry picked from commit 10b7937bb9994c365436af5e0c1931b2b07d12b1)

5 years agoMerge "Accommodate for base class when adjusting path for with_polymorphic" into...
mike bayer [Tue, 28 Jan 2020 20:51:54 +0000 (20:51 +0000)] 
Merge "Accommodate for base class when adjusting path for with_polymorphic" into rel_1_3

5 years agoMerge "Add py3.8, py3.9 token to setup.py" into rel_1_3
mike bayer [Tue, 28 Jan 2020 20:48:57 +0000 (20:48 +0000)] 
Merge "Add py3.8, py3.9 token to setup.py" into rel_1_3

5 years agoAccommodate for base class when adjusting path for with_polymorphic
Mike Bayer [Tue, 28 Jan 2020 17:34:06 +0000 (12:34 -0500)] 
Accommodate for base class when adjusting path for with_polymorphic

Fixed an additional regression in the same area as that of :ticket:`5080`
introduced in 1.3.0b3 via :ticket:`4468` where the ability to create a
joined option across a :func:`.with_polymorphic` into a relationship
against the base class of that with_polymorphic, and then further into
regular mapped relationships would fail as the base class component would
not add itself to the load path in a way that could be located by the
loader strategy. The changes applied in :ticket:`5080` have been further
refined to also accommodate this scenario.

Fixes: #5121
Change-Id: I9753dbbcb7b7640c995ad983a6d04b36fa18cf54
(cherry picked from commit c9406e58a4fd2de4bb2fd53530e04cc9fc786cbf)

5 years agoAdd pyproject
Federico Caselli [Mon, 27 Jan 2020 21:51:05 +0000 (16:51 -0500)] 
Add pyproject

- Added pyproject.toml with black arguments
- Updated black version in precommit hook
- Reformatted the code

Fixes: #5100
Closes: #5103
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5103
Pull-request-sha: 795fd5f896be4a07a2b18e6525674b815ac17593

Change-Id: I14eedbaa51fb531cbf90fcefe6a1e07c8a565625
(cherry picked from commit f49a3fc02c03e39b3d34da9dfba4fe46d71c4aff)

5 years agoAdd py3.8, py3.9 token to setup.py
Gord Thompson [Mon, 27 Jan 2020 21:49:28 +0000 (16:49 -0500)] 
Add py3.8, py3.9 token to setup.py

Fixes: #5113
<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
Add py3.8 and py3.9 tokens to setup.py

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #5115
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5115
Pull-request-sha: 5ae662f1ec0d89a16a03fe60d6f12712d0d21398

Change-Id: I1313df9bd117b1356c1d06d588e8e04a07ba4e39
(cherry picked from commit 9a7c65c908dc00b66e10205d5a039a2b578f116e)