summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
* add --notimingintensive; block from github jobstiming_intensiveMike Bayer2020-10-061-0/+12
| | | | | | | | | | | | | | | | | | this provides a front-end option to disable tests marked as timing_intensive, all of which are in test_pool, which are more fragile and aren't consistent on the github runners. also remove /reduce unnecessary time.sleep() from two other pool tests that are not timing intensive. note that this removes test_hanging_connect_within_overflow from the github runs via the timing_intensive requirement. I've also removed MockReconnectTest from exclusions as those are really important tests and they use mocks so should not have platform dependent issues. Need to see what the windows failures are. Change-Id: Icb3d284a2a952e2495d80fa91e22e0b32a54340f
* Merge "Fetch first support"mike bayer2020-10-0510-92/+415
|\
| * Fetch first supportFederico Caselli2020-10-0210-92/+415
| | | | | | | | | | | | | | | | | | Add support to ``FETCH {FIRST | NEXT} [ count ] {ROW | ROWS} {ONLY | WITH TIES}`` in the select for the supported backends, currently PostgreSQL, Oracle and MSSQL. Fixes: #5576 Change-Id: Ibb5871a457c0555f82b37e354e7787d15575f1f7
* | Merge "Improve some documentations"mike bayer2020-10-054-35/+35
|\ \
| * | Improve some documentationsFederico Caselli2020-09-294-35/+35
| | | | | | | | | | | | Change-Id: Ibcb0da3166b94aa58fa92d544c3e5cf75844546e
* | | Enable pypy tests on github workflowFederico Caselli2020-10-025-4/+6
| |/ |/| | | | | | | Fixes: #5223 Change-Id: I0952e54ed9af2952ea340be1945311376ffc1ad2
* | Merge "use execute_20 to preserve compiled cache"mike bayer2020-10-021-46/+51
|\ \
| * | use execute_20 to preserve compiled cacheMike Bayer2020-10-021-46/+51
| | | | | | | | | | | | | | | Fixes: #5420 Change-Id: I3e5a255207da752b7b7cc9b8f41ad5e2ccd0b447
* | | accommodate for null in sqlite regex handlerMike Bayer2020-10-022-1/+3
|/ / | | | | | | | | Fixes: #5624 Change-Id: Ic20dcde0a1e96b9981c63cac3cd34c7fdc7bd395
* | Merge "raise on lower-case column shared to multiple tables"mike bayer2020-09-301-0/+7
|\ \
| * | raise on lower-case column shared to multiple tablesMike Bayer2020-09-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where an error was not raised for lower-case :func:`_column` added to lower-case :func:`_table` object. This now raises :class:`_exc.ArgumentError` which has always been the case for upper-case :class:`_schema.Column` and :class:`_schema.Table`. Fixes: #5618 Change-Id: Ifcbdf27c022fd2996a5b99559df71fc1c1e0f19c
* | | fix too-short underlineMike Bayer2020-09-301-1/+2
|/ / | | | | | | Change-Id: Id9ac0b45f0859199e7db61ef5d4fac956b74b2ba
* | Merge "Support for multiple hosts in PostgreSQL connection string"mike bayer2020-09-301-0/+31
|\ \
| * | Support for multiple hosts in PostgreSQL connection stringRamonWill2020-09-231-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide support for multiple hosts in the PostgreSQL connection string. A user requested for SQLAlchemy to support multiple hosts within a PostgreSQL URL string. The proposed fix allows this. In the event that the url contains multiple hosts the proposed code will convert the query["hosts"] tuple into a single string. This allows the hosts to then get converted into a valid dsn variable in the psycopg2 connect function. This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [X ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. **Have a nice day!** Fixes: #4392 Closes: #5554 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5554 Pull-request-sha: 3f7a0ab8df9f1411a9f1ac0e152583bc7bf0c365 Change-Id: I3f3768d51b8331de786ffdc025b7ecfc662eafe5
* | | Scan for tables without relying upon whereclauseMike Bayer2020-09-292-1/+18
| |/ |/| | | | | | | | | | | | | | | | | | | | | Fixed bug where an UPDATE statement against a JOIN using MySQL multi-table format would fail to include the table prefix for the target table if the statement had no WHERE clause, as only the WHERE clause were scanned to detect a "multi table update" at that particular point. The target is now also scanned if it's a JOIN to get the leftmost table as the primary table and the additional entries as additional FROM entries. Fixes: #5617 Change-Id: I26d74afebe06e28af28acf960258f170a1627823
* | Add reflection for Identity columnsFederico Caselli2020-09-289-103/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for reflecting "identity" columns, which are now returned as part of the structure returned by :meth:`_reflection.Inspector.get_columns`. When reflecting full :class:`_schema.Table` objects, identity columns will be represented using the :class:`_schema.Identity` construct. Fixed compilation error on oracle for sequence and identity column ``nominvalue`` and ``nomaxvalue`` options that require no space in them. Improved test compatibility with oracle 18. As part of the support for reflecting :class:`_schema.Identity` objects, the method :meth:`_reflection.Inspector.get_columns` no longer returns ``mssql_identity_start`` and ``mssql_identity_increment`` as part of the ``dialect_options``. Use the information in the ``identity`` key instead. The mssql dialect will assume that at least MSSQL 2005 is used. There is no hard exception raised if a previous version is detected, but operations may fail for older versions. Fixes: #5527 Fixes: #5324 Change-Id: If039fe637c46b424499e6bac54a2cbc0dc54cb57
* | upgrade to black 20.8b1Mike Bayer2020-09-2875-304/+436
| | | | | | | | | | | | | | It's better, the majority of these changes look more readable to me. also found some docstrings that had formatting / quoting issues. Change-Id: I582a45fde3a5648b2f36bab96bad56881321899b
* | Add deprecation warning for .join().alias()Gord Thompson2020-09-287-93/+77
| | | | | | | | | | | | | | | | | | The :meth:`_sql.Join.alias` method is deprecated and will be removed in SQLAlchemy 2.0. An explicit select + subquery, or aliasing of the inner tables, should be used instead. Fixes: #5010 Change-Id: Ic913afc31f0d70b0605f9a7af2742a0de1f9ad19
* | Merge "build the full compilestate every time"mike bayer2020-09-281-2/+1
|\ \
| * | build the full compilestate every timeMike Bayer2020-09-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the ORMSelectCompileState was trying to get away with not building out the "froms" list of the state, but we need this for select.froms. Build this out and add some tests for select(), including some other state-oriented use cases. Fixes: #5614 Change-Id: I29ca200f292cbae87c722bc97a89d7c453d7d27a
* | | Merge "dont use uninstrument event to dispose registry entry"mike bayer2020-09-285-9/+14
|\ \ \ | |/ / |/| |
| * | dont use uninstrument event to dispose registry entryMike Bayer2020-09-275-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | since 450f5c0d6519a439f4025c3892fe4c we've been seeing errors during the uninstrument_class event where first we saw an internal weakref being collected earlier than seen, then fixing that we saw the listener collection changing during iteration for similar reasons. we would assume the issue is because of the interaction between mapper / instrumentation/ registry during a test teardown and the usage of the uninstrument_class event within this interaction. this interaction is too fundamental to be relying upon this event in any case and when I wrote this new code i was planning on changing that part in any case, I just forgot. Change-Id: I15744e01bb4d3349bfd529593ebd23eae658eaab
* | | Merge "Accommodate for same base class multiple times in inherits list"mike bayer2020-09-281-1/+2
|\ \ \
| * | | Accommodate for same base class multiple times in inherits listMike Bayer2020-09-271-1/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | Improved declarative inheritance scanning to not get tripped up when the same base class appears multiple times in the base inheritance list. Fixes: #4699 Change-Id: I932e735cd2e2c1efa935936c84219924225d10f1
* | | Repair erroneous "future" symbolMike Bayer2020-09-271-7/+2
|/ / | | | | | | | | | | | | | | | | | | | | the change in 1e800285508ecd869c6874fed failed to fully remove the "future" symbol which then got confused against the import of the "future" package itself, which is also not needed. remove it entirely. pin pytest < 6.1 to see if new error condition may be avoided Change-Id: Ibe45040120d3772c39faef4a61ed26f90b60c79e
* | Support pytest 6.xMike Bayer2020-09-261-7/+4
| | | | | | | | | | | | | | pytest has removed support for pytest.Class().collect() and we need to use from_parent. Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4
* | Merge "new docs WIP"mike bayer2020-09-257-41/+134
|\ \
| * | new docs WIPMike Bayer2020-09-247-41/+134
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This WIP is part of the final push for 1.4's docs to fully "2.0-ize" what we can, and have it all ready. So far this includes a rewrite of the 2.0 migration, set up for the 1.4 /2.0 docs style, and a total redesign of the index page using a new flex layout in zzzeeksphinx. It also reworks some of the API reference sections to have more subheaders. zzzeeksphinx is also enhanced to provide automatic summaries for all api doc section. Change-Id: I01d360cb9c8749520246b96ee6496143c6037918
* | Merge "Improve Asyncpg json handling"mike bayer2020-09-241-11/+67
|\ \ | |/ |/|
| * Improve Asyncpg json handlingFederico Caselli2020-09-231-11/+67
| | | | | | | | | | | | | | | | | | Set default type codec for ``json`` and ``jsonb`` types when using the asyncpg driver. By default asyncpg will not decode them and return strings instead. Fixes: #5584 Change-Id: I41348eff8096ccf87b952d7e797c0694c6c4b5c4
* | Merge "Deprecate negative slice indexes"mike bayer2020-09-223-5/+25
|\ \
| * | Deprecate negative slice indexesMike Bayer2020-09-223-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "slice index" feature used by :class:`_orm.Query` as well as by the dynamic relationship loader will no longer accept negative indexes in SQLAlchemy 2.0. These operations do not work efficiently and load the entire collection in, which is both surprising and undesirable. These will warn in 1.4 unless the :paramref:`_orm.Session.future` flag is set in which case they will raise IndexError. Fixes: #5606 Change-Id: I5f5dcf984a8f41ab3d0e233ef7553e77fd99a771
* | | Expect collected weak reference in ORM listenerMike Bayer2020-09-221-0/+3
|/ / | | | | | | | | | | | | | | | | CI is showing that this listener may be triggered when the target, a mapped class, has been garbage collected. I'm not able to reproduce this locally. Change-Id: Iad96c088a9a3dc28c4bcd716e293c03d3b312efd
* | Merge "restore slice methods to dynamic query"mike bayer2020-09-221-1/+12
|\ \
| * | restore slice methods to dynamic queryMike Bayer2020-09-211-1/+12
| |/ | | | | | | | | | | | | in f0f08db5715e41cc08e57dbc76a85300b these got lost, put them back and test Change-Id: Id1962e1f5d6160fe222becec5a8e32ec6a40017a
* | Raise if unique() not applied to 2.0 joined eager load resultsMike Bayer2020-09-212-1/+19
|/ | | | | | | | | | | | | | | | | | | | | | The automatic uniquing of rows on the client side is turned off for the new :term:`2.0 style` of ORM querying. This improves both clarity and performance. However, uniquing of rows on the client side is generally necessary when using joined eager loading for collections, as there will be duplicates of the primary entity for each element in the collection because a join was used. This uniquing must now be manually enabled and can be achieved using the new :meth:`_engine.Result.unique` modifier. To avoid silent failure, the ORM explicitly requires the method be called when the result of an ORM query in 2.0 style makes use of joined load collections. The newer :func:`_orm.selectinload` strategy is likely preferable for eager loading of collections in any case. This changeset also fixes an issue where ORM-style "single entity" results would not apply unique() correctly if results were returned as tuples. Fixes: #4395 Change-Id: Ie62e0cb68ef2a6d2120e968b79575a70d057212e
* Merge "Stringify correctly for non-str exception argument"mike bayer2020-09-201-2/+10
|\
| * Stringify correctly for non-str exception argumentAndrzej Bartosiński2020-09-201-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where a non-string object sent to :class:`_exc.SQLAlchemyError` or a subclass, as occurs with some third party dialects, would fail to stringify correctly. Pull request courtesy Andrzej Bartosiński. Fixes: #5599 Closes: #5600 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5600 Pull-request-sha: cdccccc42a6ac8de771593a43ee8675bfd8dbeb6 Change-Id: Icd710d9015abc80f61a84893d75fbb33ee0fe46e
* | Fix has_table() for mssql temporary tablesGord Thompson2020-09-191-14/+27
|/ | | | | | | | | Fixes: #5597 Fixes the issue where :meth:`_reflection.has_table` always returns ``False`` for temporary tables. Change-Id: I03ab04c849a157ce8fd28c07ec3bf4407b0f2c94
* Merge "Complete deprecation of from_self()"mike bayer2020-09-199-96/+175
|\
| * Complete deprecation of from_self()Mike Bayer2020-09-189-96/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For most from_self() tests, move them into test/orm/test_deprecated.py and replace the existing test with one that uses aliased() plus a subquery. This then revealed a few more issues. Related items: * Added slice() method to GenerativeSelect, to match that of orm.Query and to make possible migration of one of the from_self() tests. moved the utility functions used for this from orm/util into sql/util. * repairs a caching issue related to subqueryload where information being derived from the cached path info was mixing up with query information based on the per-query state, specifically an AliasedClass that is per query. * for the above issue, it seemed like path_registry maybe had to change so that it represents AliasedClass objects as their cache key rather than on identity, but it wasn't needed. still seems like it would be more correct. * enhances the error message raised by coercions for a case such as when an AliasedClass holds onto a select() object and not a subquery(); will name the original and resolved object for clarity (although how is AliasedClass able to accept a Select() object in the first place?) * Added _set_propagate_attrs() to Query so that again if it's passed to AliasedClass, it doesn't raise an error during coercion, but again maybe that should also be rejected up front Fixes: #5368 Change-Id: I5912aa611d899acc87a75eb5ee9f95990592f210
* | Add support for Azure authentication optionsGord Thompson2020-09-172-3/+10
|/ | | | | Fixes: #5592 Change-Id: I0688e5ea0fc6b01a0b72f397daea8f57a2ec0766
* Merge "Create a framework to allow all SQLALCHEMY_WARN_20 to pass"mike bayer2020-09-1613-27/+135
|\
| * Create a framework to allow all SQLALCHEMY_WARN_20 to passMike Bayer2020-09-1613-27/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the test suite has widespread use of many patterns that are deprecated, enable SQLALCHEMY_WARN_20 globally for the test suite but then break the warnings filter out into a whole list of all the individual warnings we are looking for. this way individual changesets can target a specific class of warning, as many of these warnings will indivdidually affect dozens of files and potentially hundreds of lines of code. Many warnings are also resolved here as this patch started out that way. From this point forward there should be changesets that target a subset of the warnings at a time. For expediency, updates some migration 2.0 docs for ORM as well. Change-Id: I98b8defdf7c37b818b3824d02f7668e3f5f31c94
* | Don't change asyncpg's "char" codecMike Bayer2020-09-162-23/+12
|/ | | | | | | | | | | | | | This codec was used to ensure the "pg_attribute.generated" column comes back as a string and not bytes, matching how other PG drivers treat this datatype. However, this breaks asyncpg's internal implementation of set_type_codec going forward and the "char" datatype is actually a bytes in any case. So at the moment it appears psycopg2/pg8000 are broken for mis-treatment of the datatype and asyncpg is broken in that it was allowing us to change a codec that it appears to rely upon internally. Fixes: #5586 Change-Id: I937eba315904721aa4e2726b95432910a8affe5f
* Merge "Make :class:`_orm.registry` ``bind`` a private parameter."mike bayer2020-09-162-15/+20
|\
| * Make :class:`_orm.registry` ``bind`` a private parameter.Federico Caselli2020-09-152-15/+20
| | | | | | | | | | | | | | | | | | Explicitly deprecate ``bind`` from :func:`_orm.declarative_base` and :func:`_orm.as_declarative`. Some other documentation cleanup on declarative documentation. Change-Id: I3f7918d23833b2778ab7009ac5018841deb19f75
* | Merge "Correct for SQL Server temp table owner"mike bayer2020-09-161-29/+39
|\ \
| * | Correct for SQL Server temp table ownerMike Bayer2020-09-151-29/+39
| |/ | | | | | | | | | | | | | | | | | | | | | | | | on my machine, the owner for a temp table comes out as dbo, and i am testing against a CI machine. im not sure what happens on a CI machine except perhaps that it provisions new databases is changing things. in any case, since we are searching the tempdb for the name, get the schema/owner also. Also refines the test to use a single connection and a transaction that rolls back, doesn't hang here but let's see what CI does. Change-Id: I522596ccc526cdab14c516b9a566ff666ac57dd6
* | Remove silent ignore for skip_locked w/ unsupported backendsGord Thompson2020-09-151-1/+1
|/ | | | | | | | | | | | | | | | | | | | | For SQLAlchemy 1.4: The "skip_locked" keyword used with ``with_for_update()`` will render "SKIP LOCKED" on all MySQL backends, meaning it will fail for MySQL less than version 8 and on current MariaDB backends. This is because those backends do not support "SKIP LOCKED" or any equivalent, so this error should not be silently ignored. This is upgraded from a warning in the 1.3 series. For SQLAlchemy 1.3: The "skip_locked" keyword used with ``with_for_update()`` will emit a warning when used on MariaDB backends, and will then be ignored. This is a deprecated behavior that will raise in SQLAlchemy 1.4, as an application that requests "skip locked" is looking for a non-blocking operation which is not available on those backends. Fixes: #5578 Change-Id: I49ccb6c6ff46eafed12b77f51e1da8e0e397966c