]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoFix typos 5502/head
Karthikeyan Singaravelan [Sun, 9 Aug 2020 10:02:57 +0000 (10:02 +0000)] 
Fix typos

4 years agorender INSERT/UPDATE column expressions up front; pass state
Mike Bayer [Sat, 8 Aug 2020 17:03:17 +0000 (13:03 -0400)] 
render INSERT/UPDATE column expressions up front; pass state

Fixes related to rendering of complex UPDATE DML
which was not correctly preserving positional parameter
order in conjunction with DML features that are only known
to work on the PostgreSQL database.    Both pg8000
and asyncpg use positional parameters which is why these
issues are suddenly apparent.

crud.py now takes on the task of rendering the column
expressions for SET or VALUES so that for the very unusual
case that the column expression is a compound expression
that includes a bound parameter (namely an array index),
the bound parameter order is preserved.

Additionally, crud.py passes through the positional_names
keyword argument into bindparam_string() which is necessary
when CTEs are being rendered, as PG supports complex
CTE / INSERT / UPDATE scenarios.

Change-Id: I7f03920500e19b721636b84594de78a5bfdcbc82

4 years agoDon't link on_connect to first_connect event handler
Mike Bayer [Fri, 7 Aug 2020 18:51:33 +0000 (14:51 -0400)] 
Don't link on_connect to first_connect event handler

Adjusted the dialect initialization process such that the
:meth:`_engine.Dialect.on_connect` is not called a second time on the first
connection.   The hook is called first, then the
:meth:`_engine.Dialect.initialize` is called if that connection is the
first for that dialect, then no more events are called.   This eliminates
the two calls to the "on_connect" function which can produce very difficult
debugging situations.

Fixes: #5497
Change-Id: Icefc2e884e30ee7b4ac84b99dc54bf992a6085e3

4 years agoMerge "Add complete platform data to profiling data"
mike bayer [Fri, 7 Aug 2020 17:27:15 +0000 (17:27 +0000)] 
Merge "Add complete platform data to profiling data"

4 years agoMerge "Pass schema_translate_map from DDLCompiler to SQLCompiler"
mike bayer [Fri, 7 Aug 2020 17:22:14 +0000 (17:22 +0000)] 
Merge "Pass schema_translate_map from DDLCompiler to SQLCompiler"

4 years agoInclude bulk update/delete in RoutingSession example
Mike Bayer [Fri, 7 Aug 2020 16:32:50 +0000 (12:32 -0400)] 
Include bulk update/delete in RoutingSession example

Fixes: #5407
Change-Id: Ia0965dbc88d744cded5c23021898388f2cf95f8d

4 years agoAdd complete platform data to profiling data
Federico Caselli [Mon, 27 Jul 2020 19:57:32 +0000 (21:57 +0200)] 
Add complete platform data to profiling data

Initially to distinsuish between arm and x86_64
architecture, expand out the profile key to include
machine, system, python impl in all cases.

Ref: #5436
Change-Id: I7e48f0462ba7d9c680b2dac45ce7b0cf709b9b22

4 years agoPass schema_translate_map from DDLCompiler to SQLCompiler
Mike Bayer [Fri, 7 Aug 2020 15:24:29 +0000 (11:24 -0400)] 
Pass schema_translate_map from DDLCompiler to SQLCompiler

Fixed issue where the
:paramref:`_engine.Connection.execution_options.schema_translate_map`
feature would not take effect when the :meth:`_schema.Sequence.next_value`
function function for a :class:`_schema.Sequence` were used in the
:paramref:`_schema.Column.server_default` parameter and the create table
DDL were emitted.

Fixes: #5500
Change-Id: I74a9fa13d22749d06c8202669f9ea220d9d984d9

4 years agobase all_orm_descriptors ordering on cls.__dict__ + cls.__mro__
Mike Bayer [Thu, 6 Aug 2020 19:53:17 +0000 (15:53 -0400)] 
base all_orm_descriptors ordering on cls.__dict__ + cls.__mro__

Adjusted the workings of the :meth:`_orm.Mapper.all_orm_descriptors`
accessor to represent the attributes in the order that they are located in
a deterministic way, assuming the use of Python 3.6 or higher which
maintains the sorting order of class attributes based on how they were
declared.   This sorting is not guaranteed to match the declared order of
attributes in all cases however; see the method documentation for the exact
scheme.

Fixes: #5494
Change-Id: I6ee8d4ace3eb8b3f7c9c0f2a3d7e27b5f62abfd3

4 years agorevise asyncio verbiage a bit
Mike Bayer [Thu, 6 Aug 2020 14:16:38 +0000 (10:16 -0400)] 
revise asyncio verbiage a bit

Change-Id: I8bdf7c3271b8284ab82e01558024f933e1ee7b49

4 years agoMerge "Documentation updates for 1.4"
mike bayer [Thu, 6 Aug 2020 03:33:37 +0000 (03:33 +0000)] 
Merge "Documentation updates for 1.4"

4 years agoMerge "Implement relationship AND criteria; global loader criteria"
mike bayer [Thu, 6 Aug 2020 03:33:13 +0000 (03:33 +0000)] 
Merge "Implement relationship AND criteria; global loader criteria"

4 years agoDocumentation updates for 1.4
Mike Bayer [Sun, 28 Jun 2020 15:59:34 +0000 (11:59 -0400)] 
Documentation updates for 1.4

* major additions to 1.4 migration doc; removed additional
  verbosity regarding caching methodology and reorganized the
  doc to present itself more as a "what's changed" guide

* as we now have a path for asyncio, update that doc so that
  we aren't spreading obsolete information

* updates to the 2.0 migration guide with latest info, however
  this is still an architecture doc and not a migration guide
  yet, will need further rework.

* start really talking about 1.x vs. 2.0 style everywhere.  Querying
  is most of the docs so this is going to be a prominent
  theme, start getting it to fit in

* Add introductory documentation for ORM example sections as these
  are too sparse

* new documentation for do_orm_execute(), many separate sections,
  adding deprecation notes to before_compile() and similar

* new example suites to illustrate do_orm_execute(),
  with_loader_criteria()

* modernized horizontal sharding examples and added a separate
  example to distinguish between multiple databases and single
  database w/ multiple tables use case

* introducing DEEP ALCHEMY, will use zzzeeksphinx 1.1.6

* no name for the alchemist yet however the dragon's name
  is Flambé

Change-Id: Id6b5c03b1ce9ddb7b280f66792212a0ef0a1c541

4 years agoImplement relationship AND criteria; global loader criteria
Mike Bayer [Thu, 6 Aug 2020 01:47:43 +0000 (21:47 -0400)] 
Implement relationship AND criteria; global loader criteria

Added the ability to add arbitrary criteria to the ON clause generated
by a relationship attribute in a query, which applies to methods such
as :meth:`_query.Query.join` as well as loader options like
:func:`_orm.joinedload`.   Additionally, a "global" version of the option
allows limiting criteria to be applied to particular entities in
a query globally.

Documentation is minimal at this point, new examples will
be coming in a subsequent commit.

Some adjustments to execution options in how they are represented
in the ORMExecuteState as well as well as a few ORM tests that
forgot to get merged in a preceding commit.

Fixes: #4472
Change-Id: I2b8fc57092dedf35ebd16f6343ad0f0d7d332beb

4 years agoMerge "Fixes for MySQL 8"
mike bayer [Thu, 6 Aug 2020 02:06:45 +0000 (02:06 +0000)] 
Merge "Fixes for MySQL 8"

4 years agoFixes for MySQL 8
Mike Bayer [Thu, 6 Aug 2020 00:32:02 +0000 (20:32 -0400)] 
Fixes for MySQL 8

MySQL 8.0.19 has some changes to how it reports on display widths
for int types (seems like it omits it in some cases), and also
no longer cares about the length for YEAR.   Another adjustment
to the ordering of constraints reported in one case also.
At least one CI machine is at 8.0.21 now.

Change-Id: Ie2101bed3ad75dcbb62cd05abe95ef14ad895cf5

4 years agoConvert lazy loader, selectinload, load_on_ident to lambda statements
Mike Bayer [Wed, 5 Aug 2020 21:58:48 +0000 (17:58 -0400)] 
Convert lazy loader, selectinload, load_on_ident to lambda statements

Building on newly robust lambdas in
I29a513c98917b1d503abfdd61e6b6e8800851aa8,
convert key loading off of the "baked" system so that baked
is no longer used by the ORM.

Change-Id: I3abfb45dd6e50f84f29d39434caa0b550ce27864

4 years agoRobustness for lambdas, lambda statements
Mike Bayer [Wed, 5 Aug 2020 20:42:26 +0000 (16:42 -0400)] 
Robustness for lambdas, lambda statements

in order to accommodate relationship loaders
with lambda caching, a lot more is needed.  This is
a full refactor of the lambda system such that it
now has two levels of caching; the first level caches what
can be known from the __code__ element, then the next level
of caching is against the lambda itself and the contents
of __closure__.  This allows for the elements inside
the lambdas, like columns and entities, to change and
then be part of the cache key.  Lazy/selectinloads' use of
baked queries had to add distinct cache key elements,
which was attempted here but overall things needed to be
more robust than that.

This commit is broken out from the very long and sprawling
commit at Id6b5c03b1ce9ddb7b280f66792212a0ef0a1c541 .

Change-Id: I29a513c98917b1d503abfdd61e6b6e8800851aa8

4 years agoAdd MariaDB 1927 to is_disconnect codes
Mike Bayer [Wed, 5 Aug 2020 14:31:21 +0000 (10:31 -0400)] 
Add MariaDB 1927 to is_disconnect codes

Added MariaDB code 1927 to the list of "disconnect" codes, as recent
MariaDB versions apparently use this code when the database server was
stopped.

Fixes: #5493
Change-Id: I63f1d692f36cb0411ead278556e3f8c64ab72ea4

4 years agoMerge "Establish future behavior for Session cascade backrefs, bind"
mike bayer [Wed, 5 Aug 2020 04:49:57 +0000 (04:49 +0000)] 
Merge "Establish future behavior for Session cascade backrefs, bind"

4 years agofix formatting
Mike Bayer [Tue, 4 Aug 2020 14:40:46 +0000 (10:40 -0400)] 
fix formatting

Change-Id: I8315cfef6e5c4b87d64fc770998a1229cc690870

4 years agoAdd note that fast_executemany uses memory
Mike Bayer [Tue, 4 Aug 2020 14:13:51 +0000 (10:13 -0400)] 
Add note that fast_executemany uses memory

Ideally this would be a per-execution option, or Pyodbc
could perhaps run the data in chunks.

Fixes: #5334
Change-Id: If4a11b312346b8e4c2b8cd38840b3a2ba56dec3b

4 years agoMerge "Genericize str() for types"
mike bayer [Sun, 2 Aug 2020 03:18:12 +0000 (03:18 +0000)] 
Merge "Genericize str() for types"

4 years agoMerge "Unpin pydocstyle, minimum for flake8-docstrings 1.3.1"
mike bayer [Sun, 2 Aug 2020 00:17:02 +0000 (00:17 +0000)] 
Merge "Unpin pydocstyle, minimum for flake8-docstrings 1.3.1"

4 years agoMerge "Improve github action workflows"
mike bayer [Sun, 2 Aug 2020 00:11:33 +0000 (00:11 +0000)] 
Merge "Improve github action workflows"

4 years agoGenericize str() for types
Mike Bayer [Sat, 1 Aug 2020 17:57:04 +0000 (13:57 -0400)] 
Genericize str() for types

Remove lookup logic that attempts to locate a dialect for a type,
just use StrSQLTypeCompiler.

Cleaned up the internal ``str()`` for datatypes so that all types produce a
string representation without any dialect present, including that it works
for third-party dialect types without that dialect being present.  The
string representation defaults to being the UPPERCASE name of that type
with nothing else.

Fixes: #4262
Change-Id: I02149e8a1ba1e7336149e962939b07ae0df83c6b

4 years agoEstablish future behavior for Session cascade backrefs, bind
Mike Bayer [Sat, 1 Aug 2020 19:05:53 +0000 (15:05 -0400)] 
Establish future behavior for Session cascade backrefs, bind

The behavior of the :paramref:`_orm.relationship.cascade_backrefs` flag
will be reversed in 2.0 and set to ``False`` unconditionally, such that
backrefs don't cascade save-update operations from a forwards-assignment to
a backwards assignment.   A 2.0 deprecation warning is emitted when the
parameter is left at its default of ``True`` at the point at which such a
cascade operation actually takes place.   The new behavior can be
established as always by setting the flag to ``False`` on a specific
:func:`_orm.relationship`, or more generally can be set up across the board
by setting the the :paramref:`_orm.Session.future` flag to True.

Additionally in the interests of expediency, this commit will also
move Session away from making use of bound metadata if the future=True
flag is set.   An application that sets future=True should ideally
have to change as little else as possible for full 2.0 behavior.

Fixes: #5150
Change-Id: I490d1d61f09c62ffc2de983208aeed25dfe48aec

4 years agoClean python UUID imports
Vlastimil Zíma [Thu, 30 Jul 2020 07:56:39 +0000 (03:56 -0400)] 
Clean python UUID imports

Fixes: #5482
All supported python versions provide 'uuid' module.

Closes: #5483
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5483
Pull-request-sha: fc32498a8b639ff21d5898100592782826d2c6dd

Change-Id: I8b41b811da7576f724353425dad5d6f581641b4b

4 years agoMerge "Consider default FROM DUAL for MySQL"
mike bayer [Wed, 29 Jul 2020 18:44:28 +0000 (18:44 +0000)] 
Merge "Consider default FROM DUAL for MySQL"

4 years agoMerge "Imply `sync_backref` flag in a viewonly relationship"
mike bayer [Wed, 29 Jul 2020 18:42:49 +0000 (18:42 +0000)] 
Merge "Imply `sync_backref` flag in a viewonly relationship"

4 years agoUnpin pydocstyle, minimum for flake8-docstrings 1.3.1
Mike Bayer [Sat, 9 May 2020 14:55:19 +0000 (10:55 -0400)] 
Unpin pydocstyle, minimum for flake8-docstrings 1.3.1

Per https://gitlab.com/pycqa/flake8-docstrings/-/issues/36#note_199635329
flake8-docstrings has repaired the pydocstyle issue as of
1.3.1, so unpin pydocstyle.

Change-Id: I117a5df58ff6c5a4087c433ab817ad305df6a17b

4 years agoConsider default FROM DUAL for MySQL
Mike Bayer [Tue, 28 Jul 2020 20:46:53 +0000 (16:46 -0400)] 
Consider default FROM DUAL for MySQL

MySQL claims it doesn't require FROM DUAL for no
FROM clause even though the issue at #5481 locates
a case which requires one.  See if FROM DUAL the same
way as Oracle without attempting to guess is potentially
feasible.

Fixes: #5481
Change-Id: I2a28876c10a8ce2d121cd344dcdd837db321d4ab

4 years agoPassive deletes edits
Mike Bayer [Wed, 29 Jul 2020 17:14:49 +0000 (13:14 -0400)] 
Passive deletes edits

Change-Id: I863df033cae9bda4ce96d446a92984ae82797565

4 years agoRemove errant link
Mike Bayer [Wed, 29 Jul 2020 16:51:29 +0000 (12:51 -0400)] 
Remove errant link

The link to "passive_deletes" has moved in
9e1ee412b8650761af6df993e119906682604728 however the tag
stayed here and caused a self link.

Fixes: #5484
Change-Id: I3ac5970be30504367294b9e9a83eb5a2c579cc71

4 years agoMerge "Ensure is_comparison passed for PG RANGE op() methods"
mike bayer [Wed, 29 Jul 2020 16:49:23 +0000 (16:49 +0000)] 
Merge "Ensure is_comparison passed for PG RANGE op() methods"

4 years agoImprove github action workflows
Federico Caselli [Mon, 27 Jul 2020 20:31:29 +0000 (22:31 +0200)] 
Improve github action workflows

- in create wheel set minimum versions of setuptools and wheel to avoid
  failure in python 3.5 with metadata configured in setup.cfg
- update action versions
- test also cext in the pull requests

Change-Id: Iaa5e4e4000c7faa688b51f2f41428c7dd7cae9c3

4 years agoMerge "Remove comment code lines"
mike bayer [Sun, 26 Jul 2020 21:15:04 +0000 (21:15 +0000)] 
Merge "Remove comment code lines"

4 years agoEnsure is_comparison passed for PG RANGE op() methods
Jim Bosch [Sun, 26 Jul 2020 20:50:14 +0000 (16:50 -0400)] 
Ensure is_comparison passed for PG RANGE op() methods

Fixed issue where the return type for the various RANGE comparison
operators would itself be the same RANGE type rather than BOOLEAN, which
would cause an undesirable result in the case that a
:class:`.TypeDecorator` that defined result-processing behavior were in
use.  Pull request courtesy Jim Bosch.

Fixes: #5476
Closes: #5477
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5477
Pull-request-sha: 925b117e0c91cdd67d9ddbd9d65f5ca3e88af91f

Change-Id: I52ab4d4362d379c8253990f9d328a40990a64520

4 years agoImprove delete cascade and passive deletes sections
Mike Bayer [Sun, 26 Jul 2020 17:17:56 +0000 (13:17 -0400)] 
Improve delete cascade and passive deletes sections

Add cross linking from Core to ORM and also add new sections
and examples regarding many-to-many.    Move the section
out of "collections" and into the "cascades" chapter
where it's more likely to be found.

Change-Id: If29360e463e5745279bc5335bd12352d50ad8953

4 years agoUpdate docs with actual MariaDB JSON support 5474/head
DefteZ [Fri, 24 Jul 2020 23:45:41 +0000 (01:45 +0200)] 
Update docs with actual MariaDB JSON support

4 years agoRemove comment code lines
j00356287 [Sat, 25 Jul 2020 20:33:25 +0000 (16:33 -0400)] 
Remove comment code lines

PyODBCConnector.initialize just super from Connector, no need to redeclare, so I guess that's why they are commented before.

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

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

Remove the useless comment code lines.

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

-->

This pull request is:

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

**Have a nice day!**

Closes: #5475
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5475
Pull-request-sha: 23176a7f0316d74407492c2bb299c88924ed0868

Change-Id: If94bb6275c30015e3aaa1519471b7d9bcda18bf8

4 years agoMerge "Revise setinputsizes approach"
mike bayer [Thu, 23 Jul 2020 16:11:47 +0000 (16:11 +0000)] 
Merge "Revise setinputsizes approach"

4 years agoMerge "Allow Grouping to pass along proxy_set of element"
mike bayer [Thu, 23 Jul 2020 16:10:55 +0000 (16:10 +0000)] 
Merge "Allow Grouping to pass along proxy_set of element"

4 years agoAllow Grouping to pass along proxy_set of element
Mike Bayer [Tue, 21 Jul 2020 16:36:20 +0000 (12:36 -0400)] 
Allow Grouping to pass along proxy_set of element

Repaired an issue where the "ORDER BY" clause rendering a label name rather
than a complete expression, which is particularly important for SQL Server,
would fail to occur if the expression were enclosed in a parenthesized
grouping in some cases.   This case has been added to test support.

Fixes: #5470
Change-Id: Ie0e27c39e5d53be78b32f7810f93d2d0536375e7

4 years agoEnsure _distinct_on removed within from_selectable
Mike Bayer [Mon, 20 Jul 2020 20:51:24 +0000 (16:51 -0400)] 
Ensure _distinct_on removed within from_selectable

Fixes: #5469
Change-Id: I85498d3380c2efb595782d2ba92cfd692c3efc48

4 years agoRevise setinputsizes approach
Mike Bayer [Sun, 19 Jul 2020 21:39:14 +0000 (17:39 -0400)] 
Revise setinputsizes approach

in order to support asyncpg as well as pg8000,
we need to revise setinputsizes to work for more cases as well
as adjust NativeForEmulated a bit to work more completely with
the INTERVAL datatype.

- put most of the setinputsizes work into the compiler where
the computation can be cached.

- support per-element setinputsizes for a tuple

- adjust TypeDecorator so that _unwrapped_dialect_impl
will honor a type that the dialect links to directly in
it's adaption mapping.    Decouble _unwrapped_dialect_impl
from TypeDecorator._gen_dialect_impl() which has a different
purpose.   This allows setinputsizes to do the right thing
with the INTERVAL datatype.

- test cases for Oracle with Variant continue to work

Change-Id: I9e1ea33aeca3b92b365daa4a356d778191070c03

4 years agoFix mssql dialect escaping object names containing ']'
Gord Thompson [Sat, 18 Jul 2020 00:06:41 +0000 (18:06 -0600)] 
Fix mssql dialect escaping object names containing ']'

Fixes: #5467
Change-Id: I054ec219717ba62847a9daf1214e215dd6b70633

4 years agoMerge "Add requirement for test_get_view_definition"
mike bayer [Thu, 16 Jul 2020 18:57:13 +0000 (18:57 +0000)] 
Merge "Add requirement for test_get_view_definition"

4 years agoRepair test modified in 5de0f1cf50cc0170d8e
Mike Bayer [Thu, 16 Jul 2020 18:55:12 +0000 (14:55 -0400)] 
Repair test modified in 5de0f1cf50cc0170d8e

was "failing" for SQL server since a second set of
assertions had been removed, these can be back
as long as the session is rolled back afterwards

Change-Id: Ie5d75aea41ba98f549cd72d71c6b4fdb30726775

4 years agoRepair doubled "using engines in fork()" section
Mike Bayer [Wed, 15 Jul 2020 23:14:46 +0000 (19:14 -0400)] 
Repair doubled "using engines in fork()" section

This section was written twice in two different ways with
the same recipe.  consolidate into one section and
add additional caveats regading dispose.

Change-Id: I20524935e7c10e3624d561ea2735312fd04e673d
References: #5460

4 years agoAdd requirement for test_get_view_definition
Gord Thompson [Wed, 15 Jul 2020 22:00:56 +0000 (16:00 -0600)] 
Add requirement for test_get_view_definition

Bypass the test if the views are not being created.

Change-Id: I3945acb418575d12e5fe0e4657eb5e3b1c08b90e

5 years agoMerge "test single and double quote inspection scenarios"
mike bayer [Mon, 13 Jul 2020 19:07:35 +0000 (19:07 +0000)] 
Merge "test single and double quote inspection scenarios"

5 years agotest single and double quote inspection scenarios
Mike Bayer [Mon, 13 Jul 2020 14:49:57 +0000 (10:49 -0400)] 
test single and double quote inspection scenarios

Applied a sweep through all included dialects to ensure names that contain
single or double quotes are properly escaped when querying system tables,
for all :class:`.Inspector` methods that accept object names as an argument
(e.g. table names, view names, etc).   SQLite and MSSQL contained two
quoting issues that were repaired.

Fixes: #5456
Change-Id: I3bc98806f5166f3d82275650079ff561446f2aef

5 years agoMerge "more docs for autocommit isolation level"
mike bayer [Mon, 13 Jul 2020 15:17:51 +0000 (15:17 +0000)] 
Merge "more docs for autocommit isolation level"

5 years agoMerge "Make call-count profiling tests on osx have their own platform key"
mike bayer [Mon, 13 Jul 2020 02:02:45 +0000 (02:02 +0000)] 
Merge "Make call-count profiling tests on osx have their own platform key"

5 years agomore docs for autocommit isolation level
Mike Bayer [Sun, 12 Jul 2020 23:52:54 +0000 (19:52 -0400)] 
more docs for autocommit isolation level

this concept is not clear that we offer real
DBAPI autocommit everywhere.  backport 1.3 with edits
as well

Change-Id: I2e8328b7fb6e1cdc5453ab29c94276f60c7ca149

5 years agoCorrect mock call from 5de0f1cf50
Mike Bayer [Sun, 12 Jul 2020 14:48:03 +0000 (10:48 -0400)] 
Correct mock call from 5de0f1cf50

mock in python 2.7 / 3.8 seems to have an "args" accessor
but in prior python 3 versions this is not the case,
so this is likely a recent addition to "mock" but wasn't
present in the python3 vendored versions.

Change-Id: Iff8afe75e891c9658c7c7b577831fefd5986940b

5 years agoCorrect incorrect readme.rst file
Mike Bayer [Sun, 12 Jul 2020 14:29:01 +0000 (10:29 -0400)] 
Correct incorrect readme.rst file

in the move to setup.cfg at
9ca81f5f79498356c4f3387c17edda0ed3dad451 we put the wrong
README file.

Change-Id: I25193d248e325e9473f26901925f91bef54ca07a

5 years agoFurther corrections to session docs
Mike Bayer [Sat, 11 Jul 2020 22:54:15 +0000 (18:54 -0400)] 
Further corrections to session docs

many more to come.

One issue is that references to documentation sections
inside of decorator-configured deprecation warnings will
also generate a meaningless token when the runtime warning
is emitted.  It would be nice to improve upon this somehow.

Change-Id: I16b214b3d310850bbfb0d9ade70235f5a9735eba

5 years agoMerge "Convert remaining ORM APIs to support 2.0 style"
mike bayer [Sat, 11 Jul 2020 18:59:14 +0000 (18:59 +0000)] 
Merge "Convert remaining ORM APIs to support 2.0 style"

5 years agoConvert remaining ORM APIs to support 2.0 style
Mike Bayer [Wed, 8 Jul 2020 18:31:17 +0000 (14:31 -0400)] 
Convert remaining ORM APIs to support 2.0 style

This is kind of a mixed bag of all kinds to help get us
to 1.4 betas.    The documentation stuff is a work in
progress.    Lots of other relatively small changes to
APIs and things.    More commits will follow to continue
improving the documentation and transitioning to the
1.4/2.0 hybrid documentation.  In particular some refinements
to Session usage models so that it can match Engine's
scoping / transactional patterns, and a decision to
start moving away from "subtransactions" completely.

* add select().from_statement() to produce FromStatement in an
  ORM context

* begin referring to select() that has "plugins" for the few edge
  cases where select() will have ORM-only behaviors

* convert dynamic.AppenderQuery to its own object that can use
  select(), though at the moment it uses Query to support legacy
  join calling forms.

* custom query classes for AppenderQuery are replaced by
  do_orm_execute() hooks for custom actions, a separate gerrit
  will document this

* add Session.get() to replace query.get()

* Deprecate session.begin->subtransaction.  propose within the
  test suite a hypothetical recipe for apps that rely on this
  pattern

* introduce Session construction level context manager,
  sessionmaker context manager, rewrite the whole top of the
  session_transaction.rst documentation.   Establish context manager
  patterns for Session that are identical to engine

* ensure same begin_nested() / commit() behavior as engine

* devise all new "join into an external transaction" recipe,
  add test support for it, add rules into Session so it
  just works, write new docs.  need to ensure this doesn't
  break anything

* vastly reduce the verbosity of lots of session docs as
  I dont think people read this stuff and it's difficult
  to keep current in any case

* constructs like case(), with_only_columns() really need
  to move to *columns, add a coercion rule to just change
  these.

* docs need changes everywhere I look.  in_() is not in
  the Core tutorial?  how do people even know about it?
  Remove tons of cruft from Select docs, etc.

* build a system for common ORM options like populate_existing
  and autoflush to populate from execution options.

* others?

Change-Id: Ia4bea0f804250e54d90b3884cf8aab8b66b82ecf

5 years agoMake call-count profiling tests on osx have their own platform key
Federico Caselli [Sat, 11 Jul 2020 17:10:26 +0000 (19:10 +0200)] 
Make call-count profiling tests on osx have their own platform key

They previously would use the linux profiles, but recently some discrepancies in
the function call count on osx would make the tests fail.

Change-Id: Ifdfdca1676972de4179f59cdaae196f6805d4a21

5 years agoMerge "Improvements to test_computed_col_default_not_set"
mike bayer [Thu, 9 Jul 2020 15:51:26 +0000 (15:51 +0000)] 
Merge "Improvements to test_computed_col_default_not_set"

5 years agoImprovements to test_computed_col_default_not_set
Rafi Shamim [Thu, 9 Jul 2020 14:35:33 +0000 (10:35 -0400)] 
Improvements to test_computed_col_default_not_set

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

### Description
<!-- Describe your changes in detail -->
- Update the test so it looks at computed_default_table instead of
  computed_column_table.
- Stop inspecting autoincrement; instead directly check for
  default/non-default values for the relevant columns.

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

-->

This pull request is:

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

**Have a nice day!**

Closes: #5417
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5417
Pull-request-sha: 5918af6abb991e6d2322ea4252e56d456da628dc

Change-Id: Id9484ae7f297735345016be5b7461325825503da

5 years agoLimit init_subclass test above python 3.6
Mike Bayer [Wed, 8 Jul 2020 19:48:32 +0000 (15:48 -0400)] 
Limit init_subclass test above python 3.6

The commit for I1654befe9eb1c8b8e7fc0784bdbe64284614f0ea #5357
runs the test on all Python 3 versions, however we need to limit
at least python 3.6 for this.

Change-Id: Ie86b78bbfd8c7bd013ff9aa7f8905328d792c1b3

5 years agoPropose --nomemory by default
Mike Bayer [Wed, 8 Jul 2020 19:32:38 +0000 (15:32 -0400)] 
Propose --nomemory by default

the memory tests are solely responsible for the largest chunk of
time and CPU energy taken up in running the tests.   Regressions
in this area are nonexistent unless major changes are being
taken up.   Try to revert them to False and see if a single
gerrit job can perhaps run these.

Change-Id: Ibaead2d1c0a76f1339bee63652a8aead689e8b75

5 years agoRepair change of "future_select" caught in merge conflict
Mike Bayer [Wed, 8 Jul 2020 19:12:30 +0000 (15:12 -0400)] 
Repair change of "future_select" caught in merge conflict

the recent change to select() apparently seems to have
been merged with other statements in the test_update_delete
test that was still using the old term.

Change-Id: I6be3eb148249bfcf08aae19efcad89803c69c658

5 years agoMerge remote-tracking branch 'origin/pr/5410'
Mike Bayer [Wed, 8 Jul 2020 18:41:48 +0000 (14:41 -0400)] 
Merge remote-tracking branch 'origin/pr/5410'

Change-Id: Ib052efc33ddd58d38e16c0cc721abee668b861d5

5 years agoMerge remote-tracking branch 'origin/pr/5439'
Mike Bayer [Wed, 8 Jul 2020 18:37:04 +0000 (14:37 -0400)] 
Merge remote-tracking branch 'origin/pr/5439'

Change-Id: Ibab5889b14c546a8c43c5eaf88ed5d1f53713880

5 years agoMerge "Add future=True to create_engine/Session; unify select()"
mike bayer [Wed, 8 Jul 2020 15:07:44 +0000 (15:07 +0000)] 
Merge "Add future=True to create_engine/Session; unify select()"

5 years agoAdd future=True to create_engine/Session; unify select()
Mike Bayer [Fri, 26 Jun 2020 20:15:19 +0000 (16:15 -0400)] 
Add future=True to create_engine/Session; unify select()

Several weeks of using the future_select() construct
has led to the proposal there be just one select() construct
again which features the new join() method, and otherwise accepts
both the 1.x and 2.x argument styles.   This would make
migration simpler and reduce confusion.

However, confusion may be increased by the fact that select().join()
is different  Current thinking is we may be better off
with a few hard behavioral changes to old and relatively unknown APIs
rather than trying to play both sides within two extremely similar
but subtly different APIs.  At the moment, the .join() thing seems
to be the only behavioral change that occurs without the user
taking any explicit steps.   Session.execute() will still
behave the old way as we are adding a future flag.

This change also adds the "future" flag to Session() and
session.execute(), so that interpretation of the incoming statement,
as well as that the new style result is returned, does not
occur for existing applications unless they add the use
of this flag.

The change in general is moving the "removed in 2.0" system
further along where we want the test suite to fully pass
even if the SQLALCHEMY_WARN_20 flag is set.

Get many tests to pass when SQLALCHEMY_WARN_20 is set; this
should be ongoing after this patch merges.

Improve the RemovedIn20 warning; these are all deprecated
"since" 1.4, so ensure that's what the messages read.
Make sure the inforamtion link is on all warnings.
Add deprecation warnings for parameters present and
add warnings to all FromClause.select() types of methods.

Fixes: #5379
Fixes: #5284
Change-Id: I765a0b912b3dcd0e995426427d8bb7997cbffd51
References: #5159

5 years agoImply `sync_backref` flag in a viewonly relationship
Federico Caselli [Wed, 22 Apr 2020 21:25:57 +0000 (23:25 +0200)] 
Imply `sync_backref` flag in a viewonly relationship

Update :paramref:`_orm.relationship.sync_backref` flag in a relationship
to make it implicitly set to False in ``viewonly=True`` relationships,
preventing synchronization events in all cases.

References: #5237
Change-Id: Ib02b228a1b6e66b5ffd4540af776ac8f759c9a48

5 years agoMerge "ensure we unwrap desc() /label() all the way w/ order by"
mike bayer [Tue, 7 Jul 2020 18:58:18 +0000 (18:58 +0000)] 
Merge "ensure we unwrap desc() /label() all the way w/ order by"

5 years agoensure we unwrap desc() /label() all the way w/ order by
Mike Bayer [Tue, 7 Jul 2020 15:26:39 +0000 (11:26 -0400)] 
ensure we unwrap desc() /label() all the way w/ order by

The deprecated logic to move order_by expressions
up into the columns clause needed adjustment to accommodate
for a more deeply-wrapped structure when desc() + label()
 are combined in an order by column.  This structure
now comes from coercions in 1.4.  it's not clear to me
at the moment why it's different from 1.3 but
this shouldn't really matter.

Fixes: #5443
Change-Id: If909a86f715992318d7aa283603197f7711f1d3b

5 years agoMerge "Add **kw support to DeclarativeMeta.__init__"
mike bayer [Tue, 7 Jul 2020 00:18:20 +0000 (00:18 +0000)] 
Merge "Add **kw support to DeclarativeMeta.__init__"

5 years agoMerge "added semicolon (;) to improve warning message clarity"
mike bayer [Mon, 6 Jul 2020 20:48:18 +0000 (20:48 +0000)] 
Merge "added semicolon (;) to improve warning message clarity"

5 years agoAdd **kw support to DeclarativeMeta.__init__
EwenGillies [Sun, 5 Jul 2020 14:50:50 +0000 (10:50 -0400)] 
Add **kw support to DeclarativeMeta.__init__

Added a ``**kw`` argument to the :meth:`.DeclarativeMeta.__init__` method.
This allows a class to support the :pep:`487` metaclass hook
``__init_subclass__``.  Pull request courtesy Ewen Gillies.

Fixes: #5357
Closes: #5363
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5363
Pull-request-sha: 0ad05a768316cba03a4d312ab39d3e8fbca7ac54

Change-Id: I1654befe9eb1c8b8e7fc0784bdbe64284614f0ea

5 years agoConsolidate connection customization documentation
Mike Bayer [Mon, 6 Jul 2020 15:11:54 +0000 (11:11 -0400)] 
Consolidate connection customization documentation

1. move all discussion of how to customize connection
to the engines.rst section.   have the section in pooling.rst
point to engines.

2. ensure all of the common use cases for connection modification
are listed out in order of level of modification.   the use
case of modifying an existing connection is separate from that of
modifying how connect is called; ensure that poolevents.connect
is referred to just as prominently as dialectevents.do_connect.

3. completely replace any discussion of create_engine.creator, as this
hook does not offer anything beyond what do_connect() does.
"creator" is more about using a Pool object directly without an
Engine, which is no longer a documented use case.

Change-Id: Ibe366d2a6e63eb420a6136fdc71ce0fb545edf8f

5 years agoEnsure synchronize_session works with lambda statements
Mike Bayer [Sun, 5 Jul 2020 17:44:58 +0000 (13:44 -0400)] 
Ensure synchronize_session works with lambda statements

A few places have logic that assumes the top-level statement
is the actual UPDATE or DELETE which is not the case with a
lambda.  Ensure the correct object is used.  This
fixes issues specific to both "fetch" strategy
as well as "evaluate" strategy.

Fixes: #5442
Change-Id: Ic9cc01c696c3c338d5bc79688507e6717c4c169b

5 years agoDocument pyodbc built-in pooling
Mike Bayer [Sun, 5 Jul 2020 14:28:20 +0000 (10:28 -0400)] 
Document pyodbc built-in pooling

PyODBC apparently pools connections by default and this
is a module-wide setting only.    Documenent that this happens
and how to disable it.

Fixes: #5440
Change-Id: I415bda7beb2211c66991b6c804b0ddb4d79e427f

5 years agoresolves #3757 5439/head
RamonWill [Sat, 4 Jul 2020 17:17:40 +0000 (18:17 +0100)] 
resolves #3757

5 years agoresolves #5333 typo correction 'explcit' should be 'explicit'. 5410/head
RamonWill [Sat, 4 Jul 2020 13:30:19 +0000 (14:30 +0100)] 
resolves #5333 typo correction 'explcit' should be 'explicit'.

5 years agointroduce deferred lambdas
Mike Bayer [Mon, 16 Dec 2019 22:06:43 +0000 (17:06 -0500)] 
introduce deferred lambdas

The coercions system allows us to add in lambdas as arguments
to Core and ORM elements without changing them at all.   By allowing
the lambda to produce a deterministic cache key where we can also
cheat and yank out literal parameters means we can move towards
having 90% of "baked" functionality in a clearer way right in
Core / ORM.

As a second step, we can have whole statements inside the lambda,
and can then add generation with __add__(), so then we have
100% of "baked" functionality with full support of ad-hoc
literal values.

Adds some more short_selects tests for the moment for comparison.

Other tweaks inside cache key generation as we're trying to
approach a certain level of performance such that we can
remove the use of "baked" from the loader strategies.

As we have not yet closed #4639, however the caching feature
has been fully integrated as of
b0cfa7379cf8513a821a3dbe3028c4965d9f85bd, we will also
add complete caching documentation here and close that issue
as well.

Closes: #4639
Fixes: #5380
Change-Id: If91f61527236fd4d7ae3cad1f24c38be921c90ba

5 years agotypo
Mike Bayer [Thu, 2 Jul 2020 00:10:38 +0000 (20:10 -0400)] 
typo

Change-Id: I8b10309e47b07065893f6f41dfdbd67ad3e96bad

5 years agoenhance question template
Mike Bayer [Thu, 2 Jul 2020 00:08:42 +0000 (20:08 -0400)] 
enhance question template

we need to know all version / database information for questions
as well and users should be encouraged to follow MCVE form
if possible.

Change-Id: Ic3a4c4dbb021069b7765aa351a4d4d18a821160d

5 years agoAdd missing function to documentation: cte, values, Exits, Values
Federico Caselli [Tue, 30 Jun 2020 19:40:56 +0000 (21:40 +0200)] 
Add missing function to documentation: cte, values, Exits, Values

Fixes: #5432
Change-Id: I22e4ba3a7131165c551bcba7e377fa45d71d70e0

5 years agoadded semicolon (;) to improve warning message clarity
jonathan vanasco [Tue, 30 Jun 2020 16:31:58 +0000 (12:31 -0400)] 
added semicolon (;) to improve warning message clarity

### Description

Added a semicolon to improve the clarity of warning message.  I actually had a table named `backend`, and thought it was involved!

While updating the code, I noticed no test that directly tests for this warning message. There are tests for the `Can't sort tables for DROP;` prefix of this message and the `exc.CircularDependencyError`; and some tests for the `exc.CircularDependencyError` message itself. I couldn't find any test for this particular message though.  (Just thought I'd bring that up)

No issue created, because this is minor.

Closes: #5431
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5431
Pull-request-sha: 87fb5733ff4fc1a13dd94277716814ea852f654c

Change-Id: I87a504d30a7dd5155c34f7d7f30b2116d0d3cd3f

5 years agoMerge "Use python version in extras_require; integrate with tox"
mike bayer [Mon, 29 Jun 2020 21:16:51 +0000 (21:16 +0000)] 
Merge "Use python version in extras_require; integrate with tox"

5 years agoMerge "Rename Table.tometadata to to_metadata"
mike bayer [Mon, 29 Jun 2020 19:50:29 +0000 (19:50 +0000)] 
Merge "Rename Table.tometadata to to_metadata"

5 years agoInclude DATETIME / DateTime with the MySQL TIMESTAMP examples
Mike Bayer [Mon, 29 Jun 2020 19:45:20 +0000 (15:45 -0400)] 
Include DATETIME / DateTime with the MySQL TIMESTAMP examples

To eliminate any remaining confusion, clarify that
DATETIME (as well as DateTime) and TIMESTAMP are treated
similarly with the MySQL dialect regarding ON UPDATE.

Change-Id: I222522440706902d5d2d11e670e76f16000438e0
References: #5427

5 years agoMerge "Remove _generate_path_cache_key()"
mike bayer [Mon, 29 Jun 2020 19:36:37 +0000 (19:36 +0000)] 
Merge "Remove _generate_path_cache_key()"

5 years agoMerge "Provide example for exists"
mike bayer [Mon, 29 Jun 2020 19:05:53 +0000 (19:05 +0000)] 
Merge "Provide example for exists"

5 years agoMerge "Fixes: #4556 - Test that prevents passing a filter to Session.query when runni...
mike bayer [Mon, 29 Jun 2020 19:04:32 +0000 (19:04 +0000)] 
Merge "Fixes: #4556 - Test that prevents passing a filter to Session.query when running an update"

5 years agoUse python version in extras_require; integrate with tox
Mike Bayer [Mon, 29 Jun 2020 18:01:07 +0000 (14:01 -0400)] 
Use python version in extras_require; integrate with tox

We want to use Oracle version >=7 for all platforms,
but <8 for Python 2.

Similarly, we want to use mysqlclient >= 1.4.0 for all
platforms, but < 2 for Python 2.

Have tox.ini defer to setup.cfg for DBAPIs.

We're not testing mysql-connector-python right now so remove
this from tox.ini.

Change-Id: I02611937da71d2950545e42c34f0b9798478e2a8

5 years agoDocuemnt current workarounds for MySQL TIMESTAMP
Mike Bayer [Mon, 29 Jun 2020 18:35:22 +0000 (14:35 -0400)] 
Docuemnt current workarounds for MySQL TIMESTAMP

MySQL 8 no longer generates the DEFAULT or ON UPDATE
clauses for TIMESTAMP by default, hence users will begin to hit
this regularly.  add warnings that this non-standard SQL is not
accommodated by server_onupdate and docuemnt the workaround
used in issues such as #4652.

Fixes: #5427
Change-Id: Ie048dcc91c648dd0b80ed395208c1d665b6c968b

5 years agoRename Table.tometadata to to_metadata
Gord Thompson [Sat, 27 Jun 2020 14:53:23 +0000 (08:53 -0600)] 
Rename Table.tometadata to to_metadata

Renamed the :meth:`_schema.Table.tometadata` method to
:meth:`_schema.Table.to_metadata`.  The previous name remains with a
deprecation warning.

Updated the "decorate" utility function to support decoration
of functions that include non-builtins as default values.

Moves test for deprecated "databases" package into
test/dialect/test_deprecations.py

Fixes: #5413
Fixes: #5426
Change-Id: I6ed899871c935f9e46360127c17ccb7cf97cea6e

5 years agoRemove _generate_path_cache_key()
Mike Bayer [Sun, 28 Jun 2020 16:47:32 +0000 (12:47 -0400)] 
Remove _generate_path_cache_key()

loader options can now make a deterministic cache key based
 on the structure they are given, and this accommodates for
aliased classes as well so that these cache keys are now
"safe".     Have baked query call upon
the regular cache key method.

Change-Id: Iaa2ef4064cfb16146f415ca73080f32003dd830d

5 years agoAdd an extra step to pool test_sync
Mike Bayer [Sun, 28 Jun 2020 02:57:52 +0000 (22:57 -0400)] 
Add an extra step to pool test_sync

Have observed CI failure with windows where not all
three connections got pulled out at the same time here
as the threads got serialized.  make sure all three
connections get used.

Change-Id: Ic2f7c7de1069358d95035f90c725c7dddd4f34d4

5 years agoMerge "ORM executemany returning"
mike bayer [Sun, 28 Jun 2020 02:34:18 +0000 (02:34 +0000)] 
Merge "ORM executemany returning"

5 years agoORM executemany returning
Mike Bayer [Fri, 17 Apr 2020 14:55:08 +0000 (10:55 -0400)] 
ORM executemany returning

Build on #5401 to allow the ORM to take advanage
of executemany INSERT + RETURNING.

Implemented the feature

updated tests

to support INSERT DEFAULT VALUES, needed to come up with
a new syntax for compiler INSERT INTO table (anycol) VALUES (DEFAULT)
which can then be iterated out for executemany.

Added graceful degrade to plain executemany for PostgreSQL <= 8.2

Renamed EXECUTEMANY_DEFAULT to EXECUTEMANY_PLAIN

Fix issue where unicode identifiers or parameter names wouldn't
work with execute_values() under Py2K, because we have to
encode the statement and therefore have to encode the
insert_single_values_expr too.

Correct issue from #5401 to support executemany + return_defaults
for a PK that is explicitly pre-generated, meaning we aren't actually
getting RETURNING but need to return it from compiled_parameters.

Fixes: #5263
Change-Id: Id68e5c158c4f9ebc33b61c06a448907921c2a657