]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoReduce import time overhead
Mike Bayer [Mon, 2 Nov 2020 22:37:12 +0000 (17:37 -0500)] 
Reduce import time overhead

* Fix subclass traversals to not run classes multiple times

* switch compiler visitor to use an attrgetter, to avoid
  an eval() at startup time

* don't pre-generate traversal functions, there's lots of these
  which are expensive to generate at once and most applications
  won't use them all; have it generate them on first use instead

* Some ideas about removing asyncio imports, they don't seem to
  be too signficant, apply some more simplicity to the overall
  "greenlet fallback" situation

Fixes: #5681
Change-Id: Ib564ddaddb374787ce3e11ff48026e99ed570933

4 years agoonly install greenlet for python 3
Mike Bayer [Mon, 2 Nov 2020 20:39:43 +0000 (15:39 -0500)] 
only install greenlet for python 3

Change-Id: I6057cd019bb78486e57f2cce49b58d7806ace36f

4 years agoEnsure AsyncAdaptedLock is present
Mike Bayer [Mon, 2 Nov 2020 20:29:38 +0000 (15:29 -0500)] 
Ensure AsyncAdaptedLock is present

whether or not greenlet is installed

Change-Id: Icd1c5ef3a01ec0d1b8dce0d1def9920700923e51

4 years agoRevert "- 1.4.0b1"
Mike Bayer [Mon, 2 Nov 2020 19:58:15 +0000 (14:58 -0500)] 
Revert "- 1.4.0b1"

This reverts commit a8efd74cebc609e34d3b2a5ce161b2ed32330fab.

release script was out of sync, or something

4 years ago- 1.4.0b1
Mike Bayer [Mon, 2 Nov 2020 19:35:38 +0000 (14:35 -0500)] 
- 1.4.0b1

4 years agochangelog edits and improvements
Mike Bayer [Mon, 2 Nov 2020 19:34:16 +0000 (14:34 -0500)] 
changelog edits and improvements

added new categories and applied better organization
to elements, repaired a few that are already out of date.

Change-Id: I02c619c99237c1e66e932543c4ee95fd119d665d

4 years agofix notes regarding Python 3.5
Mike Bayer [Sun, 1 Nov 2020 15:41:11 +0000 (10:41 -0500)] 
fix notes regarding Python 3.5

Clarify python 3.6 as the minimum python version,
references #5634

Change-Id: Ib93bc1b2a69e509bff8b00809d3db4f0ec5108f3

4 years agoupdate selectin docs
Mike Bayer [Sat, 31 Oct 2020 23:08:28 +0000 (19:08 -0400)] 
update selectin docs

* correct many-to-one example that doesnt use JOIN or ORDER BY
anymore

* Oracle does tuple IN, let's test it

* many-to-many is supported but joins all the way right now

* remove verbiage about yield_per for the moment to simplify
updates to how yield_per works w/ new style execution.  yield_per
is difficult to explain and the section seems kind of complicated
with those details added at the moment.

Change-Id: I010ed36f554f06310f336a5b12760c447b38ec01

4 years agoMerge "tutorial 2.0 WIP"
mike bayer [Sat, 31 Oct 2020 19:50:07 +0000 (19:50 +0000)] 
Merge "tutorial 2.0 WIP"

4 years agotutorial 2.0 WIP
Mike Bayer [Sat, 26 Sep 2020 02:31:16 +0000 (22:31 -0400)] 
tutorial 2.0 WIP

Add SelectBase.exists() method as it seems strange this is
not available already.  The Exists construct itself does
not provide full SELECT-building capabilities so it makes
sense this should be used more like a scalar_subquery.

Make sure stream_results is getting set up when yield_per
is used, for 2.0 style statements as well.  this was
hardcoded inside of Query.yield_per() and is now moved
to take place within QueryContext.

Change-Id: Icafcd4fd9b708772343d56edf40995c9e8f835d6

4 years agoMerge "while working on #5435, I found some misses from the previous PR for #5429"
mike bayer [Sat, 31 Oct 2020 14:54:39 +0000 (14:54 +0000)] 
Merge "while working on #5435, I found some misses from the previous PR for #5429"

4 years agoMerge "Deprecate bind args, execute() methods that were missed"
mike bayer [Sat, 31 Oct 2020 01:05:01 +0000 (01:05 +0000)] 
Merge "Deprecate bind args, execute() methods that were missed"

4 years agoDeprecate bind args, execute() methods that were missed
Mike Bayer [Thu, 29 Oct 2020 16:38:42 +0000 (12:38 -0400)] 
Deprecate bind args, execute() methods that were missed

in particular text(bind), DDL.execute().

Change-Id: Ie85ae9f61219182f5649f68e5f52b4923843199c

4 years agowhile working on #5435, I found some misses from the previous PR for #5429 5676/head
jonathan vanasco [Wed, 28 Oct 2020 19:58:55 +0000 (15:58 -0400)] 
while working on #5435, I found some misses from the previous PR for #5429

Change-Id: I0be15f6234c74302734672450a3275add762bdb8

4 years agoMerge "Apply underscore naming to several more operators"
mike bayer [Fri, 30 Oct 2020 15:14:18 +0000 (15:14 +0000)] 
Merge "Apply underscore naming to several more operators"

4 years agoApply underscore naming to several more operators
jonathan vanasco [Wed, 28 Oct 2020 18:35:39 +0000 (14:35 -0400)] 
Apply underscore naming to several more operators

The operator changes are:

* `isfalse` is now `is_false`
* `isnot_distinct_from` is now `is_not_distinct_from`
* `istrue` is now `is_true`
* `notbetween` is now `not_between`
* `notcontains` is now `not_contains`
* `notendswith` is now `not_endswith`
* `notilike` is now `not_ilike`
* `notlike` is now `not_like`
* `notmatch` is now `not_match`
* `notstartswith` is now `not_startswith`
* `nullsfirst` is now `nulls_first`
* `nullslast` is now `nulls_last`

Because these are core operators, the internal migration strategy for this
change is to support legacy terms for an extended period of time -- if not
indefinitely -- but update all documentation, tutorials, and internal usage
to the new terms.  The new terms are used to define the functions, and
the legacy terms have been deprecated into aliases of the new terms.

Fixes: #5435
Change-Id: Ifbd7cb1cdda5981990243c4fc4b4ff467dc132ac

4 years agorename "bulk" UPDATE and DELETE to not use the word "bulk"
Mike Bayer [Fri, 30 Oct 2020 03:21:13 +0000 (23:21 -0400)] 
rename "bulk" UPDATE and DELETE to not use the word "bulk"

This term confuses this feature with the lesser used
"bulk insert/update" feature, and also "bulk" is not as
descriptive here as only a single statement is run; there's
not a large set of data passed in.

For now call it UPDATE/DELETE with arbitrary WHERE clause,
or ORM-enabled UPDATE/DELETE.

Change-Id: I317fcda9d73d4c2dd250031a745dd3d72e4f1fc6

4 years agoClarify bulk operations caveats
Mike Bayer [Fri, 30 Oct 2020 03:12:19 +0000 (23:12 -0400)] 
Clarify bulk operations caveats

Fixes: #5678
Change-Id: I186b26d1265c106bb87fb9e680229cad1eb8d7ea

4 years agoImplement PropComparator.and_() for remaining options
Mike Bayer [Thu, 29 Oct 2020 18:29:57 +0000 (14:29 -0400)] 
Implement PropComparator.and_() for remaining options

In c7b489b25802f7a25ef78d0731411295c611cc1c we implemented
with_loader_criteria() for everyone as well as PropComparator.and_()
for joinedload() and join(), but forgot to do anything for
lazyload(), selectinload(), or subqueryload().  Even though
I actually documented it in terms of lazyload().

Fixes: #4472
Change-Id: I0ef410a83c34e63b9c9c9c3277c0063d8971ec14

4 years agoadded docstring about expire_on_commit for #5243
jonathan vanasco [Fri, 4 Sep 2020 23:48:38 +0000 (19:48 -0400)] 
added docstring about expire_on_commit for #5243

Fixes: #5243
Closes: #5328
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5328
Pull-request-sha: e760ed4ef1749aadfb8d63d776c764d98b93b1e5

Change-Id: I8e7bc3429dc279d447cc66400c76b4d2a04626aa

4 years agoMerge "Correct reflection for composite primary keys"
mike bayer [Mon, 26 Oct 2020 14:29:12 +0000 (14:29 +0000)] 
Merge "Correct reflection for composite primary keys"

4 years agoimprove engine logging docs
Mike Bayer [Sat, 24 Oct 2020 16:59:22 +0000 (12:59 -0400)] 
improve engine logging docs

the text here was a little confusing and didn't refer to major
configurational elements such as hide_parameters.

Change-Id: I4e2179e5a64c326d30b65a8871b924725c41b453

4 years agoCorrect reflection for composite primary keys
fulpm [Tue, 20 Oct 2020 21:54:50 +0000 (17:54 -0400)] 
Correct reflection for composite primary keys

Fixes: #5661
### Description
Fixes reflection of composite primary keys to maintain the correct column order in the MSSQL
and SQLite dialects.

Closes: #5662
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5662
Pull-request-sha: b568dec7070b4f3ee46a528bdf16fb237baade2a

Change-Id: I452b23cbf7f389c4a0a34cffce5c32498efe37d2

4 years agoDon't load expired objects from evaluator
Mike Bayer [Wed, 21 Oct 2020 19:01:03 +0000 (15:01 -0400)] 
Don't load expired objects from evaluator

part 2 of e3dc20ff27fa75e571fb2631e64737ea8f25f7c5, the
pre-evaluate step was also emitting SELECT for expired objects.

Fixes: #5664
Change-Id: I9f5de2a5d480eafeb290ec0c45ce2a82ec93475b

4 years agoDon't populate expired attrs w/ evaluator
Mike Bayer [Wed, 21 Oct 2020 17:58:22 +0000 (13:58 -0400)] 
Don't populate expired attrs w/ evaluator

Fixed bug in :meth:`_orm.Query.update` where objects in the
:class:`_orm.Session` that were already expired would be unnecessarily
SELECTed individually when they were refreshed by the "evaluate"
synchronize strategy.

For 1.4 there was also a similar issue with fetch that would actually
get the wrong data back, as the new value would be loaded, then
applied with the evaluator.

Fixes: #5664
Change-Id: I6e6aff88462654fcefa9fce2b45f5446c418deee

4 years agoImprove assoc proxy docs for 1.3 changes
Mike Bayer [Tue, 20 Oct 2020 14:20:39 +0000 (10:20 -0400)] 
Improve assoc proxy docs for 1.3 changes

Fixes: #5647
Change-Id: I98979577f5354eba993ade9fc5056db718f47a18

4 years agoAdd FAQ entry for retry subject; recipe w/ autocommit
Mike Bayer [Mon, 19 Oct 2020 19:57:13 +0000 (15:57 -0400)] 
Add FAQ entry for retry subject; recipe w/ autocommit

In order to invalidate a connection within a Transaction
block and an execution context, we need to take advantage
of the simpler transaction design added in 1.4.  The recipe
can be done on 1.3 but it requires a lot more hacking
and isn't worth it.

Clearly since the recipe is part of the tests now we can
in the future consider adding a feature that's built
in for this case but it would have to absolutely guarantee
the DBAPI is in autocommit mode and also prevent
any "write" operations from taking place.   Recipe for now.

Fixes: #5657
Change-Id: Ia9ea8cced084d154e83e4d1c259e080b776ec38a

4 years agoEnsure no compiler visit method tries to access .statement
Mike Bayer [Mon, 19 Oct 2020 14:19:29 +0000 (10:19 -0400)] 
Ensure no compiler visit method tries to access .statement

Fixed structural compiler issue where some constructs such as MySQL /
PostgreSQL "on conflict / on duplicate key" would rely upon the state of
the :class:`_sql.Compiler` object being fixed against their statement as
the top level statement, which would fail in cases where those statements
are branched from a different context, such as a DDL construct linked to a
SQL statement.

Fixes: #5656
Change-Id: I568bf40adc7edcf72ea6c7fd6eb9d07790de189e

4 years agoEnsure escaping of percent signs in columns, parameters
Mike Bayer [Sat, 17 Oct 2020 15:39:56 +0000 (11:39 -0400)] 
Ensure escaping of percent signs in columns, parameters

Improved support for column names that contain percent signs in the string,
including repaired issues involving anoymous labels that also embedded a
column name with a percent sign in it, as well as re-established support
for bound parameter names with percent signs embedded on the psycopg2
dialect, using a late-escaping process similar to that used by the
cx_Oracle dialect.

* Added new constructor for _anonymous_label() that ensures incoming
  string tokens based on column or table names will have percent
  signs escaped; abstracts away the format of the label.

* generalized cx_Oracle's quoted_bind_names facility into the compiler
  itself, and leveraged this for the psycopg2 dialect's issue with
  percent signs in names as well.  the parameter substitution is now
  integrated with compiler.construct_parameters() as well as the
  recently reworked set_input_sizes(), reducing verbosity in the
  cx_Oracle dialect.

Fixes: #5653
Change-Id: Ia2ad13ea68b4b0558d410026e5a33f5cb3fbab2c

4 years agoMerge "Add deprecation for base Executable.bind"
mike bayer [Sat, 17 Oct 2020 14:11:48 +0000 (14:11 +0000)] 
Merge "Add deprecation for base Executable.bind"

4 years agoAdd deprecation for base Executable.bind
Mike Bayer [Fri, 16 Oct 2020 16:03:11 +0000 (12:03 -0400)] 
Add deprecation for base Executable.bind

These attributes will be removed in SQLAlchemy 2.0.

Also alters the deprecation message to qualify the
type of object correctly.  this in turn requires changes
in the warnings filter and deprecation tests.

Change-Id: I5779d9813e88f42e5db0c7b5e3ffff1d1535c203

4 years agoGenericize setinputsizes and support pyodbc
Mike Bayer [Thu, 15 Oct 2020 22:18:03 +0000 (18:18 -0400)] 
Genericize setinputsizes and support pyodbc

Reworked the "setinputsizes()" set of dialect hooks to be correctly
extensible for any arbirary DBAPI, by allowing dialects individual hooks
that may invoke cursor.setinputsizes() in the appropriate style for that
DBAPI.   In particular this is intended to support pyodbc's style of usage
which is fundamentally different from that of cx_Oracle.  Added support
for pyodbc.

Fixes: #5649
Change-Id: I9f1794f8368bf3663a286932cfe3992dae244a10

4 years agoindicate legacy ping recipe for handle_error cases
Mike Bayer [Thu, 15 Oct 2020 17:21:34 +0000 (13:21 -0400)] 
indicate legacy ping recipe for handle_error cases

in prep for a new feature as part of #5648.

Change-Id: I6720b0ea797c188de5e8163f79fb7b7994d6e76e

4 years agomove misplaced section
Mike Bayer [Wed, 14 Oct 2020 22:18:13 +0000 (18:18 -0400)] 
move misplaced section

Change-Id: I472049fbdda70da94bbf1cf7b5e10d04721bc771

4 years agoMerge remote-tracking branch 'origin/pr/5636'
Mike Bayer [Wed, 14 Oct 2020 20:37:40 +0000 (16:37 -0400)] 
Merge remote-tracking branch 'origin/pr/5636'

Change-Id: I785a3c8a49f2d75279ade65bd86915de1178a3ff

4 years agoMerge "Add SQL Server 01000 disconnect"
mike bayer [Wed, 14 Oct 2020 20:34:43 +0000 (20:34 +0000)] 
Merge "Add SQL Server 01000 disconnect"

4 years agoblock python keywords from random list of names
Mike Bayer [Wed, 14 Oct 2020 17:50:44 +0000 (13:50 -0400)] 
block python keywords from random list of names

Change-Id: I0259bed2ee06e741889e8b9bed6bf6ad106fa425

4 years agoAdd SQL Server 01000 disconnect
Mike Bayer [Wed, 14 Oct 2020 16:05:40 +0000 (12:05 -0400)] 
Add SQL Server 01000 disconnect

Fixes: #5646
Change-Id: I25fcba7cf866871f1232b586e7e604162bd8cc43

4 years agoMerge "Deprecate strings indicating attribute names"
mike bayer [Wed, 14 Oct 2020 15:00:49 +0000 (15:00 +0000)] 
Merge "Deprecate strings indicating attribute names"

4 years agoAdd discussed changes 5636/head
Evan Taylor Yates [Tue, 13 Oct 2020 19:21:30 +0000 (12:21 -0700)] 
Add discussed changes

link: https://github.com/sqlalchemy/sqlalchemy/pull/5636
4 years agoDeprecate strings indicating attribute names
Mike Bayer [Mon, 12 Oct 2020 19:17:25 +0000 (15:17 -0400)] 
Deprecate strings indicating attribute names

Using strings to represent relationship names in ORM operations such as
:meth:`_orm.Query.join`, as well as strings for all ORM attribute names
in loader options like :func:`_orm.selectinload`
is deprecated and will be removed in SQLAlchemy 2.0.  The class-bound
attribute should be passed instead.  This provides much better specificity
to the given method, allows for modifiers such as ``of_type()``, and
reduces internal complexity.

Additionally, the ``aliased`` and ``from_joinpoint`` parameters to
:meth:`_orm.Query.join` are also deprecated.   The :func:`_orm.aliased`
construct now provides for a great deal of flexibility and capability
and should be used directly.

Fixes: #4705
Fixes: #5202
Change-Id: I32f61663d68026154906932913c288f269991adc

4 years agocherry-pick changelog update for 1.3.21
Mike Bayer [Mon, 12 Oct 2020 22:33:32 +0000 (18:33 -0400)] 
cherry-pick changelog update for 1.3.21

4 years agocherry-pick changelog from 1.3.20
Mike Bayer [Mon, 12 Oct 2020 22:33:31 +0000 (18:33 -0400)] 
cherry-pick changelog from 1.3.20

4 years agotypo
Mike Bayer [Mon, 12 Oct 2020 22:29:20 +0000 (18:29 -0400)] 
typo

Change-Id: I0a753a2b48ed932c3209b93df0a96efe90af17c5

4 years agochangelog edits for 1.3.20
Mike Bayer [Mon, 12 Oct 2020 22:22:01 +0000 (18:22 -0400)] 
changelog edits for 1.3.20

Change-Id: Ic053a30e9f0e6c99b638a0629e1192336bff3f76

4 years agoSupport indexing on expressions and functions for the MySQL dialect
RamonWill [Wed, 16 Sep 2020 21:47:21 +0000 (17:47 -0400)] 
Support indexing on expressions and functions for the MySQL dialect

A user noticed that creating an index where the "key part" was an expression
or function would raise an error for MySQL because the key part was not
parenthesized. The proposed change will check whether a key part is not a
Column or Unary Expression  and parenthesize if the case is False.

This fix also contains a minor fix to a test case that was previously incorrect
(`def test_create_index_expr():`).

**Have a nice day!**
Fixes: #5462
Closes: #5587
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5587
Pull-request-sha: 7515e50cd7435744fc79c210b2f3aa4c0546ba28

Change-Id: Id1b3b3026983c0e05808baa243e354f82b78180c

4 years agoMerge "Deprecate bound metadata"
mike bayer [Mon, 12 Oct 2020 19:51:53 +0000 (19:51 +0000)] 
Merge "Deprecate bound metadata"

4 years agoDeprecate bound metadata
Mike Bayer [Mon, 12 Oct 2020 17:16:14 +0000 (13:16 -0400)] 
Deprecate bound metadata

The :paramref:`_schema.MetaData.bind` argument as well as the overall
concept of "bound metadata" is deprecated in SQLAlchemy 1.4 and will be
removed in SQLAlchemy 2.0.  The parameter as well as related functions now
emit a :class:`_exc.RemovedIn20Warning` when :ref:`deprecation_20_mode` is
in use.

Added new parameter :paramref:`_automap.AutomapBase.prepare.autoload_with`
which supersedes :paramref:`_automap.AutomapBase.prepare.reflect`
and :paramref:`_automap.AutomapBase.prepare.engine`.

Fixes: #4634
Fixes: #5142
Change-Id: Iaabf9b481931e2fb68b97b5954c32e65772a298e

4 years agoDeprecate duplicated column names in Table definition
Mike Bayer [Thu, 3 Sep 2020 18:14:39 +0000 (14:14 -0400)] 
Deprecate duplicated column names in Table definition

The :class:`_schema.Table` class now raises a deprecation warning
when columns with the same name are defined. To replace a column a new
parameter :paramref:`_schema.Table.append_column.replace_existing` was
added to the :meth:`_schema.Table.append_column` method.

The :meth:`_expression.ColumnCollection.contains_column` will now
raises an error when called with a string, suggesting the caller
to use ``in`` instead.

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
Change-Id: I1d58c8ebe081079cb669e7ead60886ffc1b1a7f5

4 years agoMerge "Repair reduction in Over"
mike bayer [Mon, 12 Oct 2020 17:45:10 +0000 (17:45 +0000)] 
Merge "Repair reduction in Over"

4 years agoRepair reduction in Over
Mike Bayer [Mon, 12 Oct 2020 16:47:38 +0000 (12:47 -0400)] 
Repair reduction in Over

Fixed issue where a plain pickle dumps call of the :class:`_sql.Over`
construct didn't work.

Fixes: #5644
Change-Id: I4b07f74ecd5d52f0794128585367012200a38a36

4 years agoEnsure all cursor self.handle_exception() calls are covered
Mike Bayer [Mon, 12 Oct 2020 14:16:25 +0000 (10:16 -0400)] 
Ensure all cursor self.handle_exception() calls are covered

Fixes: #5642
Change-Id: I07a77483e6e2ec593d87d3d3467a4339c5f77a26

4 years agorepair pg8000 and pin to 1.16.6 min version
Mike Bayer [Mon, 12 Oct 2020 15:14:14 +0000 (11:14 -0400)] 
repair pg8000 and pin to 1.16.6 min version

Due to https://github.com/tlocke/pg8000/commit/3a2e7439ae3613367ec231218d7e0f541466d1e5
we no longer decode the description.  pin to 1.16.6 as minimum version
so that we don't need to track version changes in code.

Change-Id: I192c851eb2337f37467560a3cbb87f7235884788

4 years agoMerge "Drop python 3.5 support"
mike bayer [Sat, 10 Oct 2020 16:02:26 +0000 (16:02 +0000)] 
Merge "Drop python 3.5 support"

4 years agoMerge "generalize scoped_session proxying and apply to asyncio elements"
mike bayer [Sat, 10 Oct 2020 06:01:17 +0000 (06:01 +0000)] 
Merge "generalize scoped_session proxying and apply to asyncio elements"

4 years agogeneralize scoped_session proxying and apply to asyncio elements
Mike Bayer [Thu, 8 Oct 2020 19:20:48 +0000 (15:20 -0400)] 
generalize scoped_session proxying and apply to asyncio elements

Reworked the proxy creation used by scoped_session() to be
based on fully copied code with augmented docstrings and
moved it into langhelpers.  asyncio session, engine,
connection can now take
advantage of it so that all non-async methods are availble.

Overall implementation of most important accessors / methods
on AsyncConnection, etc. , including awaitable versions
of invalidate, execution_options, etc.

In order to support an event dispatcher on the async
classes while still allowing them to hold __slots__,
make some adjustments to the event system to allow
that to be present, at least rudimentally.

Fixes: #5628
Change-Id: I5eb6929fc1e4fdac99e4b767dcfd49672d56e2b2

4 years agoMerge "Add python 3.9 to ci test and wheel workflow"
mike bayer [Fri, 9 Oct 2020 21:22:34 +0000 (21:22 +0000)] 
Merge "Add python 3.9 to ci test and wheel workflow"

4 years agodont try to update on None query_str
Mike Bayer [Thu, 8 Oct 2020 23:49:42 +0000 (19:49 -0400)] 
dont try to update on None query_str

py2k coverage tests were failing because of this API
usage that seems to pass on Py3k but not py2k

Change-Id: Ic7ceb03c2660f411f487fce73ce5c2fa2c752031

4 years agoDrop python 3.5 support
Federico Caselli [Thu, 8 Oct 2020 19:01:19 +0000 (21:01 +0200)] 
Drop python 3.5 support

Fixes: #5634
Change-Id: Ie8d4076ee35234b535a04e6fb9321096df3f648b

4 years agoAdd python 3.9 to ci test and wheel workflow
Federico Caselli [Thu, 8 Oct 2020 18:34:02 +0000 (20:34 +0200)] 
Add python 3.9 to ci test and wheel workflow

Change-Id: I3b80b836ca547fa92f324acb265180cdeea17611

4 years agopin pytest lower bound at 4.6.11
Mike Bayer [Thu, 8 Oct 2020 16:52:39 +0000 (12:52 -0400)] 
pin pytest lower bound at 4.6.11

we need 4.6 to support Python 2.  however 4.6.0 is too low,
4.6.11 seems to work in both python 2 and 3, pin on that

Change-Id: I0a5995ca5e5bf08a06997130e4ffbaaceef8d942

4 years agoAdd changelog for pytest 6.x fix.
Mike Bayer [Thu, 8 Oct 2020 15:56:04 +0000 (11:56 -0400)] 
Add changelog for pytest 6.x fix.

pytest 6.x support was fixed in 40cdb9c for 1.3 and in ffafbd4
for master.   Add a note as this is an observable issue
in 1.3.19.

Fixes: #5635
Change-Id: Iee67822d6962800646546c69ee0ad0c494007c86

4 years agoRevert "Use monotonic time for pool age measurement"
Mike Bayer [Wed, 7 Oct 2020 14:09:41 +0000 (10:09 -0400)] 
Revert "Use monotonic time for pool age measurement"

This reverts commit 0220b58917b5a979891b5765f6ac5095e0368489.

I completely misread https://www.python.org/dev/peps/pep-0418/#rationale
and the accuracy of monotonic() is *worse* on windows than time.time(),
which is bizarre.

Change-Id: I2d571e268a2051bea68736507773d3904403af9e

4 years agoforce a sleep for test_reconnect
Mike Bayer [Wed, 7 Oct 2020 13:47:46 +0000 (09:47 -0400)] 
force a sleep for test_reconnect

as I dont have a windows machine to test I don't really know
how to get a millisecond-accurate timer for windows,
Python documentation claimed time.monotonic() did this however
the continued failure of test_reconnect indicates this is not the case
and that the timer is still bumping up by multi-millisecond
granularity.   force a delay instead.

Change-Id: I237b223eabc55c1d47ecece13873be1f7be20e47

4 years agoUse monotonic time for pool age measurement
Mike Bayer [Wed, 7 Oct 2020 12:42:48 +0000 (08:42 -0400)] 
Use monotonic time for pool age measurement

The internal clock used by the :class:`_pool.Pool` object is now
time.monotonic_time() under Python 3.  Under Python 2, time.time() is still
used, which is legacy. This clock is used to measure the age of a
connection against its starttime, and used in comparisons against the
pool_timeout setting as well as the last time the pool was marked as
invalid to determine if the connection should be recycled. Previously,
time.time() was used which was subject to inaccuracies as a result of
system clock changes as well as poor time resolution on windows.

Change-Id: I94f90044c1809508e26a5a00134981c2a00d0405

4 years agoMerge "limit "no identity" test to a hardcoded dialect"
mike bayer [Wed, 7 Oct 2020 11:42:57 +0000 (11:42 +0000)] 
Merge "limit "no identity" test to a hardcoded dialect"

4 years agoMerge "add --notimingintensive; block from github jobs"
mike bayer [Wed, 7 Oct 2020 04:59:10 +0000 (04:59 +0000)] 
Merge "add --notimingintensive; block from github jobs"

4 years agolimit "no identity" test to a hardcoded dialect
Mike Bayer [Wed, 7 Oct 2020 04:50:53 +0000 (00:50 -0400)] 
limit "no identity" test to a hardcoded dialect

this test can't require "skip identity_columns" because
older Postgresql and Oracle report false for "identity_columns",
but their dialects won't skip actually rendering.

for now the only option is to hardcode to a non-identity
dialect.

Change-Id: Ia4f39f393b4ba10b3e82601a22ab75200cd52909

4 years agoMerge "Handle case where InstanceState.obj returns None"
mike bayer [Wed, 7 Oct 2020 04:50:29 +0000 (04:50 +0000)] 
Merge "Handle case where InstanceState.obj returns None"

4 years agoadd --notimingintensive; block from github jobs
Mike Bayer [Wed, 7 Oct 2020 03:48:47 +0000 (23:48 -0400)] 
add --notimingintensive; block from github jobs

this provides a front-end option to disable tests marked
as timing_intensive, all of which are in test_pool, which are more
fragile and aren't consistent on the
github runners.   also remove /reduce unnecessary time.sleep()
from two other pool tests that are not timing intensive.

note that this removes test_hanging_connect_within_overflow
from the github runs via the timing_intensive requirement.

I've also removed MockReconnectTest from exclusions as those are
really important tests and they use mocks so should not have
platform dependent issues.   Need to see what the
windows failures are.

Closes: #5633
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5633
Pull-request-sha: 166833e16ec342dfa10edb287d7aa495ddd1b59d

Change-Id: Icb3d284a2a952e2495d80fa91e22e0b32a54340f

4 years agoMerge "Address minor comments from previous changes"
mike bayer [Wed, 7 Oct 2020 04:15:58 +0000 (04:15 +0000)] 
Merge "Address minor comments from previous changes"

4 years agoHandle case where InstanceState.obj returns None
Federico Caselli [Tue, 6 Oct 2020 19:21:46 +0000 (21:21 +0200)] 
Handle case where InstanceState.obj returns None

Fixed bug where a call ``InstanceState.obj()`` could return None when
synchronizing the instance states of the objects in the session in case
they become out of scope but are not yet finalized by the gc. This
case does not happen in cPython, but it may present itself in pypy.

The approach is to allow None to be gracefully handled by the
evaluator itself, ensuring it returns None in all cases when None
is passed in.

Fixes: #5631
Change-Id: I53d38fbea2e72b2e677c6e7f70bf075a58e58945

4 years agomodernize requirements for boolean constraint test
Mike Bayer [Wed, 7 Oct 2020 03:46:03 +0000 (23:46 -0400)] 
modernize requirements for boolean constraint test

this test was not actually working correctly against
mariadb and was "failing" (i.e. "passing") inappropriately
for pymysql, mysqlclient. it also started "passing" (i.e. "failing")
for mariadb as of 1.0.3.

modernize reqs here including for mssql bit behavior.

Change-Id: Ia88ee607ec8d59f6140a7e4a1174910382d53674

4 years agoUse preloaded for sql.util import in exc
Mike Bayer [Wed, 7 Oct 2020 01:46:03 +0000 (21:46 -0400)] 
Use preloaded for sql.util import in exc

Repaired a function-level import that was not using SQLAlchemy's standard
late-import system within the sqlalchemy.exc module.

Moved preloaded to sqlalchemy.util.preloaded so that it
does not depend on langhelpers which depends on exc.

Fixes: #5632
Change-Id: I61b7ce9cd461071ce543714739f67aa5aeb47fd6

4 years agoAddress minor comments from previous changes
Federico Caselli [Tue, 6 Oct 2020 18:19:49 +0000 (20:19 +0200)] 
Address minor comments from previous changes

Change how pypy is detected. From I0952e54ed9af2952ea340be1945311376ffc1ad2
Fix typos. From Ibb5871a457c0555f82b37e354e7787d15575f1f7

Change-Id: I9657e602267590f10a74df27a84e4292da94c30a

4 years agoMerge "Fetch first support"
mike bayer [Mon, 5 Oct 2020 13:55:55 +0000 (13:55 +0000)] 
Merge "Fetch first support"

4 years agoMerge "Improve some documentations"
mike bayer [Mon, 5 Oct 2020 13:35:47 +0000 (13:35 +0000)] 
Merge "Improve some documentations"

4 years agoAdd parens around unmarked clause
Evan Taylor Yates [Sun, 4 Oct 2020 00:04:44 +0000 (17:04 -0700)] 
Add parens around unmarked clause

I'm not 100% sure what this sentence is saying, but I'm pretty sure it needs either commas or parentheses to break it up a little. I think parens make the most sense in this case assuming I am reading it correctly. Here's the original sentence and proposed edit in plaintext:

ORIG
 "...persistent objects which were removed from a collection or in some cases a scalar attribute may also be pulled into the Session of a parent object;..."

EDIT
 "...persistent objects which were removed from a collection (or in some cases a scalar attribute) may also be pulled into the Session of a parent object;..."

4 years agoFetch first support
Federico Caselli [Tue, 29 Sep 2020 20:49:09 +0000 (22:49 +0200)] 
Fetch first support

Add support to ``FETCH {FIRST | NEXT} [ count ] {ROW | ROWS}
 {ONLY | WITH TIES}`` in the select for the supported backends,
currently PostgreSQL, Oracle and MSSQL.

Fixes: #5576
Change-Id: Ibb5871a457c0555f82b37e354e7787d15575f1f7

4 years agoEnable pypy tests on github workflow
Federico Caselli [Sat, 18 Apr 2020 16:10:59 +0000 (18:10 +0200)] 
Enable pypy tests on github workflow

Fixes: #5223
Change-Id: I0952e54ed9af2952ea340be1945311376ffc1ad2

4 years agoMerge "use execute_20 to preserve compiled cache"
mike bayer [Fri, 2 Oct 2020 16:07:30 +0000 (16:07 +0000)] 
Merge "use execute_20 to preserve compiled cache"

4 years agouse execute_20 to preserve compiled cache
Mike Bayer [Thu, 1 Oct 2020 22:39:42 +0000 (18:39 -0400)] 
use execute_20 to preserve compiled cache

Fixes: #5420
Change-Id: I3e5a255207da752b7b7cc9b8f41ad5e2ccd0b447

4 years agoaccommodate for null in sqlite regex handler
Mike Bayer [Fri, 2 Oct 2020 12:15:41 +0000 (08:15 -0400)] 
accommodate for null in sqlite regex handler

Fixes: #5624
Change-Id: Ic20dcde0a1e96b9981c63cac3cd34c7fdc7bd395

4 years agoMerge "raise on lower-case column shared to multiple tables"
mike bayer [Wed, 30 Sep 2020 13:56:55 +0000 (13:56 +0000)] 
Merge "raise on lower-case column shared to multiple tables"

4 years agoraise on lower-case column shared to multiple tables
Mike Bayer [Wed, 30 Sep 2020 12:37:57 +0000 (08:37 -0400)] 
raise on lower-case column shared to multiple tables

Fixed bug where an error was not raised for lower-case
:func:`_column` added to lower-case :func:`_table` object. This now raises
:class:`_exc.ArgumentError` which has always been the case for
upper-case :class:`_schema.Column` and :class:`_schema.Table`.

Fixes: #5618
Change-Id: Ifcbdf27c022fd2996a5b99559df71fc1c1e0f19c

4 years agofix too-short underline
Mike Bayer [Wed, 30 Sep 2020 13:01:32 +0000 (09:01 -0400)] 
fix too-short underline

Change-Id: Id9ac0b45f0859199e7db61ef5d4fac956b74b2ba

4 years agoMerge "Support for multiple hosts in PostgreSQL connection string"
mike bayer [Wed, 30 Sep 2020 12:07:25 +0000 (12:07 +0000)] 
Merge "Support for multiple hosts in PostgreSQL connection string"

4 years agoScan for tables without relying upon whereclause
Mike Bayer [Tue, 29 Sep 2020 18:17:42 +0000 (14:17 -0400)] 
Scan for tables without relying upon whereclause

Fixed bug where an UPDATE statement against a JOIN using MySQL multi-table
format would fail to include the table prefix for the target table if the
statement had no WHERE clause, as only the WHERE clause were scanned to
detect a "multi table update" at that particular point.  The target
is now also scanned if it's a JOIN to get the leftmost table as the
primary table and the additional entries as additional FROM entries.

Fixes: #5617
Change-Id: I26d74afebe06e28af28acf960258f170a1627823

4 years agobump variance on test_string, test_unicode
Mike Bayer [Tue, 29 Sep 2020 19:44:33 +0000 (15:44 -0400)] 
bump variance on test_string, test_unicode

a recent rerun of profiles added more profiling data that's
failing over small differences.   15% variance is fine for these
tests that are looking for thousands of encode calls.

Change-Id: I33dac346b2ff07f86b4bc278a7309ca9b7efbaab

4 years agoImprove some documentations
Federico Caselli [Sat, 26 Sep 2020 14:02:05 +0000 (16:02 +0200)] 
Improve some documentations

Change-Id: Ibcb0da3166b94aa58fa92d544c3e5cf75844546e

4 years agoAdd reflection for Identity columns
Federico Caselli [Sat, 19 Sep 2020 20:29:38 +0000 (22:29 +0200)] 
Add reflection for Identity columns

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

Fixed compilation error on oracle for sequence and identity column
``nominvalue`` and ``nomaxvalue`` options that require no space in them.

Improved test compatibility with oracle 18.

As part of the support for reflecting :class:`_schema.Identity` objects,
the method :meth:`_reflection.Inspector.get_columns` no longer returns
``mssql_identity_start`` and ``mssql_identity_increment`` as part of the
``dialect_options``. Use the information in the ``identity`` key instead.

The mssql dialect will assume that at least MSSQL 2005 is used.
There is no hard exception raised if a previous version is detected,
but operations may fail for older versions.

Fixes: #5527
Fixes: #5324
Change-Id: If039fe637c46b424499e6bac54a2cbc0dc54cb57

4 years agoupgrade to black 20.8b1
Mike Bayer [Mon, 28 Sep 2020 18:08:59 +0000 (14:08 -0400)] 
upgrade to black 20.8b1

It's better, the majority of these changes look more readable to me.
also found some docstrings that had formatting / quoting issues.

Change-Id: I582a45fde3a5648b2f36bab96bad56881321899b

4 years agoAdd deprecation warning for .join().alias()
Gord Thompson [Sun, 13 Sep 2020 18:37:40 +0000 (12:37 -0600)] 
Add deprecation warning for .join().alias()

The :meth:`_sql.Join.alias` method is deprecated and will be removed in
SQLAlchemy 2.0.   An explicit select + subquery, or aliasing of the inner
tables, should be used instead.

Fixes: #5010
Change-Id: Ic913afc31f0d70b0605f9a7af2742a0de1f9ad19

4 years agoMerge "build the full compilestate every time"
mike bayer [Mon, 28 Sep 2020 13:56:58 +0000 (13:56 +0000)] 
Merge "build the full compilestate every time"

4 years agoMerge "dont use uninstrument event to dispose registry entry"
mike bayer [Mon, 28 Sep 2020 13:54:25 +0000 (13:54 +0000)] 
Merge "dont use uninstrument event to dispose registry entry"

4 years agodont use uninstrument event to dispose registry entry
Mike Bayer [Mon, 28 Sep 2020 02:40:09 +0000 (22:40 -0400)] 
dont use uninstrument event to dispose registry entry

since 450f5c0d6519a439f4025c3892fe4c we've been seeing
errors during the uninstrument_class event where first
we saw an internal weakref being collected earlier than seen,
then fixing that we saw the listener collection changing during
iteration for similar reasons.

we would assume the issue is because of the interaction between
mapper / instrumentation/ registry during a test teardown
and the usage of the uninstrument_class event within this
interaction.   this interaction is too fundamental to be
relying upon this event in any case and when I wrote this
new code i was planning on changing that part in any case,
I just forgot.

Change-Id: I15744e01bb4d3349bfd529593ebd23eae658eaab

4 years agobuild the full compilestate every time
Mike Bayer [Mon, 28 Sep 2020 03:18:57 +0000 (23:18 -0400)] 
build the full compilestate every time

the ORMSelectCompileState was trying to get away with
not building out the "froms" list of the state, but we need
this for select.froms.   Build this out and add some tests
for select(), including some other state-oriented use cases.

Fixes: #5614
Change-Id: I29ca200f292cbae87c722bc97a89d7c453d7d27a

4 years agoset pytest rootdir
Mike Bayer [Mon, 28 Sep 2020 02:19:27 +0000 (22:19 -0400)] 
set pytest rootdir

With pytest 6.1.0 the root directory calculation logic has
changed and is unreliable on our jenkins setup.   make
sure this is set explicitly.

Change-Id: I1d48b887030c32d2f3361fc36e65e8a988d2ba81
References: https://github.com/pytest-dev/pytest/issues/7807

4 years agoMerge "Accommodate for same base class multiple times in inherits list"
mike bayer [Mon, 28 Sep 2020 02:25:37 +0000 (02:25 +0000)] 
Merge "Accommodate for same base class multiple times in inherits list"

4 years agoRepair erroneous "future" symbol
Mike Bayer [Sun, 27 Sep 2020 15:06:48 +0000 (11:06 -0400)] 
Repair erroneous "future" symbol

the change in 1e800285508ecd869c6874fed failed to fully
remove the "future" symbol which then got confused against the
import of the "future" package itself, which is also not needed.
remove it entirely.

pin pytest < 6.1 to see if new error condition may be avoided

Change-Id: Ibe45040120d3772c39faef4a61ed26f90b60c79e