]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
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

4 years agoAccommodate for same base class multiple times in inherits list
Mike Bayer [Sun, 27 Sep 2020 15:44:58 +0000 (11:44 -0400)] 
Accommodate for same base class multiple times in inherits list

Improved declarative inheritance scanning to not get tripped up when the
same base class appears multiple times in the base inheritance list.

Fixes: #4699
Change-Id: I932e735cd2e2c1efa935936c84219924225d10f1

4 years agoSupport pytest 6.x
Mike Bayer [Sun, 27 Sep 2020 01:01:01 +0000 (21:01 -0400)] 
Support pytest 6.x

pytest has removed support for pytest.Class().collect()
and we need to use from_parent.

Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4

4 years agoformatting fixes, some content addition
Mike Bayer [Fri, 25 Sep 2020 04:10:04 +0000 (00:10 -0400)] 
formatting fixes, some content addition

Change-Id: I807f9763252cdb18ba8702cf42fdb2a7d4c72b52

4 years agoMerge "new docs WIP"
mike bayer [Fri, 25 Sep 2020 03:19:21 +0000 (03:19 +0000)] 
Merge "new docs WIP"

4 years agonew docs WIP
Mike Bayer [Thu, 17 Sep 2020 22:15:42 +0000 (18:15 -0400)] 
new docs WIP

This WIP is part of the final push for 1.4's docs
to fully "2.0-ize" what we can, and have it all ready.

So far this includes a rewrite of the 2.0 migration,
set up for the 1.4 /2.0 docs style, and a total redesign
of the index page using a new flex layout in zzzeeksphinx.

It also reworks some of the API reference sections
to have more subheaders.   zzzeeksphinx is also enhanced
to provide automatic summaries for all api doc section.

Change-Id: I01d360cb9c8749520246b96ee6496143c6037918

4 years agoMerge "Improve Asyncpg json handling"
mike bayer [Thu, 24 Sep 2020 02:19:18 +0000 (02:19 +0000)] 
Merge "Improve Asyncpg json handling"

4 years agoImprove Asyncpg json handling
Federico Caselli [Mon, 21 Sep 2020 17:59:00 +0000 (19:59 +0200)] 
Improve Asyncpg json handling

Set default type codec for ``json`` and ``jsonb`` types when using
the asyncpg driver. By default asyncpg will not decode them and return
strings instead.

Fixes: #5584
Change-Id: I41348eff8096ccf87b952d7e797c0694c6c4b5c4

4 years agoAdd pypi shields
Mike Bayer [Wed, 23 Sep 2020 18:47:43 +0000 (14:47 -0400)] 
Add pypi shields

These are all available from the same shields.io source,
courtesy @dolfinus

Fixes: #5594
Change-Id: I985c415f50627d328384a8fddf9a1457663ee00d

4 years agotry out the github stale hook.
Mike Bayer [Wed, 23 Sep 2020 16:04:18 +0000 (12:04 -0400)] 
try out the github stale hook.

This will mark an issue with the "stale" label after
5 days and close after 7.

The goal is that it will mark "question" issues as stale
automatically.

it doesn't give us a way to link it to that label however,
and we have to define it in terms of labels to exclude.

Change-Id: I7c34f4e8fdf4ee0a15baa93b5831e5cdcf72dcc8

4 years agoSupport for multiple hosts in PostgreSQL connection string
RamonWill [Wed, 2 Sep 2020 22:43:53 +0000 (18:43 -0400)] 
Support for multiple hosts in PostgreSQL connection string

Provide support for multiple hosts in the PostgreSQL connection string.

A user requested for SQLAlchemy to support multiple hosts within a PostgreSQL URL string. The proposed fix allows this. In the event that the url contains multiple hosts the proposed code will convert the query["hosts"] tuple into a single string. This allows the hosts to then get converted into a valid dsn variable in the psycopg2 connect function.

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!**
Fixes: #4392
Closes: #5554
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5554
Pull-request-sha: 3f7a0ab8df9f1411a9f1ac0e152583bc7bf0c365

Change-Id: I3f3768d51b8331de786ffdc025b7ecfc662eafe5

4 years agoMerge "Deprecate negative slice indexes"
mike bayer [Tue, 22 Sep 2020 19:47:21 +0000 (19:47 +0000)] 
Merge "Deprecate negative slice indexes"

4 years agoMerge "Tweak docker config for mssql"
mike bayer [Tue, 22 Sep 2020 19:00:06 +0000 (19:00 +0000)] 
Merge "Tweak docker config for mssql"

4 years agoDeprecate negative slice indexes
Mike Bayer [Tue, 22 Sep 2020 14:26:35 +0000 (10:26 -0400)] 
Deprecate negative slice indexes

The "slice index" feature used by :class:`_orm.Query` as well as by the
dynamic relationship loader will no longer accept negative indexes in
SQLAlchemy 2.0.  These operations do not work efficiently and load the
entire collection in, which is both surprising and undesirable.   These
will warn in 1.4 unless the :paramref:`_orm.Session.future` flag is set in
which case they will raise IndexError.

Fixes: #5606
Change-Id: I5f5dcf984a8f41ab3d0e233ef7553e77fd99a771

4 years agoExpect collected weak reference in ORM listener
Mike Bayer [Tue, 22 Sep 2020 13:00:44 +0000 (09:00 -0400)] 
Expect collected weak reference in ORM listener

CI is showing that this listener may be triggered
when the target, a mapped class, has been garbage collected.

I'm not able to reproduce this locally.

Change-Id: Iad96c088a9a3dc28c4bcd716e293c03d3b312efd

4 years agoMerge "restore slice methods to dynamic query"
mike bayer [Tue, 22 Sep 2020 01:54:52 +0000 (01:54 +0000)] 
Merge "restore slice methods to dynamic query"

4 years agorestore slice methods to dynamic query
Mike Bayer [Tue, 22 Sep 2020 00:17:04 +0000 (20:17 -0400)] 
restore slice methods to dynamic query

in f0f08db5715e41cc08e57dbc76a85300b these got
lost, put them back and test

Change-Id: Id1962e1f5d6160fe222becec5a8e32ec6a40017a

4 years agoRaise if unique() not applied to 2.0 joined eager load results
Mike Bayer [Mon, 21 Sep 2020 21:28:03 +0000 (17:28 -0400)] 
Raise if unique() not applied to 2.0 joined eager load results

The automatic uniquing of rows on the client side is turned off for the new
:term:`2.0 style` of ORM querying.  This improves both clarity and
performance.  However, uniquing of rows on the client side is generally
necessary when using joined eager loading for collections, as there
will be duplicates of the primary entity for each element in the
collection because a join was used.  This uniquing must now be manually
enabled and can be achieved using the new
:meth:`_engine.Result.unique` modifier.   To avoid silent failure, the ORM
explicitly requires the method be called when the result of an ORM
query in 2.0 style makes use of joined load collections.    The newer
:func:`_orm.selectinload` strategy is likely preferable for eager loading
of collections in any case.

This changeset also fixes an issue where ORM-style "single entity"
results would not apply unique() correctly if results were returned
as tuples.

Fixes: #4395
Change-Id: Ie62e0cb68ef2a6d2120e968b79575a70d057212e

4 years agoTweak docker config for mssql
Gord Thompson [Sun, 20 Sep 2020 20:43:33 +0000 (14:43 -0600)] 
Tweak docker config for mssql

Change-Id: Iae6fca41976f9cd7a3870f18eadfbea146d572dd

4 years agoMerge "Stringify correctly for non-str exception argument"
mike bayer [Sun, 20 Sep 2020 19:01:53 +0000 (19:01 +0000)] 
Merge "Stringify correctly for non-str exception argument"

4 years agoStringify correctly for non-str exception argument
Andrzej Bartosiński [Sat, 19 Sep 2020 16:47:46 +0000 (12:47 -0400)] 
Stringify correctly for non-str exception argument

Fixed issue where a non-string object sent to
:class:`_exc.SQLAlchemyError` or a subclass, as occurs with some third
party dialects, would fail to stringify correctly. Pull request
courtesy Andrzej Bartosiński.

Fixes: #5599
Closes: #5600
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5600
Pull-request-sha: cdccccc42a6ac8de771593a43ee8675bfd8dbeb6

Change-Id: Icd710d9015abc80f61a84893d75fbb33ee0fe46e

4 years agoFix has_table() for mssql temporary tables
Gord Thompson [Fri, 18 Sep 2020 22:33:17 +0000 (16:33 -0600)] 
Fix has_table() for mssql temporary tables

Fixes: #5597
Fixes the issue where :meth:`_reflection.has_table` always returns
``False`` for temporary tables.

Change-Id: I03ab04c849a157ce8fd28c07ec3bf4407b0f2c94

4 years agoMerge "Complete deprecation of from_self()"
mike bayer [Sat, 19 Sep 2020 03:10:47 +0000 (03:10 +0000)] 
Merge "Complete deprecation of from_self()"

4 years agoComplete deprecation of from_self()
Mike Bayer [Fri, 18 Sep 2020 17:29:42 +0000 (13:29 -0400)] 
Complete deprecation of from_self()

For most from_self() tests, move them into
test/orm/test_deprecated.py and replace the existing
test with one that uses aliased() plus a subquery.
This then revealed a few more issues.

Related items:

* Added slice() method to GenerativeSelect, to match that
  of orm.Query and to make possible migration of one of the
  from_self() tests.  moved the utility functions used for this
  from orm/util into sql/util.

* repairs a caching issue related to subqueryload
  where information being derived from the cached path info
  was mixing up with query information based on the per-query
  state, specifically an AliasedClass that is per query.

* for the above issue, it seemed like path_registry maybe
  had to change so that it represents AliasedClass objects
  as their cache key rather than on identity, but it wasn't
  needed.  still seems like it would be more correct.

* enhances the error message raised by coercions for a case
  such as when an AliasedClass holds onto a select() object
  and not a subquery(); will name the original and resolved
  object for clarity  (although how is AliasedClass able to
  accept a Select() object in the first place?)

* Added _set_propagate_attrs() to Query so that again if
  it's passed to AliasedClass, it doesn't raise an error
  during coercion, but again maybe that should also be
  rejected up front

Fixes: #5368
Change-Id: I5912aa611d899acc87a75eb5ee9f95990592f210

4 years agoAdd support for Azure authentication options
Gord Thompson [Thu, 17 Sep 2020 16:32:31 +0000 (10:32 -0600)] 
Add support for Azure authentication options

Fixes: #5592
Change-Id: I0688e5ea0fc6b01a0b72f397daea8f57a2ec0766

4 years agoMerge "Create a framework to allow all SQLALCHEMY_WARN_20 to pass"
mike bayer [Wed, 16 Sep 2020 18:45:51 +0000 (18:45 +0000)] 
Merge "Create a framework to allow all SQLALCHEMY_WARN_20 to pass"

4 years agoCreate a framework to allow all SQLALCHEMY_WARN_20 to pass
Mike Bayer [Mon, 17 Aug 2020 21:24:27 +0000 (17:24 -0400)] 
Create a framework to allow all SQLALCHEMY_WARN_20 to pass

As the test suite has widespread use of many patterns
that are deprecated, enable SQLALCHEMY_WARN_20 globally
for the test suite but then break the warnings filter
out into a whole list of all the individual warnings
we are looking for.  this way individual changesets
can target a specific class of warning, as many of these
warnings will indivdidually affect dozens of files
and potentially hundreds of lines of code.

Many warnings are also resolved here as this
patch started out that way.   From this point
forward there should be changesets that target a
subset of the warnings at a time.

For expediency, updates some migration 2.0 docs
for ORM as well.

Change-Id: I98b8defdf7c37b818b3824d02f7668e3f5f31c94

4 years agoDon't change asyncpg's "char" codec
Mike Bayer [Wed, 16 Sep 2020 12:26:14 +0000 (08:26 -0400)] 
Don't change asyncpg's "char" codec

This codec was used to ensure the "pg_attribute.generated"
column comes back as a string and not bytes, matching how
other PG drivers treat this datatype.   However, this breaks
asyncpg's internal implementation of set_type_codec going forward
and the "char" datatype is actually a bytes in any case.
So at the moment it appears psycopg2/pg8000 are broken for mis-treatment
of the datatype and asyncpg is broken in that it was allowing
us to change a codec that it appears to rely upon internally.

Fixes: #5586
Change-Id: I937eba315904721aa4e2726b95432910a8affe5f

4 years agoMerge "Fix ORM gc-related test that seems to be failing on CI"
mike bayer [Wed, 16 Sep 2020 14:43:40 +0000 (14:43 +0000)] 
Merge "Fix ORM gc-related test that seems to be failing on CI"