summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
| * 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
* | Deprecate plain string in execute and introduce `exec_driver_sql`Federico Caselli2020-03-2130-162/+268
|/ | | | | | | | | | | | | | | Execution of literal sql string is deprecated in the :meth:`.Connection.execute` and a warning is raised when used stating that it will be coerced to :func:`.text` in a future release. To execute a raw sql string the new connection method :meth:`.Connection.exec_driver_sql` was added, that will retain the previous behavior, passing the string to the DBAPI driver unchanged. Usage of scalar or tuple positional parameters in :meth:`.Connection.execute` is also deprecated. Fixes: #4848 Fixes: #5178 Change-Id: I2830181054327996d594f7f0d59c157d477c3aa9
* Don't include PG INCLUDE columns as regular index columnsmike bayer2020-03-181-4/+22
| | | | | | | | | | | | | | | | Fixed issue where a "covering" index, e.g. those which have an INCLUDE clause, would be reflected including all the columns in INCLUDE clause as regular columns. A warning is now emitted if these additional columns are detected indicating that they are currently ignored. Note that full support for "covering" indexes is part of :ticket:`4458`. Pull request courtesy Marat Sharafutdinov. Fixes: #5205 Closes: #5206 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5206 Pull-request-sha: 512a3817bb21991142add2d192fa7ce9b285369d Change-Id: I3196a2bf77dc5a6abd85b2fbf0ebff1b30d4fb00
* Merge "updated doc string to show `NOT (EXISTS` instead of `NOT EXISTS`, as …"mike bayer2020-03-181-2/+2
|\
| * updated doc string to show `NOT (EXISTS` instead of `NOT EXISTS`, as …jonathan vanasco2020-03-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | …that is what SqlAlchemy now renders. SqlAlchemy currently renders `NOT (EXISTS` not `NOT EXISTS`. This fixes the example SQL. ### Description The change is a docstring only. ### Checklist 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: #4593 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4593 Pull-request-sha: fef577313242a1f79feb18969118a8fbb93bb6e9 Change-Id: Iee826a1754d76c93c014b44374e0f9aeabb8d0b6
* | Merge "import the module as passed before we look in sys.modules"mike bayer2020-03-171-4/+1
|\ \
| * | import the module as passed before we look in sys.modulesMike Bayer2020-03-171-4/+1
| |/ | | | | | | | | | | | | | | | | | | in I2e291eba4297867fc0ddb5d875b9f7af34751d01, the importer is importing tokens[0:-1] and then the final token as the name; this doesn't always work for the two example modules of "xml.dom" and "wsgiref.simple_server". import the complete path we will pull from sys.modules directly. Change-Id: I833a770f4c3e7463fa56234d891870083e48cc73
* | Support inspection of computed columnFederico Caselli2020-03-159-26/+312
|/ | | | | | | | | | | | | | | | | | | Added support for reflection of "computed" columns, which are now returned as part of the structure returned by :meth:`.Inspector.get_columns`. When reflecting full :class:`.Table` objects, computed columns will be represented using the :class:`.Computed` construct. Also improve the documentation in :meth:`Inspector.get_columns`, correctly listing all the returned keys. Fixes: #5063 Fixes: #4051 Closes: #5064 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5064 Pull-request-sha: ba00fc321ce468f8885aad23b3dd33c789e50fbe Change-Id: I789986554fc8ac7f084270474d0b2c12046b1cc2
* Merge "Fix IntegerTest for sqlalchemy-firebird"mike bayer2020-03-131-1/+1
|\
| * Fix IntegerTest for sqlalchemy-firebirdGord Thompson2020-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | Recent cleanup of test_types.py introduced a regression for sqlalchemy-firebird (and possibly other external dialects). With this change, `test_huge_int` now passes for sqlalchemy-firebird. Change-Id: Ieeb4b33ec5985f2e2bf6832d1cdef294f85407a0
* | Fix tests failing for SQLite file databases; repair provisioningGord Thompson2020-03-137-19/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. ensure provision.py loads dialect implementations when running reap_dbs.py. Reapers haven't been working since 598f2f7e557073f29563d4d567f43931fc03013f . 2. add some exclusion rules to allow the sqlite_file target to work; add to tox. 3. add reap dbs target for SQLite, repair SQLite drop_db routine which also wasn't doing the right thing for memory databases etc. 4. Fix logging in provision files, as the main provision logger is the one that's enabled by reap_dbs and maybe others, have all the provision files use the provision logger. Fixes: #5180 Fixes: #5168 Change-Id: Ibc1b0106394d20f5bcf847f37b09d185f26ac9b5
* | Include schema in all_tab_comments queryMike Bayer2020-03-121-2/+7
| | | | | | | | | | | | | | | | | | | | | | Fixed regression / incorrect fix caused by fix for :ticket:`5146` where the Oracle dialect reads from the "all_tab_comments" view to get table comments but fails to accommodate for the current owner of the table being requested, causing it to read the wrong comment if multiple tables of the same name exist in multiple schemas. Fixes: #5146 Change-Id: Id79fbaa81b0e36cd4af60c48e4ab35c593ace057
* | Dont raise on pytest deprecation warningsMike Bayer2020-03-122-0/+22
| | | | | | | | | | | | | | | | | | py.test 5.4.0 emits deprecation warnings for pytest.Class. make sure we don't raise for these, and log the code that will be used for 5.4.0 when we bump requirements. Fixes: #5201 Change-Id: I83e0402c4a6b2365a63b58d052c6989df3a37328
* | Merge "Fix link in docs of query_expression and with_expression"mike bayer2020-03-112-2/+2
|\ \
| * | Fix link in docs of query_expression and with_expressionFederico Caselli2020-03-112-2/+2
| | | | | | | | | | | | | | | | | | Ref #5198 Change-Id: I566c2f7bbe08e9017e09e133079bef1c38469595
* | | Merge "Rework select(), CompoundSelect() in terms of CompileState"mike bayer2020-03-119-555/+614
|\ \ \ | |/ / |/| |
| * | Rework select(), CompoundSelect() in terms of CompileStateMike Bayer2020-03-109-555/+614
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuation of I408e0b8be91fddd77cf279da97f55020871f75a9 - add an options() method to the base Generative construct. this will be where ORM options can go - Change Null, False_, True_ to be singletons, so that we aren't instantiating them and having to use isinstance. The previous issue with this was that they would produce dupe labels in SELECT statements. Apply the duplicate column logic, newly added in 1.4, to these objects as well as to non-apply-labels SELECT statements in general as a means of improving this. - create a revised system for generating ClauseList compilation constructs that simplfies up front creation to not actually use ClauseList; a simple tuple is rendered by the compiler using the same constrcution rules as what are used for ClauseList but without creating the actual object. Apply to Select, CompoundSelect, revise Update, Delete - Select, CompoundSelect get an initial CompileState implementation. All methods used only within compilation are moved here - refine update/insert/delete compile state to not require an outside boolean - refine and simplify Select._copy_internals - rework bind(), which is going away, to not use some of the internal traversal stuff - remove "autocommit", "for_update" parameters from Select, references #4643 - remove "autocommit" parameter from TextClause , references #4643 - add deprecation warnings for statement.execute(), engine.execute(), statement.scalar(), engine.scalar(). Fixes: #5193 Change-Id: I04ca0152b046fd42c5054ba10f37e43fc6e5a57b
* | | Repair broken call to sys.exc_info()Mike Bayer2020-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression in 1.3.14 due to :ticket:`4849` where a sys.exc_info() call failed to be invoked correctly when a flush error would occur. Test coverage has been added for this exception case. Fixes: #5196 Change-Id: Ib59a58a3a9d4c9c6f4b751201b794816a9f70225
* | | Reword implicit left join error; ensure deterministic FROM for columnsMike Bayer2020-03-101-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjusted the error message emitted by :meth:`.Query.join` when a left hand side can't be located that the :meth:`.Query.select_from` method is the best way to resolve the issue. Also, within the 1.3 series, used a deterministic ordering when determining the FROM clause from a given column entity passed to :class:`.Query` so that the same expression is determined each time. Fixes: #5194 Change-Id: I2e4065fd31e98c57edf2f11d5e831be44d2c1ea2
* | | Merge "Simplified module pre-loading strategy and made it linter friendly"mike bayer2020-03-1031-289/+281
|\ \ \
| * | | Simplified module pre-loading strategy and made it linter friendlyFederico Caselli2020-03-0731-289/+281
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduced a modules registry to register modules that should be lazily loaded in the package init. This ensures that they are in the system module cache, avoiding potential thread safety issues as when importing them directly in the function that uses them. The module registry is used to obtain these modules directly, ensuring that the all the lazily loaded modules are resolved at the proper time This replaces dependency_for decorator and the dependencies decorator logic, removing the need to pass the resolved modules as arguments of the decodated functions and removes possible errors caused by linters. Fixes: #4689 Fixes: #4656 Change-Id: I2e291eba4297867fc0ddb5d875b9f7af34751d01
* | | Deprecate :func:`.eagerload` and :func:`.relation`Federico Caselli2020-03-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The :func:`.eagerload` and :func:`.relation` were old aliases and are now deprecated. Use :func:`.joinedload` and :func:`.relationship` respectively. Fixes: #5192 Change-Id: Ie13186e117e93e04a9c19d42fed4ef1af629b465
* | | Reflect comments from any table accessible by the current userGord Thompson2020-03-101-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Fixed a reflection bug where table comments could only be retrieved for tables actually owned by the user but not for tables visible to the user but owned by someone else. Pull request courtesy Dave Hirschfeld. Fixes: #5146 Closes: #5147 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5147 Pull-request-sha: 0651e3bed05923765203b37986a2506dac3e634e Change-Id: If970fda10d6adf04d926d38df1a567df1de9f7b9
* | Decouple compiler state from DML objects; make cacheableMike Bayer2020-03-0613-370/+820
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Targeting select / insert / update / delete, the goal is to minimize overhead of construction and generative methods so that only the raw arguments passed are handled. An interim stage that converts the raw state into more compiler-ready state is added, which is analogous to the ORM QueryContext which will also be rolled in to be a similar concept, as is currently being prototyped in I19e05b3424b07114cce6c439b05198ac47f7ac10. the ORM update/delete BulkUD concept is also going to be rolled onto this idea. So while the compiler-ready state object, here called DMLState, looks a little thin, it's the base of a bigger pattern that will allow for ORM functionality to embed itself directly into the compiler, execution context, and result set objects. This change targets the DML objects, primarily focused on the values() method which is the most complex process. The work done by values() is minimized as much as possible while still being able to create a cache key. Additional computation is then offloaded to a new object ValuesState that is handled by the compiler. Architecturally, a big change here is that insert.values() and update.values() will generate BindParameter objects for the values now, which are then carefully received by crud.py so that they generate the expected names. This is so that the values() portion of these constructs is cacheable. for the "multi-values" version of Insert, this is all skipped and the plan right now is that a multi-values insert is not worth caching (can always be revisited). Using the coercions system in values() also gets us nicer validation for free, we can remove the NotAClauseElement thing from schema, and we also now require scalar_subquery() is called for an insert/update that uses a SELECT as a column value, 1.x deprecation path is added. The traversal system is then applied to the DML objects including tests so that they have traversal, cloning, and cache key support. cloning is not a use case for DML however having it present allows better validation of the structure within the tests. Special per-dialect DML is explicitly not cacheable at the moment, more as a proof of concept that third party DML constructs can exist as gracefully not-cacheable rather than producing an incomplete cache key. A few selected performance improvements have been added as well, simplifying the immutabledict.union() method and adding a new SQLCompiler function that can generate delimeter-separated clauses like WHERE and ORDER BY without having to build a ClauseList object at all. The use of ClauseList will be removed from Select in an upcoming commit. Overall, ClaustList is unnecessary for internal use and only adds overhead to statement construction and will likely be removed as much as possible except for explcit use of conjunctions like and_() and or_(). Change-Id: I408e0b8be91fddd77cf279da97f55020871f75a9
* | Render VALUES within composed MySQL on duplicate key expressionsMike Bayer2020-03-041-9/+25
| | | | | | | | | | | | | | | | | | | | Fixed issue in MySQL :meth:`.mysql.Insert.on_duplicate_key_update` construct where using a SQL function or other composed expression for a column argument would not properly render the ``VALUES`` keyword surrounding the column itself. Fixes: #5173 Change-Id: I16d39c2fdb8bbb7f3d1b2ffdd20e1bf69359ab75
* | Merge "Don't import provision.py unconditionally"mike bayer2020-03-0410-9/+42
|\ \
| * | Don't import provision.py unconditionallyMike Bayer2020-03-0310-9/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed the imports for provision.py from each dialect and instead added a call in the central provision.py to a new dialect level method load_provisioning(). The provisioning registry works in the same way, so an existing dialect that is using the provision.py system right now by importing it as part of the package will still continue to function. However, to avoid pulling in the testing package when the dialect is used in a non-testing context, the new hook may be used. Also removed a module-level dependency of the testing framework on the orm package. Revised an internal change to the test system added as a result of :ticket:`5085` where a testing-related module per dialect would be loaded unconditionally upon making use of that dialect, pulling in SQLAlchemy's testing framework as well as the ORM into the module import space. This would only impact initial startup time and memory to a modest extent, however it's best that these additional modules aren't reverse-dependent on straight Core usage. Fixes: #5180 Change-Id: I6355601da5f6f44d85a2bbc3acb5928559942b9c
* | | Merge remote-tracking branch 'origin/pr/5186'Mike Bayer2020-03-041-1/+1
|\ \ \ | | | | | | | | | | | | Change-Id: I35921d46676e77ebdbe93f12406cdde3f6656704
| * | | fix typo in PickleType documentationFederico Caselli2020-03-041-1/+1
| |/ /
* | | Merge "Remove the deprecated loader options"mike bayer2020-03-042-29/+0
|\ \ \
| * | | Remove the deprecated loader optionsFederico Caselli2020-03-032-29/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Remove the deprecated loader options ``joinedload_all``, ``subqueryload_all``, ``lazyload_all``, ``selectinload_all``. The normal version with method chaining should be used in their place. Fixes: #4642 Change-Id: I12eb4dfa7a86375911a570934ee662653d85d50a
* | | Merge "Restore crud flags if visiting_cte is set"mike bayer2020-03-042-2/+5
|\ \ \
| * | | Restore crud flags if visiting_cte is setMike Bayer2020-03-032-2/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where a CTE of an INSERT/UPDATE/DELETE that also uses RETURNING could then not be SELECTed from directly, as the internal state of the compiler would try to treat the outer SELECT as a DELETE statement itself and access nonexistent state. Fixes: #5181 Change-Id: Icba76f2148c8344baa1c04bac4ab6c6d24f23072
* | | Run handle_error for any exceptions raised in execute_context()Mike Bayer2020-03-031-30/+31
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Observing a SQLite connection/cursor being hung on test_resultset -> PositionalTextTest -> test_dupe_col_obj. this uses connectionless execution and the result object fails to be constructed. When that happens, there is no path for the cursor or connection to be closed / released. Recent changes with the exception assertions in #4849 seem to be causing a cycle to last a little longer than usual which is exposing this issue for one particular test on SQLite. As we want to get rid of weakref cleanup, evaluate why we dont have handle_dbapi_exception for this whole block, as after_cursor_execute can raise, result construction can raise, autocommit can raise, close can raise, there does not seem to be a reason these things should be outside of the block that gets cleaned up. Fixes: #5182 Change-Id: I640ac55e8c5f39d287f779fbb5dc0ab727218ca3
* | Include column_property composition examplesMike Bayer2020-03-031-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | Add cross-linking between column_property() and ColumnProperty Add section to describe using .expression remove inherited-members from ColumnProperty to greatly decrease verbosity Fixes: #5179 Change-Id: Ic477b16350dbf551100b31d14ff3ba8ba8221a43
* | Merge "Ensure all nested exception throws have a cause"mike bayer2020-03-0241-401/+703
|\ \