summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* add --notimingintensive; block from github jobstiming_intensiveMike Bayer2020-10-061-2/+1
| | | | | | | | | | | | | | | | | | 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-055-52/+599
|\
| * Fetch first supportFederico Caselli2020-10-025-52/+599
| | | | | | | | | | | | | | | | | | 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
* | Enable pypy tests on github workflowFederico Caselli2020-10-024-1/+8
|/ | | | | Fixes: #5223 Change-Id: I0952e54ed9af2952ea340be1945311376ffc1ad2
* use execute_20 to preserve compiled cacheMike Bayer2020-10-021-0/+35
| | | | | Fixes: #5420 Change-Id: I3e5a255207da752b7b7cc9b8f41ad5e2ccd0b447
* raise on lower-case column shared to multiple tablesMike Bayer2020-09-301-1/+15
| | | | | | | | | | 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
* Merge "Support for multiple hosts in PostgreSQL connection string"mike bayer2020-09-301-0/+19
|\
| * Support for multiple hosts in PostgreSQL connection stringRamonWill2020-09-231-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-25/+92
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | bump variance on test_string, test_unicodeMike Bayer2020-09-291-2/+2
| | | | | | | | | | | | | | | | a recent rerun of profiles added more profiling data that's failing over small differences. 15% variance is fine for these tests that are looking for thousands of encode calls. Change-Id: I33dac346b2ff07f86b4bc278a7309ca9b7efbaab
* | Add reflection for Identity columnsFederico Caselli2020-09-287-17/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2886-409/+917
| | | | | | | | | | | | | | 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-285-34/+81
| | | | | | | | | | | | | | | | | | 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
* | build the full compilestate every timeMike Bayer2020-09-272-218/+420
| | | | | | | | | | | | | | | | | | | | 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
* | Accommodate for same base class multiple times in inherits listMike Bayer2020-09-271-0/+25
| | | | | | | | | | | | | | | | 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
* | Merge "Improve Asyncpg json handling"mike bayer2020-09-241-13/+79
|\ \ | |/ |/|
| * Improve Asyncpg json handlingFederico Caselli2020-09-231-13/+79
| | | | | | | | | | | | | | | | | | 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
* | Deprecate negative slice indexesMike Bayer2020-09-224-31/+162
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "restore slice methods to dynamic query"mike bayer2020-09-221-0/+11
|\ \
| * | restore slice methods to dynamic queryMike Bayer2020-09-211-0/+11
| |/ | | | | | | | | | | | | 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-215-30/+172
|/ | | | | | | | | | | | | | | | | | | | | | 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-3/+18
|\
| * Stringify correctly for non-str exception argumentAndrzej Bartosiński2020-09-201-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+16
|/ | | | | | | | | 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-445/+1787
|\
| * Complete deprecation of from_self()Mike Bayer2020-09-189-445/+1787
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-171-0/+20
|/ | | | | Fixes: #5592 Change-Id: I0688e5ea0fc6b01a0b72f397daea8f57a2ec0766
* Create a framework to allow all SQLALCHEMY_WARN_20 to passMike Bayer2020-09-1631-997/+1322
| | | | | | | | | | | | | | | | | | | | | 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
* Merge "Fix ORM gc-related test that seems to be failing on CI"mike bayer2020-09-161-2/+4
|\
| * Fix ORM gc-related test that seems to be failing on CIMike Bayer2020-09-161-2/+4
| | | | | | | | | | | | | | The test relied on the primary key value not being of a certain number. Change-Id: I9bd76bee542da44b630a426f1102fc682ad2d7b3
* | Merge "Make :class:`_orm.registry` ``bind`` a private parameter."mike bayer2020-09-161-0/+30
|\ \ | |/ |/|
| * Make :class:`_orm.registry` ``bind`` a private parameter.Federico Caselli2020-09-151-0/+30
| | | | | | | | | | | | | | | | | | 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-35/+39
|\ \
| * | Correct for SQL Server temp table ownerMike Bayer2020-09-151-35/+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-152-11/+35
|/ | | | | | | | | | | | | | | | | | | | | 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
* Merge "Rename Core expression isnot, not_in_"mike bayer2020-09-143-10/+83
|\
| * Rename Core expression isnot, not_in_jonathan vanasco2020-09-143-10/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several operators are renamed to achieve more consistent naming across SQLAlchemy. The operator changes are: * `isnot` is now `is_not` * `not_in_` is now `not_in` Because these are core operators, the internal migration strategy for this change is to support legacy terms for an extended period of time -- if not indefinitely -- but update all documentation, tutorials, and internal usage to the new terms. The new terms are used to define the functions, and the legacy terms have been deprecated into aliases of the new terms. Fixes: #5429 Change-Id: Ia1e66e7a50ac35d3f6260d8bf6ba3ce8087cbad2
* | Merge "Pass all pool parameters in recreate()"mike bayer2020-09-141-1/+56
|\ \ | |/ |/|
| * Pass all pool parameters in recreate()Mike Bayer2020-09-141-1/+56
| | | | | | | | | | | | | | | | | | | | | | The following pool parameters were not being propagated to the new pool created when :meth:`_engine.Engine.dispose` were called: ``pre_ping``, ``use_lifo``. Additionally the ``recycle`` and ``reset_on_return`` parameters were not propagated for the :class:`_engine.AssertionPool` class. These issues have been fixed. Fixes: #5582 Change-Id: Ifdb703aa7e849652242b9ff8071c854cd1d77e71
* | Adapt event exec_once_mutex to asyncioMike Bayer2020-09-141-0/+6
|/ | | | | | | | | The pool makes use of a threading.Lock() for the "first_connect" event. if the pool is async make sure this is a greenlet-adapted asyncio lock. Fixes: #5581 Change-Id: If52415839c7ed82135465f1fe93b95d86c305820
* Deprecate engine-wise ss cursors; repair mariadbconnectorMike Bayer2020-09-133-8/+36
| | | | | | | | | | | | | | | | | | | The server_side_cursors engine-wide feature relies upon regexp parsing of statements a well as general guessing as to when the feature should be used. This is not within the 2.0 way of doing things and should be removed. Additionally, mariadbconnector defaults to unbuffered cursors; add new cursor hooks so that mariadbconnector can specify buffered or unbuffered cursors without too much difficulty. This will also correctly default mariadbconnector to buffered cursors which should repair the segfaults we've been getting. Try to restore the assert_raises that was removed in 5b6dfc0c38bf1f01da4b8 to see if mariadbconnector segfaults are resolved. Change-Id: I77f1c972c742e40694972f578140bb0cac8c39eb
* Merge "Improve handling of covering indexes"mike bayer2020-09-123-45/+104
|\
| * Improve handling of covering indexesGord Thompson2020-09-123-45/+104
| | | | | | | | | | | | | | | | | | | | Improved support for covering indexes (with INCLUDE columns). Added the ability for postgresql to render CREATE INDEX statements with an INCLUDE clause from Core. Index reflection also report INCLUDE columns separately for both mssql and postgresql (11+). Fixes: #4458 Change-Id: If0b82103fbc898cdaeaf6a6d2d421c732744acd6
* | Merge "Raname ``mustexit`` to ``must_exist``"mike bayer2020-09-123-1/+17
|\ \
| * | Raname ``mustexit`` to ``must_exist``Federico Caselli2020-09-033-1/+17
| | | | | | | | | | | | | | | | | | | | | :class:`_schema.Table` parameter ``mustexist`` has been renamed to :paramref:`_schema.Table.must_exist` and will now warn when used. Change-Id: I0b0ca6021f9f7cfbe2040bbc1125a2236ac79f53
* | | Merge "Do not specify type on mssql by default"mike bayer2020-09-126-25/+12
|\ \ \
| * | | Do not specify type on mssql by defaultFederico Caselli2020-09-126-25/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make optional sequences render as identity in mssql Remove unused dialect option sequence_default_column_type Change-Id: I821eeffcb442f8d1b69186a9b798b15c3d8d6ff3
* | | | Merge "Reflect mssql/postgresql filtered/partial indexes"mike bayer2020-09-124-3/+96
|\ \ \ \
| * | | | Reflect mssql/postgresql filtered/partial indexesRamonWill2020-09-124-3/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for inspection / reflection of partial indexes / filtered indexes, i.e. those which use the ``mssql_where`` or ``postgresql_where`` parameters, with :class:`_schema.Index`. The entry is both part of the dictionary returned by :meth:`.Inspector.get_indexes` as well as part of a reflected :class:`_schema.Index` construct that was reflected. Pull request courtesy Ramon Williams. **Have a nice day!** Fixes: #4966 Closes: #5504 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5504 Pull-request-sha: b3018bac987081193b2e65cfdb6aeb7d5d270fcd Change-Id: Icbb2f93d1545700718ccb5222097185b815f5dbc
* | | | | Merge "Emit deprecation warning for **kw passed to session.execute()"mike bayer2020-09-122-5/+42
|\ \ \ \ \