]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
5 years agoInstanceState default path is RootRegistry, not tuple
Mike Bayer [Wed, 22 Jan 2020 21:27:26 +0000 (16:27 -0500)] 
InstanceState default path is RootRegistry, not tuple

Fixed regression caused in 1.3.13 by :ticket:`5056` where a refactor of the
ORM path registry system made it such that a path could no longer be
compared to an empty tuple, which can occur in a particular kind of joined
eager loading path.   The "empty tuple" use case has been resolved so that
the path registry is compared to a path registry in all cases;  the
:class:`.PathRegistry` object itself now implements ``__eq__()`` and
``__ne__()`` methods which will take place for all equality comparisons and
continue to succeed in the not anticipated case that a non-
:class:`.PathRegistry` object is compared, while emitting a warning that
this object should not be the subject of the comparison.

Fixes: #5110
Change-Id: I6cab6cd771c131d12b17939b369212f12c6bee16

5 years agocherry-pick changelog update for 1.3.14
Mike Bayer [Wed, 22 Jan 2020 16:57:04 +0000 (11:57 -0500)] 
cherry-pick changelog update for 1.3.14

5 years agocherry-pick changelog from 1.3.13
Mike Bayer [Wed, 22 Jan 2020 16:57:04 +0000 (11:57 -0500)] 
cherry-pick changelog from 1.3.13

5 years agoMerge "Reorganize core event modules to avoid import cycles"
mike bayer [Wed, 22 Jan 2020 16:30:22 +0000 (16:30 +0000)] 
Merge "Reorganize core event modules to avoid import cycles"

5 years agoClarify documentation for lazy_loaded_from
Mike Bayer [Wed, 22 Jan 2020 16:01:59 +0000 (11:01 -0500)] 
Clarify documentation for lazy_loaded_from

This attribute was never available in conjunction with
mapper options, and additionally the use of baked queries
in the lazy loader strategy prevent this attribute from
being reliably available within the before_compile hook
unless baked queries are turned off entirely.

Fixes: #5109
Change-Id: I5fa12c68463d20475e7470647a784efe846b8af7

5 years agoReorganize core event modules to avoid import cycles
Mike Bayer [Tue, 21 Jan 2020 23:41:48 +0000 (18:41 -0500)] 
Reorganize core event modules to avoid import cycles

sqlalchemy.sql.naming was causing a full import of
engine due to the DDLEvents dependency.  Break out pool,
DDL and engine events into new modules specific to those
packages; resolve some other import cycles in Core also.

Change-Id: Ife8d217e58a26ab3605dd80ee70837968f957eaf

5 years agoAdjust natural path to relationship's base mapper for aliased class also
Mike Bayer [Mon, 20 Jan 2020 17:41:22 +0000 (12:41 -0500)] 
Adjust natural path to relationship's base mapper for aliased class also

Fixed regression in loader options introduced in 1.3.0b3 via :ticket:`4468`
where the ability to create a loader option using
:meth:`.PropComparator.of_type` targeting an aliased entity that is an
inheriting subclass of the entity which the preceding relationship refers
to would fail to produce a matching path.   See also :ticket:`5082` fixed
in this same release which involves a similar kind of issue.

Fixes: #5107
Change-Id: I5c6717b925060c3f8da42190d1f00d05248befd8

5 years agoImprove regex parsing of CHECK constraints for PostgreSQL.
Gord Thompson [Thu, 19 Dec 2019 17:20:39 +0000 (12:20 -0500)] 
Improve regex parsing of CHECK constraints for PostgreSQL.

Fixed issue where the PostgreSQL dialect would fail to parse a reflected
CHECK constraint that was a boolean-valued function (as opposed to a
boolean-valued expression).

Fixes: #5039
Closes: #5044
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5044
Pull-request-sha: b6903c656422abf658c4cc88b8cd03291d3a50f8

Change-Id: I7d39b104a8ce346cb593d541c1b4e5eab88867f9

5 years agoMerge "apply asbool reduction to the onclause in join()"
mike bayer [Sat, 18 Jan 2020 00:13:37 +0000 (00:13 +0000)] 
Merge "apply asbool reduction to the onclause in join()"

5 years agoRemove jython code, remove all jython / pypy symbols
Mike Bayer [Fri, 17 Jan 2020 22:31:41 +0000 (17:31 -0500)] 
Remove jython code, remove all jython / pypy symbols

Removed all dialect code related to support for Jython and zxJDBC. Jython
has not been supported by SQLAlchemy for many years and it is not expected
that the current zxJDBC code is at all functional; for the moment it just
takes up space and adds confusion by showing up in documentation. At the
moment, it appears that Jython has achieved Python 2.7 support in its
releases but not Python 3.   If Jython were to be supported again, the form
it should take is against the Python 3 version of Jython, and the various
zxJDBC stubs for various backends should be implemented as a third party
dialect.

Additionally modernized logic that distinguishes between "cpython"
and "pypy" to instead look at platform.python_distribution() which
reliably tells us if we are cPython or not; all booleans which
previously checked for pypy and sometimes jython are now converted
to be "not cpython", this impacts the test suite for tests that are
cPython centric.

Fixes: #5094
Change-Id: I226cb55827f997daf6b4f4a755c18e7f4eb8d9ad

5 years agoapply asbool reduction to the onclause in join()
Mike Bayer [Fri, 17 Jan 2020 19:31:10 +0000 (14:31 -0500)] 
apply asbool reduction to the onclause in join()

The :func:`.true` and :func:`.false` operators may now be applied as the
"onclause" of a :func:`.sql.join` on a backend that does not support
"native boolean" expressions, e.g. Oracle or SQL Server, and the expression
will render as "1=1" for true and "1=0" false.  This is the behavior that
was introduced many years ago in :ticket:`2804` for and/or expressions.

Change-Id: I85311c31c22d6e226c618f8840f6b95eca611153

5 years agoMerge remote-tracking branch 'origin/pr/5099'
Mike Bayer [Thu, 16 Jan 2020 00:21:54 +0000 (19:21 -0500)] 
Merge remote-tracking branch 'origin/pr/5099'

Change-Id: Idef14aaba0396d94125792d19a9640f91eda14f0

5 years agoMerge remote-tracking branch 'origin/pr/5077'
Mike Bayer [Thu, 16 Jan 2020 00:19:00 +0000 (19:19 -0500)] 
Merge remote-tracking branch 'origin/pr/5077'

Change-Id: Ie8e0d631f7c6271bcd8173065506e85130b754c4

5 years agoUpdate index.rst 5099/head
Tom Nolan [Wed, 15 Jan 2020 21:47:57 +0000 (13:47 -0800)] 
Update index.rst

5 years agoEstablish that contains_eager()->alias can be replaced by of_type
Mike Bayer [Tue, 14 Jan 2020 22:32:12 +0000 (17:32 -0500)] 
Establish that contains_eager()->alias can be replaced by of_type

One test in test_of_type was creating a cartesian product
because contains_eager() was used with "alias" to refer
to a with_polymorphic(), but the wp was not used with of_type(),
so the pathing did not know that additional entities were present.

while the docs indicate that of_type() should be used, there is no
reason to use "alias" when you are using of_type().   Attempts
to make this automatic don't work as the current usage contract
with "alias" is that the contains_eager() chain can continue
along in terms of the base entities, which is another example
of the implicit swapping of entities for an aliased version of
themselves that really should be entirely marked as deprecated
throughout 1.4 and removed in 2.0.

So instead, add test coverage for the of_type() versions of
things and begin to make the case that we can remove "alias"
entirely, where previously we thought we would only deprecate
the string form.

Fixes: #5096
Change-Id: Ia7b021c4044332ab3282267815f208da64410e95

5 years agoAdjust use_mapper_path rule for poly subclasses
Mike Bayer [Mon, 13 Jan 2020 18:50:38 +0000 (13:50 -0500)] 
Adjust use_mapper_path rule for poly subclasses

We must change the approach from 2734439 as the information
loss is breaking subquery eager loading.

Move the adjustment into a deeper set of logic inside
of path_regsitry.  We can distinguish between a path
that will "naturally" build from an aliased entity
at the base, vs. one that will "naturally" build
on all raw mappers, based on if when we observe that
we are being given a with_polymorphic(), if the existing
parent path is already in progress or not.

In general, we prefer paths to have as much of the original
information as possible, and the "natural path" is supposed
to be where the loader lookup stuff happens.

Fixes: #5082
Change-Id: I3c0ee72993bae8a6f067bdef3dc9a57d83f64950

5 years agoAdd explanation of `polymorphic_identity` to docs
Eli [Tue, 29 Oct 2019 02:43:30 +0000 (19:43 -0700)] 
Add explanation of `polymorphic_identity` to docs

Fixes: #4951
Change-Id: I592063ffc7c9ffa0eff8bffd53f6ce407a551d15

5 years agoFixes for table-bound version_id_col against mapped selectable
Mike Bayer [Fri, 10 Jan 2020 18:16:43 +0000 (13:16 -0500)] 
Fixes for table-bound version_id_col against mapped selectable

Fixed bug where a versioning column specified on a mapper against a
:func:`.select` construct where the version_id_col itself were against the
underlying table would incur additional loads when accessed, even if the
value were locally persisted by the flush.  The actual fix is a result of
the changes in :ticket:`4617`,  by fact that a :func:`.select` object no
longer has a ``.c`` attribute and therefore does not confuse the mapper
into thinking there's an unknown column value present.

Fixed bug in ORM versioning feature where assignment of an explicit
version_id for a counter configured against a mapped selectable where
version_id_col is against the underlying table would fail if the previous
value were expired; this was due to the fact that the  mapped attribute
would not be configured with active_history=True.

Fixes: #4194
Fixes: #4195
Change-Id: I214879f441f905bdd85a7411f90352af7399051d

5 years agoIntegrate mapper-level version_id_col with versioned_history
Mike Bayer [Fri, 10 Jan 2020 18:16:43 +0000 (13:16 -0500)] 
Integrate mapper-level version_id_col with versioned_history

as the versioned_history example supplies an integer version
counter for the purposes of generating an audit trail, this
counter is also suited to be used for optimistic concurrency
detection using the version_id_col feature.   Build upon
the test that was first added in ac54ba0f2d8df5a76b6852841b6b3321c0e6c0e2
to provide a flag and some basic documentation.

Fixes: #2861
Change-Id: I50236beae4c49b33ada8fdcc4c524273b4e21c75

5 years agoAlter unique bound parameter key on deserialize
Mike Bayer [Fri, 10 Jan 2020 15:30:13 +0000 (10:30 -0500)] 
Alter unique bound parameter key on deserialize

Fixed bug in sqlalchemy.ext.serializer where a unique
:class:`.BindParameter` object could conflict with itself if it were
present in the mapping itself, as well as the filter condition of the
query, as one side would be used against the non-deserialized version and
the other side would use the deserialized version.  Logic is added to
:class:`.BindParameter` similar to its "clone" method which will uniquify
the parameter name upon deserialize so that it doesn't conflict with its
original.

Fixes: #5086
Change-Id: Ie1edce137e92ac496c822831d038999be5d1fc2d

5 years agoSet use_mapper_path=True for with_poly subentities
Mike Bayer [Tue, 7 Jan 2020 02:06:10 +0000 (21:06 -0500)] 
Set use_mapper_path=True for with_poly subentities

Fixed regression in joined eager loading introduced in 1.3.0b3 via
:ticket:`4468` where the ability to create a joined option across a
:func:`.with_polymorphic` into a polymorphic subclass using
:meth:`.RelationshipProperty.of_type` and then further along regular mapped
relationships would fail as the polymorphic subclass would not add itself
to the load path in a way that could be located by the loader strategy.  A
tweak has been made to resolve this scenario.

Fixes: #5082
Change-Id: I1c7b8d70ed94436c655e433bf34394b13d384c35

5 years agoMerge "Enable F821"
mike bayer [Tue, 7 Jan 2020 01:53:34 +0000 (01:53 +0000)] 
Merge "Enable F821"

5 years agoMerge "Fix QueryContext ref cycle on joinedload"
mike bayer [Tue, 7 Jan 2020 01:52:52 +0000 (01:52 +0000)] 
Merge "Fix QueryContext ref cycle on joinedload"

5 years agoSupport GenericFunction.name passed as a quoted_name
Mike Bayer [Mon, 6 Jan 2020 19:09:01 +0000 (14:09 -0500)] 
Support GenericFunction.name passed as a quoted_name

A function created using :class:`.GenericFunction` can now specify that the
name of the function should be rendered with or without quotes by assigning
the :class:`.quoted_name` construct to the .name element of the object.
Prior to 1.3.4, quoting was never applied to function names, and some
quoting was introduced in :ticket:`4467` but no means to force quoting for
a mixed case name was available.  Additionally, the :class:`.quoted_name`
construct when used as the name will properly register its lowercase name
in the function registry so that the name continues to be available via the
``func.`` registry.

Fixes: #5079
Change-Id: I0653ab8b16e75e628ce82dbbc3d0f77f8336c407

5 years agoAdd missing changelog file for #5074
Mike Bayer [Sat, 4 Jan 2020 18:34:45 +0000 (13:34 -0500)] 
Add missing changelog file for #5074

The changelog file was missing from
0a8b11bb6528c38dc441caadc6eb2d25046fc376 /
I00b656eb5ee03d87104257a214214617aacae16c.

Fixes: #5074
Change-Id: Ic69fc6b4fb92ed133a14ba36f878f3f4740c565b

5 years agoFix QueryContext ref cycle on joinedload
Carson Ip [Fri, 3 Jan 2020 22:09:20 +0000 (17:09 -0500)] 
Fix QueryContext ref cycle on joinedload

Avoid storing a reference to itself when dealing with create_eager_joins. Also fix a cheating test.

Fixes: #5071
Closes: #5072
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5072
Pull-request-sha: 75ebaf7c91e96d7567eb5760be713dc134c58763

Change-Id: I511ddc0979b46f7928217347199eca4b1d0b4a49

5 years agoEnable F821
Mike Bayer [Wed, 1 Jan 2020 23:24:03 +0000 (18:24 -0500)] 
Enable F821

In Ia63a510f9c1d08b055eef62cf047f1f427f0450c we introduced
"lambda combinations" which use a bit of function closure inspection
in order to allow for testing combinations that make use of symbols that
come from test fixtures, or from the test itself.

Two problems.  One is that we can't use F821 flake8 rule without either
adding lots of noqas, skipping the file, or adding arguments to the
lambdas themselves that are then populated, which makes for a very
verbose system.  The other is that the system is already verbose
with all those lambdas and the magic in use is a non-explicit kind,
hence F821 reminds us that if we can improve upon this, we should.

So let's improve upon it by making it so that the "lambda" is just
once and up front for the whole thing, and let it accept the arguments
directly.   This still requires magic, because these test cases need
to resolve at test collection time, not test runtime.  But we will
instead substitute a namespace up front that can be coerced into
its desired form within the tests.

Additionally, there's a little bit of py2k compatible type annotations
present; f821 is checking these, so we have to add those imports
also using the TYPE_CHECKING boolean so they don't take place in
py2k.

Change-Id: Idb7e7a0c8af86d9ab133f548511306ef68cdba14

5 years agoMerge "Fix cext for Python 2; ensure C extensions build successfully"
mike bayer [Sat, 4 Jan 2020 17:54:39 +0000 (17:54 +0000)] 
Merge "Fix cext for Python 2; ensure C extensions build successfully"

5 years agoFix cext for Python 2; ensure C extensions build successfully
Mike Bayer [Fri, 3 Jan 2020 17:10:57 +0000 (12:10 -0500)] 
Fix cext for Python 2; ensure C extensions build successfully

The C extensions have been broken since cc718cccc0bf8a01abdf4068c
however CI did not find this, because the build degraded to
non-C extensions without failing.   Ensure that if cext is set,
there is no fallback to non-cext build if the C extension build
fails.

Repair C related issues introduced in cc718cccc0bf8a01abdf4068c.

As C extensions have been silently failing on 2.7 for some commits,
the callcounts also needed to be adjusted for recent performance-related
changes.  That in turn required a fix to the profiling decorator
to use signature rewriting in order to support py.test's
fixture mechanism under Python 2, usage introduced under profiling
in 89bf6d80a9.

Fixes: #5076
Change-Id: Id968f10c85d6bf489298b1c318a1f869ad3e7d80

5 years agoRemove return statement in __init__. 5077/head
Heckad [Sat, 4 Jan 2020 00:23:07 +0000 (03:23 +0300)] 
Remove return statement in __init__.

5 years agoMerge "Implement explicit autobegin step for Session"
mike bayer [Fri, 3 Jan 2020 22:37:54 +0000 (22:37 +0000)] 
Merge "Implement explicit autobegin step for Session"

5 years agoMerge "Use context managers for threading.Lock()"
mike bayer [Fri, 3 Jan 2020 21:49:49 +0000 (21:49 +0000)] 
Merge "Use context managers for threading.Lock()"

5 years agoImplement explicit autobegin step for Session
Mike Bayer [Thu, 2 Jan 2020 17:48:23 +0000 (12:48 -0500)] 
Implement explicit autobegin step for Session

The :class:`.Session` object no longer initates a
:class:`.SessionTransaction` object immediately upon construction or after
the previous transaction is closed; instead, "autobegin" logic now
initiates the new :class:`.SessionTransaction` on demand when it is next
needed.  Rationale includes to remove reference cycles from a
:class:`.Session` that has been closed out, as well as to remove the
overhead incurred by the creation of :class:`.SessionTransaction` objects
that are often discarded immediately. This change affects the behavior of
the :meth:`.SessionEvents.after_transaction_create` hook in that the event
will be emitted when the :class:`.Session` first requires a
:class:`.SessionTransaction` be present, rather than whenever the
:class:`.Session` were created or the previous :class:`.SessionTransaction`
were closed.   Interactions with the :class:`.Engine` and the database
itself remain unaffected.

Fixes: #5074
Change-Id: I00b656eb5ee03d87104257a214214617aacae16c

5 years agoUse context managers for threading.Lock()
Heckad [Wed, 1 Jan 2020 19:47:01 +0000 (14:47 -0500)] 
Use context managers for threading.Lock()

(zzzeek:) For some reason I thought that threading.Lock() still did
not support context managers, at least in Python 2, however this
does not seem to be the case.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Closes: #5069
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5069
Pull-request-sha: efeac06dda5afdbe33abcf9b27c8b5b5725c8444

Change-Id: Ic64fcd99cd587bc70b4ecc5b45d8205b5c76eff2

5 years agohappy new year
Mike Bayer [Wed, 1 Jan 2020 17:09:47 +0000 (12:09 -0500)] 
happy new year

Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235

5 years agoSource base cleanups
Mike Bayer [Wed, 1 Jan 2020 15:51:15 +0000 (10:51 -0500)] 
Source base cleanups

in trying to apply 2020 copyright to files, the pre-commit
hooks complain about random file issues.

- remove old corrections.py utility, this had something to do
  with repairing refs in the sphinx docs

- run pre commit hooks on all files

- formatting adjustments to work around code formatting collisions
  (long import lines that zimports can't rewrite correctly)

Change-Id: I260744866f69e902eb93665c7c728ee94d3371a2

5 years agoMerge "Fix DATETIMEOFFSET formatting to preserve fractional seconds."
mike bayer [Wed, 1 Jan 2020 15:14:43 +0000 (15:14 +0000)] 
Merge "Fix DATETIMEOFFSET formatting to preserve fractional seconds."

5 years agoFix DATETIMEOFFSET formatting to preserve fractional seconds.
Gord Thompson [Tue, 31 Dec 2019 17:42:09 +0000 (12:42 -0500)] 
Fix DATETIMEOFFSET formatting to preserve fractional seconds.

Fixed issue where a timezone-aware ``datetime`` value being converted to
string for use as a parameter value of a :class:`.mssql.DATETIMEOFFSET`
column was omitting the fractional seconds.

Fixes: #5045
Closes: #5046
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5046
Pull-request-sha: 99dc7b23f69b7b068795a02d20b88bf352c7dcd7

Change-Id: I971629466fe0675536bbdf55693f0c1821dfb3cc

5 years agoMerge "Fix test failures under Windows"
mike bayer [Wed, 1 Jan 2020 00:18:31 +0000 (00:18 +0000)] 
Merge "Fix test failures under Windows"

5 years agoFix test failures under Windows
Federico Caselli [Tue, 31 Dec 2019 01:29:33 +0000 (20:29 -0500)] 
Fix test failures under Windows

Fixed a few test failures which would occur on Windows due to SQLite file
locking issues, as well as some timing issues in connection pool related
tests; pull request courtesy Federico Caselli.

Note the pool related issues were fixed by Mike in
I1a7162e67912d22c135fa517b687a073f8fd9151 but are being ticketed
here.

Fixes: #4946
Closes: #5055
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5055
Pull-request-sha: 36925573aff828bbdd725a4fed5394e06c775a98

Change-Id: Ic53ec82f5d588d0e26a2d033a17c6109900d7f63

5 years agoRepair uncovered warning in persistnce.py; update versioning tests
Mike Bayer [Tue, 31 Dec 2019 16:53:07 +0000 (11:53 -0500)] 
Repair uncovered warning in persistnce.py; update versioning tests

Repaired a warning in the ORM flush process that was not covered by  test
coverage when deleting objects that use the "version_id" feature. This
warning is generally unreachable unless using a dialect that sets the
"supports_sane_rowcount" flag to False, which  is not typically the case
however is possible for some MySQL configurations as well as older Firebird
drivers, and likely some third party dialects.

As part of this change, we would like to establish that versionining-
related warnings are not expected to emit for the core set of
test-covered dialects, and if they are we would like the check for
warning emitted to be explicit, rather than an ignore.

Fixes: #5068
Change-Id: Iee097554e43cbb54ced1be056635809e67cf30d6

5 years agoBump test_build_query numbers
Mike Bayer [Tue, 31 Dec 2019 18:01:59 +0000 (13:01 -0500)] 
Bump test_build_query numbers

Due to the decreased caching introduced in
 Ifd93856eba550483f95f9ae63d49f36ab068b85a, callcounts have risen
here however they did not pass the threshold in the review.
Bump them now instead.

Change-Id: Iac1dad695f25b8db2fdb0b6b1d5d9a0b183259b5

5 years agoMerge "Test for short term reference cycles and resolve as many as possible"
mike bayer [Tue, 31 Dec 2019 01:09:37 +0000 (01:09 +0000)] 
Merge "Test for short term reference cycles and resolve as many as possible"

5 years agoMerge "Include GROUP BY in _should_nest_selectable criteria"
mike bayer [Tue, 31 Dec 2019 01:04:21 +0000 (01:04 +0000)] 
Merge "Include GROUP BY in _should_nest_selectable criteria"

5 years agoFix newly found rst issue
Mike Bayer [Tue, 31 Dec 2019 01:01:23 +0000 (20:01 -0500)] 
Fix newly found rst issue

Likely due to new versions flake8-rst-docstrings or similar,
repair an incorrectly formatted code example in a doc string
causing all the gerrits to fail.

Change-Id: Ib2b242f435005a9e075315881c30c4a599d322e7

5 years agoTest for short term reference cycles and resolve as many as possible
Mike Bayer [Fri, 27 Dec 2019 20:02:31 +0000 (15:02 -0500)] 
Test for short term reference cycles and resolve as many as possible

Added test support and repaired a wide variety of unnecessary reference
cycles created for short-lived objects, mostly in the area of ORM queries.

Fixes: #5056
Change-Id: Ifd93856eba550483f95f9ae63d49f36ab068b85a

5 years agoInclude GROUP BY in _should_nest_selectable criteria
Mike Bayer [Mon, 30 Dec 2019 18:08:17 +0000 (13:08 -0500)] 
Include GROUP BY in _should_nest_selectable criteria

Fixed bug where usage of joined eager loading would not properly wrap the
query inside of a subquery when :meth:`.Query.group_by` were used against
the query.   When any kind of result-limiting approach is used, such as
DISTINCT, LIMIT, OFFSET, joined eager loading embeds the row-limited query
inside of a subquery so that the collection results are not impacted.   For
some reason, the presence of GROUP BY was never included in this criterion,
even though it has a similar effect as using DISTINCT.   Additionally, the
bug would prevent using GROUP BY at all for a joined eager load query for
most database platforms which forbid non-aggregated, non-grouped columns
from being in the query, as the additional columns for the joined eager
load would not be accepted by the database.

Fixes: #5065
Change-Id: I9a2ed8196f83297ec38012138d1a5acdf9e88155

5 years agoMerge "Fix WeakSequence circular reference"
mike bayer [Sun, 29 Dec 2019 16:08:00 +0000 (16:08 +0000)] 
Merge "Fix WeakSequence circular reference"

5 years agoDe-implement non-working / testing copy_internals from dml
Mike Bayer [Sun, 29 Dec 2019 07:09:04 +0000 (02:09 -0500)] 
De-implement non-working / testing copy_internals from dml

The DML constructs will need to have traverse_internals
symbols set up; as there are currently non-working /non-used
_copy_internals methods, just remove these for now as they
are unlikely to be working correctly in any case.

Additionally remove an errant "return" statement noted
on the same issue from the MySQL dialect.

Fixes: #5060
Change-Id: I289005af04192e4c755d53244b1ea0711c266c6c

5 years agoImprove two phase transaction requirement detection for PG
Federico Caselli [Sun, 29 Dec 2019 02:23:23 +0000 (21:23 -0500)] 
Improve two phase transaction requirement detection for PG

Improved detection of two phase transactions requirement for the PostgreSQL
database by testing that max_prepared_transactions is set to a value
greater than 0.  Pull request courtesy Federico Caselli.

Fixes: #5057
Closes: #5059
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5059
Pull-request-sha: c30c3b1a5216d281db84f9fa48466edaf7a26d1e

Change-Id: I4360f62eacdf1173172ee24cd05a68e9a448290c

5 years agoFix WeakSequence circular reference
Carson Ip [Fri, 27 Dec 2019 17:05:30 +0000 (12:05 -0500)] 
Fix WeakSequence circular reference

Fixed a reference cycle which could impact the GC behavior of the
:class:`.WeakSequence` object, currently used within one place in certain
mapper configurations.  The issue only affects configuration-time
structures. Pull request courtesy Carson Ip.

Fixes: #5050
Closes: #5051
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5051
Pull-request-sha: db672f45f4f139722edd2dcc6b0c19892725c9de

Change-Id: I72673a33e655c44b68283ec1a2d7358b904e90ae

5 years agoNote time passage requirement for pool.invalidate()
Mike Bayer [Fri, 27 Dec 2019 19:10:36 +0000 (14:10 -0500)] 
Note time passage requirement for pool.invalidate()

For Windows, time.time() may only have 16 millisecond
accuracy, so invalidation routines which compare
the time.time() of invalidate() to the time.time() when
the ConnectionRecord last connected may fail in a unit test
environment that does not pause at least this much time
since the ConnectionRecord startup.  Using >= for comparison
instead of > was considered but this only leads to more confusing
results as the ConnecitonRecord goes into a re-connect loop
as time continues to not pass.

Overall, while using routines such as Python 3.7's time_ns()
might be helpful, for now make sure tests which rely on this
are marked under timing intensive and add small sleeps.

Change-Id: I1a7162e67912d22c135fa517b687a073f8fd9151

5 years agoUse expanding IN for all literal value IN expressions
Mike Bayer [Mon, 9 Dec 2019 23:05:00 +0000 (18:05 -0500)] 
Use expanding IN for all literal value IN expressions

The "expanding IN" feature, which generates IN expressions at query
execution time which are based on the particular parameters associated with
the statement execution, is now used for all IN expressions made against
lists of literal values.   This allows IN expressions to be fully cacheable
independently of the list of values being passed, and also includes support
for empty lists. For any scenario where the IN expression contains
non-literal SQL expressions, the old behavior of pre-rendering for each
position in the IN is maintained. The change also completes support for
expanding IN with tuples, where previously type-specific bind processors
weren't taking effect.

As part of this change, a more explicit separation between
"literal execute" and "post compile" bound parameters is being made;
as the "ansi bind rules" feature is rendering bound parameters
inline, as we now support "postcompile" generically, these should
be used here, however we have to render literal values at
execution time even for "expanding" parameters.  new test fixtures
etc. are added to assert everything goes to the right place.

Fixes: #4645
Change-Id: Iaa2b7bfbfaaf5b80799ee17c9b8507293cba6ed1

5 years agoCopy bind_processors when altering for expanding IN
Mike Bayer [Fri, 20 Dec 2019 16:40:10 +0000 (11:40 -0500)] 
Copy bind_processors when altering for expanding IN

Fixed issue where the collection of value processors on a
:class:`.Compiled` object would be mutated when "expanding IN" parameters
were used with a datatype that has bind value processors; in particular,
this would mean that when using statement caching and/or baked queries, the
same compiled._bind_processors collection would be mutated concurrently.
Since these processors are the same function for a given bind parameter
namespace every time, there was no actual negative effect of this issue,
however, the execution of a :class:`.Compiled` object should never be
causing any changes in its state, especially given that they are intended
to be thread-safe and reusable once fully constructed.

Fixes: #5048
Change-Id: I876d16bd7484eb05ce590397420552ac36da6e52

5 years agoImplement random_choices for Python 2
Mike Bayer [Fri, 20 Dec 2019 17:49:13 +0000 (12:49 -0500)] 
Implement random_choices for Python 2

Apparently py2k has no random.choices, so make a quick
one for the tests that use it.

Change-Id: Iadc3442b35f400b5bab0f711b7d3ede5dbc28f52

5 years agoEnsure comparison includes "don't compare values" feature
Mike Bayer [Fri, 20 Dec 2019 15:17:17 +0000 (10:17 -0500)] 
Ensure comparison includes "don't compare values" feature

upcoming changes for "expanding IN in all cases" and
"lambda elements" both rely upon comparisons that work
across changing bound values, so commit the testing fixture
ahead of time.   Additionally, repair the feature itself
within traversals.

Change-Id: Ie65a512dc64745614180da77435f9f745ce78c71

5 years agoMerge "Don't apply aliasing + adaption for simple relationship joins"
mike bayer [Thu, 19 Dec 2019 16:14:11 +0000 (16:14 +0000)] 
Merge "Don't apply aliasing + adaption for simple relationship joins"

5 years agoMerge "Add CTE prefixes"
mike bayer [Thu, 19 Dec 2019 15:21:30 +0000 (15:21 +0000)] 
Merge "Add CTE prefixes"

5 years agoDon't apply aliasing + adaption for simple relationship joins
Mike Bayer [Thu, 19 Dec 2019 02:50:24 +0000 (21:50 -0500)] 
Don't apply aliasing + adaption for simple relationship joins

Identified a performance issue in the system by which a join is constructed
based on a mapped relationship.   The clause adaption system would be used
for the majority of join expressions including in the common case where no
adaptation is needed.   The conditions under which this adaptation occur
have been refined so that average non-aliased joins along a simple
relationship without a "secondary" table use about 70% less function calls.

Change-Id: Ifbe04214576e5a9fac86ca80c1dc7145c27cd50a

5 years agoImprove documentation for refresh_flush event
Mike Bayer [Thu, 19 Dec 2019 14:19:53 +0000 (09:19 -0500)] 
Improve documentation for refresh_flush event

This event does not include INSERTed primary key columns
and additionally will always be limited to default/onupdate
columns.    Note better choices for interception of INSERT
events.

Change-Id: I22b71ca1b336d4b098af075cc4694c55387b64f3

5 years agoMerge remote-tracking branch 'origin/pr/5023'
Mike Bayer [Wed, 18 Dec 2019 23:01:12 +0000 (18:01 -0500)] 
Merge remote-tracking branch 'origin/pr/5023'

Change-Id: I28884213a86ff3c8fbb5f6377114bba6503cb671

5 years agoMerge remote-tracking branch 'origin/pr/5022'
Mike Bayer [Wed, 18 Dec 2019 22:57:07 +0000 (17:57 -0500)] 
Merge remote-tracking branch 'origin/pr/5022'

Change-Id: I4c195826482aa523904b68cb6537acf4a547889a

5 years agoMerge remote-tracking branch 'origin/pr/5031'
Mike Bayer [Wed, 18 Dec 2019 22:56:37 +0000 (17:56 -0500)] 
Merge remote-tracking branch 'origin/pr/5031'

Change-Id: I74d94087495de2e0b98b180ef1b5269a72d0c3bf

5 years agoAdd CTE prefixes
Marat Sharafutdinov [Wed, 18 Dec 2019 15:39:59 +0000 (10:39 -0500)] 
Add CTE prefixes

Added support for prefixes to the :class:`.CTE` construct, to allow
support for Postgresql 12 "MATERIALIZED" and "NOT MATERIALIZED" phrases.
Pull request courtesy Marat Sharafutdinov.

Fixes: #5040
Closes: #5043
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5043
Pull-request-sha: d1b9059a0b6dae8dc2479ac670999b4af07908e0

Change-Id: I2e9cb5d7f85961ec98ee51965de5b3ec4a97be2f

5 years ago"does not support reflection" -> "does not support nullable booleans"
Mike Bayer [Tue, 17 Dec 2019 14:57:30 +0000 (09:57 -0500)] 
"does not support reflection" -> "does not support nullable booleans"

Change-Id: Icf00f9250ffe45413369a6bb2c2910da42c017ee

5 years agoDo the CompoundSelect check for number of columns in the compile phase
Mike Bayer [Mon, 16 Dec 2019 21:38:06 +0000 (16:38 -0500)] 
Do the CompoundSelect check for number of columns in the compile phase

Starting to go forward with the general idea of moving more
of Core / ORM construction into the compile phase.   Bigger
initiatives like the refactor of Query will follow onto this.

Change-Id: I0f364d3182e21e32ed85ef34cfd11fd9d11cf653

5 years agocherry-pick changelog update for 1.3.13
Mike Bayer [Mon, 16 Dec 2019 18:39:52 +0000 (13:39 -0500)] 
cherry-pick changelog update for 1.3.13

5 years agocherry-pick changelog from 1.3.12
Mike Bayer [Mon, 16 Dec 2019 18:39:52 +0000 (13:39 -0500)] 
cherry-pick changelog from 1.3.12

5 years agoEnsure cache keys are hashable in the test
Mike Bayer [Sat, 14 Dec 2019 20:36:38 +0000 (15:36 -0500)] 
Ensure cache keys are hashable in the test

Change-Id: I962ff15194e2416844086f03dddadb49f48a6c8d

5 years agoTraversal and clause generation performance improvements
Mike Bayer [Sat, 14 Dec 2019 16:39:06 +0000 (11:39 -0500)] 
Traversal and clause generation performance improvements

Added one traversal test, callcounts have been brought from 29754 to
5173 so far.

Change-Id: I164e9831600709ee214c1379bb215fdad73b39aa

5 years agoMerge remote-tracking branch 'origin/pr/5021'
Mike Bayer [Sat, 14 Dec 2019 16:16:54 +0000 (11:16 -0500)] 
Merge remote-tracking branch 'origin/pr/5021'

Change-Id: Ia41c6c692e0b89f2d45e10b10ff6e69799312dba

5 years agoClose connection if begin fails
Mike Bayer [Fri, 13 Dec 2019 17:44:23 +0000 (12:44 -0500)] 
Close connection if begin fails

Fixed issue where by if the "begin" of a transaction failed at the Core
engine/connection level, such as due to network error or database is locked
for some transactional recipes, within the context of the :class:`.Session`
procuring that connection from the connection pool and then immediately
returning it, the ORM :class:`.Session` would not close the connection
despite this connection not being stored within the state of that
:class:`.Session`.  This would lead to the connection being cleaned out by
the connection pool weakref handler within garbage collection which is an
unpreferred codepath that in some special configurations can emit errors in
standard error.

Fixes: #5034
Change-Id: I6502a55791d86845f34bc10889c218f00765dfdc

5 years agofix typo strucures -> structures 5031/head
Federico Caselli [Tue, 10 Dec 2019 23:08:37 +0000 (00:08 +0100)] 
fix typo strucures -> structures

5 years agoUse label reference coercion for select() distinct keyword argument
Mike Bayer [Fri, 6 Dec 2019 16:38:55 +0000 (11:38 -0500)] 
Use label reference coercion for select() distinct keyword argument

Fixed bug where "distinct" keyword passed to :func:`.select` would not
treat a string value as a "label reference" in the same way that the
:meth:`.select.distinct` does; it would instead raise unconditionally. This
keyword argument and the others passed to :func:`.select` will ultimately
be deprecated for SQLAlchemy 2.0.

Fixes: #5028
Change-Id: Id36cfe477ed836c3248824ce1b81d0016dbe99f4

5 years agoInclude DISTINCT in error message for label reference
Mike Bayer [Fri, 6 Dec 2019 15:24:25 +0000 (10:24 -0500)] 
Include DISTINCT in error message for label reference

Needed to add tests to ensure this label reference is handled
correctly, so also modified the exception message to
be more clear if someone has this error within distinct().

Change-Id: I6e685e46ae336596272d14366445ac224c18d92c

5 years agoIntroduce lambda combinations
Mike Bayer [Thu, 5 Dec 2019 00:18:57 +0000 (19:18 -0500)] 
Introduce lambda combinations

As the ORM's combinatoric tests mostly use entities and
table metadata that's defined in fixtures, we can't use
@testing.combinations directly as it takes place at the
module level.   Instead we use lambdas, but to reduce
verbosity we use a code replacement so that the namespace
of the lambda can be provided at runtime rather than
module import time.

Change-Id: Ia63a510f9c1d08b055eef62cf047f1f427f0450c

5 years agoAdd pass through exact pyodbc connection string. 5023/head
Gord Thompson [Wed, 4 Dec 2019 10:47:24 +0000 (03:47 -0700)] 
Add pass through exact pyodbc connection string.

5 years agoAdd note re: using the MySQL ODBC "ANSI" driver for mysql+pyodbc.
Gord Thompson [Wed, 4 Dec 2019 00:41:56 +0000 (17:41 -0700)] 
Add note re: using the MySQL ODBC "ANSI" driver for mysql+pyodbc.

5 years agoAdd note re: pyodbc keywords in lowercase. 5022/head
Gord Thompson [Wed, 4 Dec 2019 00:02:19 +0000 (17:02 -0700)] 
Add note re: pyodbc keywords in lowercase.

5 years agoAdd dialect for Apache Solr 5021/head
Ahmed Adel [Tue, 3 Dec 2019 07:06:20 +0000 (09:06 +0200)] 
Add dialect for Apache Solr

5 years agoSkip sub-minute timezone tests for Python 3 < 3.7
Mike Bayer [Mon, 2 Dec 2019 16:47:08 +0000 (11:47 -0500)] 
Skip sub-minute timezone tests for Python 3 < 3.7

The datetime.timezone class as of Python 3.7, or SQLAlchemy's port for Python
2, supports seconds and microseconds.  For Python 3.6 and earlier, it is not
supported.

Fixes: #5016
Change-Id: Ia347d5a9958c0fa53317b2e340162e2009667bc2

5 years agoMerge "Add DATETIMEOFFSET support for mssql+pyodbc"
mike bayer [Sat, 30 Nov 2019 18:31:59 +0000 (18:31 +0000)] 
Merge "Add DATETIMEOFFSET support for mssql+pyodbc"

5 years agoAdd DATETIMEOFFSET support for mssql+pyodbc
Gord Thompson [Tue, 26 Nov 2019 14:57:48 +0000 (09:57 -0500)] 
Add DATETIMEOFFSET support for mssql+pyodbc

Repaired support for the :class:`.mssql.DATETIMEOFFSET` datatype on PyODBC,
by adding PyODBC-level result handlers as it does not include native
support for this datatype.  This includes usage of the Python 3 "timezone"
tzinfo subclass in order to set up a timezone, which on Python 2 makes
use of a minimal backport of "timezone" in sqlalchemy.util.

Fixes: #4983
Closes: #4986
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4986
Pull-request-sha: e3a5a8dda01c7580dc93271092c4f9beaac4be11

Change-Id: Ia4c7c0d1971c6c0492515bd5fa0b1799f07fee1c

5 years agoGracefully degrade for SQLite JSON receiving direct numeric value
Mike Bayer [Fri, 29 Nov 2019 15:50:44 +0000 (10:50 -0500)] 
Gracefully degrade for SQLite JSON receiving direct numeric value

Fixed issue to workaround SQLite's behavior of assigning "numeric" affinity
to JSON datatypes, first described at :ref:`change_3850`, which returns
scalar numeric JSON values as a number and not as a string that can be JSON
deserialized.  The SQLite-specific JSON deserializer now gracefully
degrades for this case as an exception and bypasses deserialization for
single numeric values, as from a JSON perspective they are already
deserialized.

Also adds a combinatoric fixture for JSON single values within
the dialect-general test suite.

Fixes: #5014
Change-Id: Id38221dce1271fec527ca198b23908547b25d8a0

5 years agoMerge "Remove ORM elements from annotations at the schema level."
mike bayer [Tue, 26 Nov 2019 18:06:45 +0000 (18:06 +0000)] 
Merge "Remove ORM elements from annotations at the schema level."

5 years agoMerge "Add sequence support for MariaDB 10.3+."
mike bayer [Tue, 26 Nov 2019 17:59:53 +0000 (17:59 +0000)] 
Merge "Add sequence support for MariaDB 10.3+."

5 years agoDon't clear metadata in TablesTest setup
Mike Bayer [Tue, 26 Nov 2019 16:09:00 +0000 (11:09 -0500)] 
Don't clear metadata in TablesTest setup

Some upcoming commits will make use of @metadata_fixture
within a TablesTest class.  As the fixture takes place before
setup, remove anything in setup that would interfere with it.

Change-Id: I4f16889c4c02cb2835dcf4886eb09ece848d8109
References: I507bc405eee6cae2c5991345d0eac53a37fe7512

5 years agoAdd sequence support for MariaDB 10.3+.
Gord Thompson [Thu, 21 Nov 2019 14:43:40 +0000 (09:43 -0500)] 
Add sequence support for MariaDB 10.3+.

Added support for use of the :class:`.Sequence` construct with MariaDB 10.3
and greater, as this is now supported by this database.  The construct
integrates with the :class:`.Table` object in the same way that it does for
other databases like PostrgreSQL and Oracle; if is present on the integer
primary key "autoincrement" column, it is used to generate defaults.   For
backwards compatibility, to support a :class:`.Table` that has a
:class:`.Sequence` on it to support sequence only databases like Oracle,
while still not having the sequence fire off for MariaDB, the optional=True
flag should be set, which indicates the sequence should only be used to
generate the primary key if the target database offers no other option.

Fixes: #4976
Closes: #4996
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4996
Pull-request-sha: cb2e1426ea0b6bc6c93dbe8f033a11df9d8c4915

Change-Id: I507bc405eee6cae2c5991345d0eac53a37fe7512

5 years agoRemove ORM elements from annotations at the schema level.
Mike Bayer [Mon, 25 Nov 2019 20:09:47 +0000 (15:09 -0500)] 
Remove ORM elements from annotations at the schema level.

Fixed issue where when constructing constraints from ORM-bound columns,
primarily :class:`.ForeignKey` objects but also :class:`.UniqueConstraint`,
:class:`.CheckConstraint` and others, the ORM-level
:class:`.InstrumentedAttribute` is discarded entirely, and all ORM-level
annotations from the columns are removed; this is so that the constraints
are still fully pickleable without the ORM-level entities being pulled in.
These annotations are not necessary to be present at the schema/metadata
level.

Fully implemented coercions for constraint columns within
schema.py, including for FK referenced columns.

Fixes: #5001
Change-Id: I895400dd979310be034085d207f096707c635909

5 years agoGeneralize DescriptorProps.uses_objects
Mike Bayer [Sat, 23 Nov 2019 17:25:20 +0000 (12:25 -0500)] 
Generalize DescriptorProps.uses_objects

Previously, uses_objects was specific to the SynonymAttribute;
generalize it so that it defaults to False for other DescriptorProps.
Immediate fix is against CompositeProperty.

Fixed regression introduced in 1.3.0 related to the association proxy
refactor in :ticket:`4351` that prevented :func:`.composite` attributes
from working in terms of an association proxy that references them.

Add test coverage for association proxies that refer to Composite
attributes as endpoints.

Fixes: #5000
Change-Id: Iea6fb1bd3314d861a9bc22491b0ae1e6c5e6340d

5 years agoRaise for persistence casades set with viewonly=True
Mike Bayer [Fri, 22 Nov 2019 19:28:21 +0000 (14:28 -0500)] 
Raise for persistence casades set with viewonly=True

An error is raised if any persistence-related "cascade" settings are made
on a :func:`.relationship` that also sets up viewonly=True.   The "cascade"
settings now default to non-persistence related settings only when viewonly
is also set.  This is the continuation from :ticket:`4993` where this
setting was changed to emit a warning in 1.3.

Fixes: #4994
Change-Id: Ic70ff4d9980e422ade474c5a0ad49756c6b8a048

5 years agoMerge "Warn for settings that don't work with viewonly=True"
mike bayer [Fri, 22 Nov 2019 19:06:24 +0000 (19:06 +0000)] 
Merge "Warn for settings that don't work with viewonly=True"

5 years agoWarn for settings that don't work with viewonly=True
Mike Bayer [Wed, 20 Nov 2019 17:15:57 +0000 (12:15 -0500)] 
Warn for settings that don't work with viewonly=True

Setting persistence-related flags on :func:`.relationship` while also
setting viewonly=True will now emit a regular warning, as these flags do
not make sense for a viewonly=True relationship.   In particular, the
"cascade" settings have their own warning that is generated based on the
individual values, such as "delete, delete-orphan", that should not apply
to a viewonly relationship.   Note however that in the case of "cascade",
these settings are still erroneously taking effect even though the
relationship is set up as "viewonly".   In 1.4, all persistence-related
cascade settings will be disallowed on a viewonly=True relationship in
order to resolve this issue.

Fixes: #4993
Change-Id: I4b607a96a7de2ffa15303a27fd93c162a681556d

5 years agoDon't raise w/ raiseload strategy for many-to-one history in flush
Mike Bayer [Fri, 22 Nov 2019 15:27:02 +0000 (10:27 -0500)] 
Don't raise w/ raiseload strategy for many-to-one history in flush

Fixed issue involving ``lazy="raise"`` strategy where an ORM delete of an
object would raise for a simple "use-get" style many-to-one relationship
that had lazy="raise" configured.  This is inconsistent vs. the change
introduced in 1.3 as part of :ticket:`4353`, where it was established that
a history operation that does not expect emit SQL should bypass the
``lazy="raise"`` check, and instead effectively treat it as
``lazy="raise_on_sql"`` for this case.  The fix adjusts the lazy loader
strategy to not raise for the case where the lazy load was instructed that
it should not emit SQL if the object were not present.

Fixes: #4997
Change-Id: I4deb8c129900f28321c4a5c48301db5fe2aedf78

5 years agoFix rst for flake8-rst-docstrings-0.0.12
Mike Bayer [Fri, 22 Nov 2019 16:08:37 +0000 (11:08 -0500)] 
Fix rst for flake8-rst-docstrings-0.0.12

A few new formatting errors are caught by this version.

Change-Id: I737b33267a00f400b7ba7696a03ddb07a4c95bc0

5 years agoIntroduce flag combinations fixture
Mike Bayer [Fri, 22 Nov 2019 15:54:22 +0000 (10:54 -0500)] 
Introduce flag combinations fixture

A helper for @testing.combinations when we just have lots of
true/false combinations as is the case with some ORM tests.

Change-Id: I9f2de97ce5b2487411ed610b8d41169c1052bd8f

5 years agoMerge "Skip on slice assignment to self"
mike bayer [Wed, 20 Nov 2019 19:50:35 +0000 (19:50 +0000)] 
Merge "Skip on slice assignment to self"

5 years agoSkip on slice assignment to self
Mike Bayer [Tue, 19 Nov 2019 14:30:31 +0000 (09:30 -0500)] 
Skip on slice assignment to self

Fixed issue where when assigning a collection to itself as a slice, the
mutation operation would fail as it would first erase the assigned
collection inadvertently.   As an assignment that does not change  the
contents should not generate events, the operation is now a no-op. Note
that the fix only applies to Python 3; in Python 2, the ``__setitem__``
hook isn't called in this case; ``__setslice__`` is used instead which
recreates the list item-by-item in all cases.

Fixes: #4990
Change-Id: I08727880f70f4fe188de53a4dcd36746b62c7233

5 years agoMove max-worker-restart to pytest-xdist options in tox.ini
Mike Bayer [Tue, 19 Nov 2019 17:38:58 +0000 (12:38 -0500)] 
Move max-worker-restart to pytest-xdist options in tox.ini

This way py.test can be run on the outside without a
command line error.

Change-Id: Ia3689806bffbabe176a827cca2f099e89a60ebf5
Closes: #4989
5 years agoUse viewonly=True for composite secondary join example
Mike Bayer [Tue, 19 Nov 2019 15:12:35 +0000 (10:12 -0500)] 
Use viewonly=True for composite secondary join example

This example isn't writable as given.   Add additonal
warnings.  Also modernize the "query-enabled property"
section and add links to hybrids.

Fixes: #4992
Change-Id: I8f4b4db9e42ab2207a74532e3b17a56c35b0a837