Commit Graph

12546 Commits

Author SHA1 Message Date
RamonWill 2cc963dbdc Provide more detailed error message for Query.join()
An :class:`.ArgumentError` with more detail is now raised if the target
parameter for :meth:`_query.Query.join` is set to an unmapped object.
Prior to this change a less detailed ``AttributeError`` was raised.
Pull request courtesy Ramon Williams.

Fixes: #4428
Closes: #5452
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5452
Pull-request-sha: b148df5470

Change-Id: I873453d1fdb651178216aac698baac63ae5a94e8
2020-08-31 18:27:48 -04:00
Mike Bayer 0a234fee4b Implement DDL visitor for PG ENUM with schema translate support
Fixed issue where the :class:`_postgresql.ENUM` type would not consult the
schema translate map when emitting a CREATE TYPE or DROP TYPE during the
test to see if the type exists or not.  Additionally, repaired an issue
where if the same enum were encountered multiple times in a single DDL
sequence, the "check" query would run repeatedly rather than relying upon a
cached value.

Fixes: #5520
Change-Id: I79f46e29ac0168e873ff178c242f8d78f6679aeb
(cherry picked from commit c290a40a543f8355ee712e2e565698b6ebdb162f)
2020-08-19 10:46:49 -04:00
Mike Bayer 8b34f3c4bb Deliver straight BinaryExpr w/ no negate for any() / all()
Adjusted the :meth:`_types.ARRAY.Comparator.any` and
:meth:`_types.ARRAY.Comparator.all` methods to implement a straight "NOT"
operation for negation, rather than negating the comparison operator.

Fixes: #5518
Change-Id: I87ee9278c321aafe51a679fcfcbb5fbb11307fda
(cherry picked from commit 8bc793c4db)
2020-08-18 14:19:35 -04:00
Mike Bayer de6f437f82 Clarify that session.close() is like reset
This is a manual edit, not really a cherry-pick, but the
below ref is where this is from.

Fixes: #5517
Change-Id: I86809cf84de3ec19a279ae13f4e5e71336d8b359
(cherry picked from commit 7277c12e4d)
2020-08-18 10:53:33 -04:00
Federico Caselli 4f0a112fcc Fix wheel check in linux workflow and improve it
Change-Id: I3b208674649e41bca0285d00aa11cc5975eb971a
(cherry picked from commit e7875b39f8)
2020-08-17 23:49:04 +02:00
Mike Bayer 3776460e4a Version 1.3.20 placeholder 2020-08-17 16:12:11 -04:00
Mike Bayer da4e4cb1c6 - 1.3.19 rel_1_3_19 2020-08-17 15:59:44 -04:00
Jesse Bakker 584bcfa6c2 Make discriminator column used by ConcreteBase configurable
The name of the virtual column used when using the
:class:`_declarative.AbstractConcreteBase` and
:class:`_declarative.ConcreteBase` classes can now be customized, to allow
for models that have a column that is actually named ``type``.  Pull
request courtesy Jesse-Bakker.

Fixes: #5513
Closes: #5514
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5514
Pull-request-sha: 5e7429f353

Change-Id: I733737844d4f4e1f52dd2475a66c7044ff7292f5
(cherry picked from commit db2b2e21d6)
2020-08-17 11:43:45 -04:00
RamonWill 438a19d0d0 error message for Lookup
Th proposed change will provide the user with the target Enum Class name as well as up to four possible enum values when a LookupError is raised in the Enum Class.

A user requested that the enum name and possible values are included to the LookupError message to make debugging easier. The criteria included using ellipses for Enums containing more than four values and using ellipses for enum values that were greater than a certain number of characters (for this resolution the limit is 11 characters).

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: #4733

Closes: #5490
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5490
Pull-request-sha: 55e76f2ae7

Change-Id: I4541f9efed1c05401587a413e9e748d46938bcd1
(cherry picked from commit a8bd2116764fb6039742a34409254175846bb700)
2020-08-17 01:38:23 +01:00
Mike Bayer 8c4b0c86e4 update for pytest-xdist terminology
With version 2.0.0 they removed the old terminology, which
I had no idea had been changed in any case for several years.

pushing this out for all branches

Change-Id: I51e4f577aeb9ef8205348b50489549f77072a613
(cherry picked from commit f91d335e31)
2020-08-14 12:25:38 -04:00
Mike Bayer 2303c46087 Further fixes for ticket 5470
The fix for #5470 didn't actually take into account that
the "distinct" logic in query was also doubling up the criteria.
Added many more tests.   the 1.3 version here will be different
than 1.4 as the regression is not quite the same.

Fixes: #5470
Change-Id: I16a23917cab175761de9c867d9d9ac55031d9b97
(cherry picked from commit 7ac2d5c93b6334528aff93939559eee133f3e9fc)
2020-08-13 12:34:27 -04:00
mike bayer 1f5e9cbd66 Merge "Fix mysql CREATE TABLE / COLLATE issue" into rel_1_3 2020-08-12 15:04:31 +00:00
Mike Bayer b2bb85a463 update deterministic sort ordering doc
reword the sorting in terms of the actual behavior,
put correct changed version

References: #5494
Change-Id: I725338526afe28454910d029c153e4476f8c686f
(cherry picked from commit 5b44be7a13)
2020-08-11 12:28:09 -04:00
Gord Thompson 765478888c Fix mysql CREATE TABLE / COLLATE issue
Fixes: #5411
Change-Id: Ib0c53f5ed3f9d3ff0586580c9a9cce73b4b870f4
(cherry picked from commit 32e0b128f6)
2020-08-09 18:02:10 -06:00
Karthikeyan Singaravelan b7cf984819 Fix typos
(cherry picked from commit 71f14f6de8)

Change-Id: Ie5e32ee12696aa0234dc6282b83220100c2288a0
2020-08-09 10:18:50 -04:00
mike bayer 06d893b1c3 Merge "Add complete platform data to profiling data" into rel_1_3 2020-08-07 17:27:29 +00:00
mike bayer 2ef0fe04a0 Merge "Pass schema_translate_map from DDLCompiler to SQLCompiler" into rel_1_3 2020-08-07 17:22:35 +00:00
Mike Bayer 8db7e95729 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
(cherry picked from commit ed50a003e2)
2020-08-07 12:57:41 -04:00
Federico Caselli 78cc071a32 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.

For 1.3, also bump cpython version to 3.8 to match CI

Ref: #5436
Change-Id: I7e48f0462ba7d9c680b2dac45ce7b0cf709b9b22
(cherry picked from commit 24a9e6974c)
2020-08-07 12:47:04 -04:00
Mike Bayer b3f0ff687d Include bulk update/delete in RoutingSession example
Fixes: #5407
Change-Id: Ia0965dbc88d744cded5c23021898388f2cf95f8d
(cherry picked from commit 7f52c10357)
2020-08-07 12:33:31 -04:00
Mike Bayer 4f19f1823c 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
(cherry picked from commit 9a3fee2cb6)
2020-08-06 17:13:04 -04:00
Mike Bayer 2eaf2a9785 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
(cherry picked from commit 5668fd73ea)
2020-08-05 22:06:34 -04:00
Mike Bayer c0e76578f1 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
(cherry picked from commit 2a94625402)
2020-08-05 10:35:25 -04:00
Mike Bayer 818b068563 fix formatting
Change-Id: I8315cfef6e5c4b87d64fc770998a1229cc690870
(cherry picked from commit c813fe1678)
2020-08-04 10:41:03 -04:00
Mike Bayer 460de4963d 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
(cherry picked from commit 64f3c09797)
2020-08-04 10:14:42 -04:00
mike bayer 6461d59784 Merge "Improve github action workflows" into rel_1_3 2020-08-02 00:11:46 +00:00
mike bayer 9b5bb02e1f Merge "Consider default FROM DUAL for MySQL" into rel_1_3 2020-07-29 18:44:40 +00:00
Mike Bayer e41998981c 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
(cherry picked from commit 59b65b3008de5d6c5e4318846d04e50e5851e957)
2020-07-29 13:20:33 -04:00
Mike Bayer 7b0c29a401 Passive deletes edits
Change-Id: I863df033cae9bda4ce96d446a92984ae82797565
(cherry picked from commit 1ec03c1523)
2020-07-29 13:15:25 -04:00
Mike Bayer 1063ed2ea0 Remove errant link
The link to "passive_deletes" has moved in
9e1ee412b8 however the tag
stayed here and caused a self link.

Fixes: #5484
Change-Id: I3ac5970be30504367294b9e9a83eb5a2c579cc71
(cherry picked from commit 4ac56e6ca3)
2020-07-29 12:53:19 -04:00
Federico Caselli 0c6c235e4a 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
(cherry picked from commit 8e89f04039)
2020-07-27 22:44:55 +02:00
Jim Bosch a8c9e8d723 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: 925b117e0c

Change-Id: I52ab4d4362d379c8253990f9d328a40990a64520
(cherry picked from commit 07e57a0330)
2020-07-26 16:57:43 -04:00
Mike Bayer e967c13e08 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
(cherry picked from commit 9e1ee412b8)
2020-07-26 13:20:21 -04:00
DefteZ c7bcca00ce Update docs with actual MariaDB JSON support
(cherry picked from commit a26b88cd6b)
2020-07-26 10:34:16 -04:00
Mike Bayer d3ba45c00f 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
(cherry picked from commit 30ec982ba6)
2020-07-21 12:38:33 -04:00
Gord Thompson 1fc759d3b1 Fix mssql dialect escaping object names containing ']'
Fixes: #5467
Change-Id: I054ec219717ba62847a9daf1214e215dd6b70633
(cherry picked from commit 547e959157)
2020-07-18 07:37:48 -06:00
Gord Thompson 7bc98374ca Add requirement for test_get_view_definition
Bypass the test if the views are not being created.

Change-Id: I3945acb418575d12e5fe0e4657eb5e3b1c08b90e
(cherry picked from commit 6158fe6cbf)
2020-07-16 08:50:45 -06:00
Mike Bayer 147b116c32 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
(cherry picked from commit f4aa9def8f)
2020-07-15 19:19:55 -04:00
mike bayer fbdc6f9ead Merge "Add missing function to documentation: cte, Exits" into rel_1_3 2020-07-13 19:08:46 +00:00
Mike Bayer 135070f75e 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
(cherry picked from commit 4351f7183c81bdb64a9a3ba47aa4b9891f42ffdb)
2020-07-13 11:36:40 -04:00
mike bayer f2dd0d38f3 Merge "more docs for autocommit isolation level" into rel_1_3 2020-07-13 03:28:53 +00:00
Mike Bayer 81c3d4f57b 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
(cherry picked from commit 28fbb0cb94)
2020-07-12 22:01:52 -04:00
Federico Caselli 18c7fc05ff 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
(cherry picked from commit 2ada9686ffb86d39ea25aa146593dde2340fee03)
2020-07-11 19:09:24 +02:00
Mike Bayer bb9cbe13a1 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
(cherry picked from commit 43a111e326)
2020-07-08 17:54:28 -04:00
Mike Bayer b3c53ce42c 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
(cherry picked from commit e2d4b2e72c)
2020-07-08 15:58:47 -04:00
RamonWill 1fdf0228e0 resolves #3757
(cherry picked from commit cf7bfb7984)
2020-07-08 14:37:37 -04:00
mike bayer d6fdbcf549 Merge "Add **kw support to DeclarativeMeta.__init__" into rel_1_3 2020-07-07 00:18:31 +00:00
jonathan vanasco 7a7070d82a 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: 87fb5733ff

Change-Id: I87a504d30a7dd5155c34f7d7f30b2116d0d3cd3f
(cherry picked from commit b421c51b94)
2020-07-06 16:48:34 -04:00
EwenGillies 664cefb276 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: 0ad05a7683

Change-Id: I1654befe9eb1c8b8e7fc0784bdbe64284614f0ea
(cherry picked from commit 67504137e9)
2020-07-06 16:46:33 -04:00
Mike Bayer c8c52a3436 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
(cherry picked from commit b5c4a4cbe6)
2020-07-06 11:16:06 -04:00