summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Merge "Use define_tables for IsOrIsNotDistinctFromTest"mike bayer2020-04-131-10/+12
|\ \ \ \ | |/ / / |/| | |
| * | | Use define_tables for IsOrIsNotDistinctFromTestMike Bayer2020-04-101-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ie8127ef29f1ec91e7afb88e1429538c27a321784 Mike failed to notice that this test is build on TablesTest and has just the one test function, which means the table is built up by the fixture. Change-Id: I855431bc976fe8ec96559ec1a22bb294aecf3c40
* | | | Fix almost all read-level sphinx warningsMike Bayer2020-04-118-11/+22
| |_|/ |/| | | | | | | | | | | | | | | | | | | | There are some related to changelog that I can't figure out and are likely due to something in the changelog extension. also one thing with a "collection" I can't figure out. Change-Id: I0a9e6f4291c3589aa19a4abcb9245cd22a266fe0
* | | Merge "The :meth:`.Inspector.reflecttable` was renamed to ↵mike bayer2020-04-112-3/+16
|\ \ \ | |/ / |/| | | | | :meth:`.Inspector.reflect_table`."
| * | The :meth:`.Inspector.reflecttable` was renamed to ↵Federico Caselli2020-04-102-3/+16
| | | | | | | | | | | | | | | | | | | | | :meth:`.Inspector.reflect_table`. Fixes: #5244 Change-Id: I2b12fd69ed24ce1ede8f6ed5cb14cc7761308ee3
* | | Merge "Fix distinct_from test for Firebird et al."mike bayer2020-04-101-1/+1
|\ \ \
| * | | Fix distinct_from test for Firebird et al.Gord Thompson2020-04-091-1/+1
| | |/ | |/| | | | | | | | | | | | | Firebird (and perhaps others) allow us to CREATE TABLE inside a transaction but we can't INSERT INTO that table unless we COMMIT first. Change-Id: Ie8127ef29f1ec91e7afb88e1429538c27a321784
* | | Merge "Evaluate fixes for cx_Oracle 8 API changes"mike bayer2020-04-101-5/+10
|\ \ \ | |_|/ |/| |
| * | Evaluate fixes for cx_Oracle 8 API changesMike Bayer2020-04-101-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in [1] we have reported some behavioral changes in cx_Oracle symbols. As it is unclear if these are intended changes in cx_Oracle, test workarounds for these changes against cx_Oracle master. [1] https://github.com/oracle/python-cx_Oracle/issues/415 Fixes: #5246 Change-Id: If63f92553c46484bf2b61b53a9e6d85cb08e800a
* | | Merge "Remove code deprecated before version 1.1"mike bayer2020-04-1042-1017/+159
|\ \ \ | |/ / |/| |
| * | Remove code deprecated before version 1.1Federico Caselli2020-04-0942-1017/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove deprecated method ``get_primary_keys` in the :class:`.Dialect` and :class:`.Inspector` classes. - Remove deprecated event ``dbapi_error`` and the method ``ConnectionEvents.dbapi_error`. - Remove support for deprecated engine URLs of the form ``postgres://``. - Remove deprecated dialect ``mysql+gaerdbms``. - Remove deprecated parameter ``quoting`` from :class:`.mysql.ENUM` and :class:`.mysql.SET` in the ``mysql`` dialect. - Remove deprecated function ``comparable_property``. and function ``comparable_using`` in the declarative extension. - Remove deprecated function ``compile_mappers``. - Remove deprecated method ``collection.linker``. - Remove deprecated method ``Session.prune`` and parameter ``Session.weak_identity_map``. This change also removes the class ``StrongInstanceDict``. - Remove deprecated parameter ``mapper.order_by``. - Remove deprecated parameter ``Session._enable_transaction_accounting`. - Remove deprecated parameter ``Session.is_modified.passive``. - Remove deprecated class ``Binary``. Please use :class:`.LargeBinary`. - Remove deprecated methods ``Compiled.compile``, ``ClauseElement.__and__`` and ``ClauseElement.__or__`` and attribute ``Over.func``. - Remove deprecated ``FromClause.count`` method. - Remove deprecated parameter ``Table.useexisting``. - Remove deprecated parameters ``text.bindparams`` and ``text.typemap``. - Remove boolean support for the ``passive`` parameter in ``get_history``. - Remove deprecated ``adapt_operator`` in ``UserDefinedType.Comparator``. Fixes: #4643 Change-Id: Idcd390c77bf7b0e9957907716993bdaa3f1a1763
* | | Modernize test_defaultsMike Bayer2020-04-101-1/+8
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | Use modern execution patterns, goal is so that these same tests can work for the future engine break sequence tests into test_sequences suite sequence tests that are testing implicit execution patterns at least move into their own suite that will go into test_deprecations eventually. Change-Id: I27cac9bd265c86ff2a3381ff9f844f60ef991cfc
* | Change ``orm.future`` to ``future.orm``Federico Caselli2020-04-082-1/+11
|/ | | | Change-Id: I7fcf8b691134a0c52fbbf7879da071a41ec28102
* Merge "Use dot-separated name resolution for relationship target"mike bayer2020-04-082-14/+92
|\
| * Use dot-separated name resolution for relationship targetMike Bayer2020-04-072-14/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The string argument accepted as the first positional argument by the :func:`.relationship` function when using the Declarative API is no longer interpreted using the Python ``eval()`` function; instead, the name is dot separated and the names are looked up directly in the name resolution dictionary without treating the value as a Python expression. However, passing a string argument to the other :func:`.relationship` parameters that necessarily must accept Python expressions will still use ``eval()``; the documentation has been clarified to ensure that there is no ambiguity that this is in use. Fixes: #5238 Change-Id: Id802f403190adfab0ca034afe2214ba10fd9cfbb
* | Gracefully skip isolation level if no row returnedMike Bayer2020-04-071-1/+8
|/ | | | | | | | | | | Fixed issue in MySQL dialect when connecting to a psuedo-MySQL database such as that provided by ProxySQL, the up front check for isolation level when it returns no row will not prevent the dialect from continuing to connect. A warning is emitted that the isolation level could not be detected. Fixes: #5239 Change-Id: I4a240386a0d38bd90733819495ce50e37fe2234c
* Merge "Broaden is[not]_distinct_from support"mike bayer2020-04-077-3/+103
|\
| * Broaden is[not]_distinct_from supportGord Thompson2020-04-027-3/+103
| | | | | | | | | | | | | | Added support for .is[not]_distinct_from to SQL Server, MySQL, and Oracle. Fixes: #5137 Change-Id: I3b4d3b199821a55687f83c9a5b63a95d07a64cd5
* | Ensure length parameter of Enum is adapted to new objectsMike Bayer2020-04-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Ensure length parameter added to Enum in Iea05dc8cd9e33959bb968b394fb10a7dd068c873 is correctly propagated to new enum objects adapted from this one. Fixes: #5183 ` Change-Id: I7f20d926f73ec8260938963df87e29894c7e55e2
* | Merge "Add length parameter in `Enum`"mike bayer2020-04-061-1/+18
|\ \
| * | Add length parameter in `Enum`Federico Caselli2020-04-061-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | The `Enum` type now supports the parameter `Enum.length` to specify the length of the VARCHAR column to create when using non native enums by setting `Enum.native_enum` to `False` Fixes: #5183 Change-Id: Iea05dc8cd9e33959bb968b394fb10a7dd068c873
* | | Apply fix to ComputedReflectionFixtureTestGord Thompson2020-04-042-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | Avoid errors for dialects without schema support. Also fix typo in test name. Fixes: #5230 Change-Id: Id0f759b591a6119069b0fc5fc3b02addb85b0597
* | | Key subqueryloaders on the property object, not string keyMike Bayer2020-04-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug in :func:`.orm.selectinload` loading option where two or more loaders that represent different relationships with the same string key name as referenced from a single :func:`.orm.with_polymorphic` construct with multiple subclass mappers would fail to invoke each subqueryload separately, instead making use of a single string-based slot that would prevent the other loaders from being invoked. Fixes: #5228 Change-Id: Id0d1db8029ca88c13c0068115fe673adb7a68407
* | | Run autoflush for column attribute load operationsMike Bayer2020-04-034-9/+18
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "autoflush" behavior of :class:`.Query` will now trigger for nearly all ORM level attribute load operations, including when a deferred column is loaded as well as when an expired column is loaded. Previously, autoflush on load of expired or unloaded attributes was limited to relationship-bound attributes only. However, this led to the issue where column-based attributes that also depended on other rows, or even other columns in the same row, in order to express the correct value, would show an effectively stale value when accessed as there could be pending changes in the session left to be flushed. Autoflush is now disabled only in some cases where attributes are being unexpired in the context of a history operation. Fixes: #5226 Change-Id: Ibd965b30918cd273ae020411a704bf2bb1891f59
* | Repair caching / traversals for valuesMike Bayer2020-04-013-56/+54
|/ | | | | | | | | | | | | | The test suite wasn't running the copy_internals most fixtures, enable that and try to get all cases working. Set up selectable.values to do tuple conversion within compilation step. at the same time, disable caching for selectable.values for the moment and make it equivalent to dml_multi_values. fix cache / compare / copy cases for dml_values and dml_multi_values which weren't fully tested or covered. Change-Id: I484ca6e9cb2b66c2e6a321698f2abc0838db1460
* Try to measure new style caching in the ORM, take twoMike Bayer2020-04-0122-215/+482
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supercedes: If78fbb557c6f2cae637799c3fec2cbc5ac248aaf Trying to see if by making the cache key memoized, we still can have the older "identity" form of caching which is the cheapest of all, at the same time as the newer "cache key each time" version that is not nearly as cheap; but still much cheaper than no caching at all. Also needed is a per-execution update of _keymap when we invoke from a cached select, so that Column objects that are anonymous or otherwise adapted will match up. this is analogous to the adaption of bound parameters from the cache key. Adds test coverage for the keymap / construct_params() changes related to caching. Also hones performance to a large extent for statement construction and cache key generation. Also includes a new memoized attribute approach that vastly simplifies the previous approach of "group_expirable_memoized_property" and finally integrates cleanly with _clone(), _generate(), etc. no more hardcoding of attributes is needed, as well as that most _reset_memoization() calls are no longer needed as the reset is inherent in a _generate() call; this also has dramatic performance improvements. Change-Id: I95c560ffcbfa30b26644999412fb6a385125f663
* Fix databases -> dialectsMike Bayer2020-04-011-1/+1
| | | | | | | | | The change in I5343a2d270ed5a8c654b9fe13dff40cdf54649ed left the name "databases" present in one spot, which is usually not reached unless tests are being run on only partial files where not every dialect has been imported. Change-Id: I5a8776b412eaf2476f8a93eebc31448b6f9218ee
* Remove ORDER BY pk from subqueryload, selectinloadMike Bayer2020-03-301-13/+11
| | | | | | | | | | | | | | | | | | | | Modified the queries used by subqueryload and selectinload to no longer ORDER BY the primary key of the parent entity; this ordering was there to allow the rows as they come in to be copied into lists directly with a minimal level of Python-side collation. However, these ORDER BY clauses can negatively impact the performance of the query as in many scenarios these columns are derived from a subquery or are otherwise not actual primary key columns such that SQL planners cannot make use of indexes. The Python-side collation uses the native itertools.group_by() to collate the incoming rows, and has been modified to allow multiple row-groups-per-parent to be assembled together using list.extend(), which should still allow for relatively fast Python-side performance. There will still be an ORDER BY present for a relationship that includes an explicit order_by parameter, however this is the only ORDER BY that will be added to the query for both kinds of loading. Fixes: #5162 Change-Id: I8befd1303c1af7cc24cbf005f39bc01c8b2745f3
* Merge "String compiler can now literal compile datetime objects"mike bayer2020-03-301-0/+26
|\
| * String compiler can now literal compile datetime objectsFederico Caselli2020-03-291-0/+26
| | | | | | | | | | | | | | | | | | | | Add ability to literal compile a :class:`DateTime`, :class:`Date` or :class:"Time" when using the string dialect for debugging purposes. This change does not impact real dialect implementation that retain their current behavior. Fixes: #5052 Change-Id: Ia3fad2be905c6d35b0106b9a2388c7508f067e90
* | Merge "Add a third labeling mode for SELECT statements"mike bayer2020-03-308-62/+194
|\ \
| * | Add a third labeling mode for SELECT statementsMike Bayer2020-03-298-62/+194
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enhanced the disambiguating labels feature of the :func:`~.sql.expression.select` construct such that when a select statement is used in a subquery, repeated column names from different tables are now automatically labeled with a unique label name, without the need to use the full "apply_labels()" feature that conbines tablename plus column name. The disambigated labels are available as plain string keys in the .c collection of the subquery, and most importantly the feature allows an ORM :func:`.orm.aliased` construct against the combination of an entity and an arbitrary subquery to work correctly, targeting the correct columns despite same-named columns in the source tables, without the need for an "apply labels" warning. The existing labeling style is now called LABEL_STYLE_TABLENAME_PLUS_COL. This labeling style will remain used throughout the ORM as has been the case for over a decade, however, the new disambiguation scheme could theoretically replace this scheme entirely. The new scheme would dramatically alter how SQL looks when rendered from the ORM to be more succinct but arguably harder to read. The tablename_columnname scheme used by Join.c is unaffected here, as that's still hardcoded to that scheme. Fixes: #5221 Change-Id: Ib47d9e0f35046b3afc77bef6e65709b93d0c3026
* | Remove support for python 3.4Federico Caselli2020-03-304-23/+6
|/ | | | | | Also remove no longer used compat code Change-Id: Ifda239fd84b425e43f4028cb55a5b3b8efa4dfc6
* Fix typo in resultproxy.c and test compatibility with python 3.5Federico Caselli2020-03-282-3/+4
| | | | | | | | | | | - Fix typo in resultproxy.c that would error on windows. - add -Wundef to C flags when linux is detected so that undefined symbols emit a warning - a few adjustments for tests to succeed on python 3.5 - note minimum version still documented here as 3.4 but this should move to at least 3.5 if not 3.6 for SQLAlchemy 1.4 Change-Id: Ia93ee1cb5c52e51e72eb0a24c100421c5157d04b
* Merge "Correct ambiguous func / class links"mike bayer2020-03-2513-120/+124
|\
| * Correct ambiguous func / class linksMike Bayer2020-03-2513-120/+124
| | | | | | | | | | | | | | | | | | :func:`.sql.expression.select`, :func:`.sql.expression.insert` and :class:`.sql.expression.Insert` were hitting many ambiguous symbol errors, due to future.select, as well as the PG/MySQL variants of Insert. Change-Id: Iac862bfc172a7f7f0cbba5353a83dc203bed376c
* | Merge "Deprecate add of columns in order by with distinct"mike bayer2020-03-253-15/+39
|\ \ | |/ |/|
| * Deprecate add of columns in order by with distinctFederico Caselli2020-03-253-15/+39
| | | | | | | | | | | | | | Deprecate automatic addition of order by column in a query with a distinct Fixes: #5134 Change-Id: I467a39379c496be7e84a05f11ba9f8ca2bcc6e32
* | Merge "Implement autocommit isolation level for pysqlite"mike bayer2020-03-242-2/+31
|\ \ | |/ |/|
| * Implement autocommit isolation level for pysqliteGord Thompson2020-03-242-2/+31
| | | | | | | | | | Fixes: #5164 Change-Id: I190b9de552dfed9f2a33babf82e42465ef09c82a
* | Merge "Implement SQL VALUES in core."mike bayer2020-03-245-0/+169
|\ \
| * | Implement SQL VALUES in core.Gord Thompson2020-03-245-0/+169
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Added a core :class:`Values` object that enables a VALUES construct to be used in the FROM clause of an SQL statement for databases that support it (mainly PostgreSQL and SQL Server). Fixes: #4868 Closes: #5030 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5030 Pull-request-sha: 84684038a8efa93b460318e0db53f6c644554588 Change-Id: Ib8109b63bc1a9dc04ab987c5322ca3375f7e824d
* | Merge "Convert schema_translate to a post compile"mike bayer2020-03-2412-148/+147
|\ \
| * | Convert schema_translate to a post compileMike Bayer2020-03-2412-148/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revised the :paramref:`.Connection.execution_options.schema_translate_map` feature such that the processing of the SQL statement to receive a specific schema name occurs within the execution phase of the statement, rather than at the compile phase. This is to support the statement being efficiently cached. Previously, the current schema being rendered into the statement for a particular run would be considered as part of the cache key itself, meaning that for a run against hundreds of schemas, there would be hundreds of cache keys, rendering the cache much less performant. The new behavior is that the rendering is done in a similar manner as the "post compile" rendering added in 1.4 as part of :ticket:`4645`, :ticket:`4808`. Fixes: #5004 Change-Id: Ia5c89eb27cc8dc2c5b8e76d6c07c46290a7901b6
* | | Improve the method ``__str__`` of :class:`ColumnCollection`Federico Caselli2020-03-241-3/+6
| |/ |/| | | | | | | | | | | | | The change avoids confusing a :class:`ColumnCollection` with a python list since the previous string representation was the same. Fixes: #5191 Change-Id: Icdbc08f9991d31ce86372505e3614740eaee56e2
* | Merge "Remove deprecated elements from selectable.py; remove lockmode"mike bayer2020-03-234-109/+7
|\ \
| * | Remove deprecated elements from selectable.py; remove lockmodeMike Bayer2020-03-234-109/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Removed autocommit and legacy "for update" / "lockmode" elements from selectable.py / query.py. lockmode was removed from selectable in 693938dd6fb2f3ee3e031aed4c62355ac97f3ceb however was not removed from the ORM. Also removes the ignore_nonexistent_tables option on join(). Change-Id: I0cfcf9e6a8d4ef6432c9e25ef75173b3b3f5fd87 Partially-fixes: #4643
* | Implement autocommit isolation level for cx_oracleGord Thompson2020-03-234-1/+149
|/ | | | | | | | | | | | | | | | As part of this change Oracle also gets the concept of a default isolation level, however since Oracle does not provide a fixed method of knowing what the isolation level would be without a server side transaction actually in progress, for now we hardcode just to "READ COMMITTED". Enhanced the test suite for isolation level testing in the dialect test suite and added features to requirements so that the supported isolation levels can be reported generically for dialects. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #5200 Change-Id: I2c4d49da9ff80ccc228c21e196ec9a961de53478
* Merge "Test instance for matching class hierarchy on get_from_identity"mike bayer2020-03-226-3/+19
|\
| * Test instance for matching class hierarchy on get_from_identityMike Bayer2020-03-226-3/+19
| | | | | | | | | | | | | | | | | | | | | | Fixed issue where a lazyload that uses session-local "get" against a target many-to-one relationship where an object with the correct primary key is present, however it's an instance of a sibling class, does not correctly return None as is the case when the lazy loader actually emits a load for that row. Fixes: #5210 Change-Id: I89f9946cfeba61d89a272435f76a5a082b1da30c