summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/requirements.py
Commit message (Collapse)AuthorAgeFilesLines
* Add test requirement: indexes_with_ascdescGord Thompson2020-01-231-0/+5
| | | | | | | | | | | | | There are some tests for indexes that include DESC in the columns. Firebird and maybe others don't support this concept, so put it under a requirement rule. Fixes: #5106 Closes: #5108 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5108 Pull-request-sha: 4b1560f28a52feb7d4a6c5d828f587a735d6a40b Change-Id: I4744246005f3af263ea1e028d8a46795b87de62c
* Remove jython code, remove all jython / pypy symbolsMike Bayer2020-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | Removed all dialect code related to support for Jython and zxJDBC. Jython has not been supported by SQLAlchemy for many years and it is not expected that the current zxJDBC code is at all functional; for the moment it just takes up space and adds confusion by showing up in documentation. At the moment, it appears that Jython has achieved Python 2.7 support in its releases but not Python 3. If Jython were to be supported again, the form it should take is against the Python 3 version of Jython, and the various zxJDBC stubs for various backends should be implemented as a third party dialect. Additionally modernized logic that distinguishes between "cpython" and "pypy" to instead look at platform.python_distribution() which reliably tells us if we are cPython or not; all booleans which previously checked for pypy and sometimes jython are now converted to be "not cpython", this impacts the test suite for tests that are cPython centric. Fixes: #5094 Change-Id: I226cb55827f997daf6b4f4a755c18e7f4eb8d9ad
* happy new yearMike Bayer2020-01-011-1/+1
| | | | Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235
* Add sequence support for MariaDB 10.3+.Gord Thompson2019-11-261-0/+25
| | | | | | | | | | | | | | | | | | | | Added support for use of the :class:`.Sequence` construct with MariaDB 10.3 and greater, as this is now supported by this database. The construct integrates with the :class:`.Table` object in the same way that it does for other databases like PostrgreSQL and Oracle; if is present on the integer primary key "autoincrement" column, it is used to generate defaults. For backwards compatibility, to support a :class:`.Table` that has a :class:`.Sequence` on it to support sequence only databases like Oracle, while still not having the sequence fire off for MariaDB, the optional=True flag should be set, which indicates the sequence should only be used to generate the primary key if the target database offers no other option. Fixes: #4976 Closes: #4996 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4996 Pull-request-sha: cb2e1426ea0b6bc6c93dbe8f033a11df9d8c4915 Change-Id: I507bc405eee6cae2c5991345d0eac53a37fe7512
* Add type accessors for JSON indexed/pathed element accessMike Bayer2019-11-111-0/+4
| | | | | | | | | | | | | | | Added new accessors to expressions of type :class:`.JSON` to allow for specific datatype access and comparison, covering strings, integers, numeric, boolean elements. This revises the documented approach of CASTing to string when comparing values, instead adding specific functionality into the PostgreSQL, SQlite, MySQL dialects to reliably deliver these basic types in all cases. The change also delivers a new feature to the test exclusions system so that combinations and exclusions can be used together. Fixes: #4276 Change-Id: Ica5a926c060feb40a0a7cd60b9d6e061d7825728
* Support for generated columnsCaselIT2019-11-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Added DDL support for "computed columns"; these are DDL column specifications for columns that have a server-computed value, either upon SELECT (known as "virtual") or at the point of which they are INSERTed or UPDATEd (known as "stored"). Support is established for Postgresql, MySQL, Oracle SQL Server and Firebird. Thanks to Federico Caselli for lots of work on this one. ORM round trip tests included. The ORM makes use of existing FetchedValue support and no additional ORM logic is present for the basic feature. It has been observed that Oracle RETURNING does not return the new value of a computed column upon UPDATE; it returns the prior value. As this is very dangerous, a warning is emitted if a computed column is rendered into the RETURNING clause of an UPDATE statement. Fixes: #4894 Closes: #4928 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4928 Pull-request-sha: d39c521d5ac6ebfb4fb5b53846451de79752e64c Change-Id: I2610b2999a5b1b127ed927dcdaeee98b769643ce
* Disallow memory tests from running on WindowsMike Bayer2019-10-241-0/+11
| | | | | | | | | | These tests fail with multiprocess errors involving pickling of the profile file. The memory tests are not critical for windows development nor are the profiling tests overall as they are against platform independent measurements. Fixes: #4946 Change-Id: Iaeb3958e59ce7709ba6af3cf9d7baf2a4922bb9b
* call setinputsizes for cx_Oracle.DATETIMEMike Bayer2019-10-031-0/+8
| | | | | | | | | | | | | | | | | Restored adding cx_Oracle.DATETIME to the setinputsizes() call when a SQLAlchemy :class:`.Date`, :class:`.DateTime` or :class:`.Time` datatype is used, so that in the case where a bound parameter is passed as NULL in some complex queries (in particular this happens with some lazy load situations), the type is still present. This was removed in the 1.2 series for arbitrary reasons. Also adds a suite test for this generic situation. What's not clear is that do we really need setinputsizes() for all datatypes if we are supporting NULL in bound parameters. Fixes: #4886 Change-Id: If99215c31861f9ea6f60a30d47f2f320adc4797f
* Add req for nullable booleansMike Bayer2019-09-181-0/+6
| | | | | | | Access doesn't allow for Yes/No columns to store null, so add a rule for this. Change-Id: If9316cd05733e39fbd59a6f54024f6740b563041
* Add missing suite_level requirements "independent_connections"Mike Bayer2019-09-181-0/+7
| | | | | | | | In 14b1e6fe8e18d139846c1aba6761d4eea3dc25c3 we added suite-level requirements but did not add them to the base, causing failures in third party dialect test suites. Change-Id: I7edf0be86b814b508071c5c752fc2dd744a3d9ad
* Add missing suite level requirements from 2efd89d02941Mike Bayer2019-09-171-0/+10
| | | | | | | | In 2efd89d02941ab4267d6e2842963fd38b1539f6c we added suite-level requirements but did not add them to the base, causing failures in third party dialect test suites. Change-Id: Ic5f1a053f5c47166e1b12c613595823106c8736e
* Add missing suite level requirements from #4234Mike Bayer2019-09-171-0/+17
| | | | | | | | | In 9d5e117f6fcc38d8773bc943c615888dc8a3a819 we added suite-level requirements but did not add them to the base, causing failures in third party dialect test suites. Change-Id: I030b5d0fd957814dfce77a71b59babd9b5e3b1bc References: #4234
* Render LIMIT/OFFSET conditions after compile on select dialectsMike Bayer2019-08-301-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new "post compile parameters" feature. This feature allows a :func:`.bindparam` construct to have its value rendered into the SQL string before being passed to the DBAPI driver, but after the compilation step, using the "literal render" feature of the compiler. The immediate rationale for this feature is to support LIMIT/OFFSET schemes that don't work or perform well as bound parameters handled by the database driver, while still allowing for SQLAlchemy SQL constructs to be cacheable in their compiled form. The immediate targets for the new feature are the "TOP N" clause used by SQL Server (and Sybase) which does not support a bound parameter, as well as the "ROWNUM" and optional "FIRST_ROWS()" schemes used by the Oracle dialect, the former of which has been known to perform better without bound parameters and the latter of which does not support a bound parameter. The feature builds upon the mechanisms first developed to support "expanding" parameters for IN expressions. As part of this feature, the Oracle ``use_binds_for_limits`` feature is turned on unconditionally and this flag is now deprecated. - adds limited support for "unique" bound parameters within a text() construct. - adds an additional int() check within the literal render function of the Integer datatype and tests that non-int values raise ValueError. Fixes: #4808 Change-Id: Iace97d544d1a7351ee07db970c6bc06a19c712c6
* Use ternary when running conditional with Query._offsetMike Bayer2019-08-111-0/+9
| | | | | | | | | | Fixed bug where using :meth:`.Query.first` or a slice expression in conjunction with a query that has an expression based "offset" applied would raise TypeError, due to an "or" conditional against "offset" that did not expect it to be a SQL expression as opposed to an integer or None. Fixes: #4803 Change-Id: I56b97a5d23cb45427a27a90ab557fa1ac5c6739e
* Reflect "NO ACTION" as None; support "RESTRICT"Mike Bayer2019-06-261-0/+12
| | | | | | | | | | | | | | The "NO ACTION" keyword for foreign key "ON UPDATE" is now considered to be the default cascade for a foreign key on all supporting backends (SQlite, MySQL, PostgreSQL) and when detected is not included in the reflection dictionary; this is already the behavior for PostgreSQL and MySQL for all previous SQLAlchemy versions in any case. The "RESTRICT" keyword is positively stored when detected; PostgreSQL does report on this keyword, and MySQL as of version 8.0 does as well. On earlier MySQL versions, it is not reported by the database. Fixes: #4741 Change-Id: I6becf1f2450605c1991158bb8a04d954dcc7396c
* Render N'' for SQL Server unicode literalsMike Bayer2019-01-151-0/+7
| | | | | | | | | | | | | | | | | | The ``literal_processor`` for the :class:`.Unicode` and :class:`.UnicodeText` datatypes now render an ``N`` character in front of the literal string expression as required by SQL Server for Unicode string values rendered in SQL expressions. Note that this adds full unicode characters to the standard test suite, which means we also need to bump MySQL provisioning up to utf8mb4. Modern installs do not seem to be reproducing the 1271 issue locally, if it reproduces in CI it would be better for us to skip those ORM-centric tests for MySQL. Also remove unused _StringType from SQL Server dialect Fixes: #4442 Change-Id: Id55817b3e8a2d81ddc8b7b27f85e3f1dcc1cea7e
* happy new yearMike Bayer2019-01-111-1/+1
| | | | Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
* Skip expression-based index reflection for SQLiteMike Bayer2019-01-091-0/+5
| | | | | | | | | | | Reflection of an index based on SQL expressions are now skipped with a warning, in the same way as that of the Postgresql dialect, where we currently do not support reflecting indexes that have SQL expressions within them. Previously, an index with columns of None were produced which would break tools like Alembic. Fixes: #4431 Change-Id: I1363ade912d206b42669331e2be2bb6f444b65a2
* Post black reformattingMike Bayer2019-01-061-7/+10
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-061-36/+42
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* MariaDB 10.3 updatesMike Bayer2018-08-301-2/+2
| | | | | | | | | MariaDB seems to handle some additional UPDATE/DELETE FROM syntaxes as well as some forms of INTERSECT and EXCEPT. Open up tests that expect failure for MySQL to allow success for MariaDB 10.3. Change-Id: Ia9341a82485ef7201bb8130d8dbf4a9b6976035a
* Add test support for #4036Mike Bayer2018-08-161-0/+21
| | | | | | | Add a test that asserts MySQL can't implicitly treat a decimal bound parameter without context and everyone else can. Change-Id: I40e24a463d6eb03fd677195895891e73624776c3
* render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQLMike Bayer2018-06-181-1/+10
| | | | | | | | | | | | | | | | Fixed INSERT FROM SELECT with CTEs for the Oracle and MySQL dialects, where the CTE was being placed above the entire statement as is typical with other databases, however Oracle and MariaDB 10.2 wants the CTE underneath the "INSERT" segment. Note that the Oracle and MySQL dialects don't yet work when a CTE is applied to a subquery inside of an UPDATE or DELETE statement, as the CTE is still applied to the top rather than inside the subquery. Also adds test suite support CTEs against backends. Change-Id: I8ac337104d5c546dd4f0cd305632ffb56ac8bf90 Fixes: #4275 Fixes: #4230
* Support foreign key option reflection for OracleMiroslav Shubernetskiy2018-02-051-1/+5
| | | | | | | | | The ON DELETE options for foreign keys are now part of Oracle reflection. Oracle does not support ON UPDATE cascades. Pull request courtesy Miroslav Shubernetskiy. Change-Id: I135cd6cd3436354a86b2c1e1437c3785c38eed26 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/418
* Merge "Make column-level collation quoting dialect-specific"mike bayer2018-01-121-0/+14
|\
| * Make column-level collation quoting dialect-specificMike Bayer2018-01-121-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression in 1.2 where newly repaired quoting of collation names in :ticket:`3785` breaks SQL Server, which explicitly does not understand a quoted collation name. Whether or not mixed-case collation names are quoted or not is now deferred down to a dialect-level decision so that each dialect can prepare these identifiers directly. Change-Id: Iaf0a8123d9bf4711219e320896bb28c5d2649304 Fixes: #4154
* | happy new yearMike Bayer2018-01-121-1/+1
| | | | | | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* | Re-enable setinputsizes for Oracle TIMESTAMPMike Bayer2018-01-081-0/+7
|/ | | | | | | | | Fixed regression where the removal of most setinputsizes rules from cx_Oracle dialect impacted the TIMESTAMP datatype's ability to retrieve fractional seconds. Fixes: #4157 Change-Id: Ic53109fd199aea8b9c4da14355e125849b8b198f
* Add rule to prevent "GROUP BY <expr>" in testsMike Bayer2018-01-041-0/+11
| | | | | | | | Added a new exclusion rule group_by_complex_expression which disables tests that use "GROUP BY <expr>", which seems to be not viable for at least two third party dialects. Change-Id: I47284513382ae93f5a3d12c734b3a44643147c99
* Allow delete where clause to refer multiple tables.inytar2017-12-051-0/+5
| | | | | | | | | | | | | | | | | | | | | Implemented "DELETE..FROM" syntax for Postgresql, MySQL, MS SQL Server (as well as within the unsupported Sybase dialect) in a manner similar to how "UPDATE..FROM" works. A DELETE statement that refers to more than one table will switch into "multi-table" mode and render the appropriate "USING" or multi-table "FROM" clause as understood by the database. Pull request courtesy Pieter Mulder. For SQL syntaxes see: Postgresql: https://www.postgresql.org/docs/current/static/sql-delete.html MySQL: https://dev.mysql.com/doc/refman/5.7/en/delete.html#multiple-table_syntax MSSQL: https://docs.microsoft.com/en-us/sql/t-sql/statements/delete-transact-sql Sybase: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00801.1510/html/iqrefso/X315721.htm Co-authored by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: I6dfd57b49e44a095d076dc493cd2360bb5d920d3 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/392 Fixes: #959
* Take schema name into account when querying sqlite_masterMike Bayer2017-09-281-0/+5
| | | | | | | | | | | Fixed bug where SQLite CHECK constraint reflection would fail if the referenced table were in a remote schema, e.g. on SQLite a remote database referred to by ATTACH. Also add suite support for general CHECK constraint reflection. Change-Id: I073a72cb47dc4f8c5683000d708768523759332f Fixes: #4099
* Add SQL Server CI coverageMike Bayer2017-08-311-0/+29
| | | | Change-Id: Ida0d01ae9bcc0573b86e24fddea620a38c962822
* Add new sane_rowcount_w_returning flagMike Bayer2017-08-311-0/+23
| | | | | | | | | | | | | | | | | Added a new class of "rowcount support" for dialects that is specific to when "RETURNING", which on SQL Server looks like "OUTPUT inserted", is in use, as the PyODBC backend isn't able to give us rowcount on an UPDATE or DELETE statement when OUTPUT is in effect. This primarily affects the ORM when a flush is updating a row that contains server-calcluated values, raising an error if the backend does not return the expected row count. PyODBC now states that it supports rowcount except if OUTPUT.inserted is present, which is taken into account by the ORM during a flush as to whether it will look for a rowcount. ORM tests are implicit in existing tests run against PyODBC Fixes: #4062 Change-Id: Iff17cbe4c7a5742971ed85a4d58660c18cc569c2
* Generalize autocommit testingMike Bayer2017-08-291-0/+5
| | | | | | | To support adding AUTOCOMMIT to more dialects, add a suite test Change-Id: I585dcce19fcdce70e8cf21aea4edaa97d7bf2bb9
* Add new "expanding" feature to bindparam()Mike Bayer2017-04-071-0/+8
| | | | | | | | | | | | | | | | Added a new kind of :func:`.bindparam` called "expanding". This is for use in ``IN`` expressions where the list of elements is rendered into individual bound parameters at statement execution time, rather than at statement compilation time. This allows both a single bound parameter name to be linked to an IN expression of multiple elements, as well as allows query caching to be used with IN expressions. The new feature allows the related features of "select in" loading and "polymorphic in" loading to make use of the baked query extension to reduce call overhead. This feature should be considered to be **experimental** for 1.2. Fixes: #3953 Change-Id: Ie708414a3ab9c0af29998a2c7f239ff7633b1f6e
* Implement comments for tables, columnsFrazer McLean2017-03-171-0/+4
| | | | | | | | | | | | | | Added support for SQL comments on :class:`.Table` and :class:`.Column` objects, via the new :paramref:`.Table.comment` and :paramref:`.Column.comment` arguments. The comments are included as part of DDL on table creation, either inline or via an appropriate ALTER statement, and are also reflected back within table reflection, as well as via the :class:`.Inspector`. Supported backends currently include MySQL, Postgresql, and Oracle. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #1546 Change-Id: Ib90683850805a2b4ee198e420dc294f32f15d35d
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Add support for server side cursors to mysqldb and pymysqlRoman Podoliaka2016-11-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows to skip buffering of the results on the client side, e.g. the following snippet: table = sa.Table( 'testtbl', sa.MetaData(), sa.Column('id', sa.Integer, primary_key=True), sa.Column('a', sa.Integer), sa.Column('b', sa.String(512)) ) table.create(eng, checkfirst=True) with eng.connect() as conn: result = conn.execute(table.select().limit(1)).fetchone() if result is None: for _ in range(1000): conn.execute( table.insert(), [{'a': random.randint(1, 100000), 'b': ''.join(random.choice(string.ascii_letters) for _ in range(100))} for _ in range(1000)] ) with eng.connect() as conn: for row in conn.execution_options(stream_results=True).execute(table.select()): pass now uses ~23 MB of memory instead of ~327 MB on CPython 3.5.2 and PyMySQL 0.7.9. psycopg2 implementation and execution options (stream_results, server_side_cursors) are reused. Change-Id: I4dc23ce3094f027bdff51b896b050361991c62e2
* spelling: Postgresql -> PostgreSQLVille Skyttä2016-10-081-2/+2
|
* Additions to support HAAlchemy pluginMike Bayer2016-09-161-0/+40
| | | | | | | | | | | | | | | | | | | - add a connect=True key to connection record to support pre-loading of _ConnectionRecord objects - ensure _ConnectionRecord.close() leaves the record in a good state for reopening - add _ConnectionRecord.record_info for persistent storage - add "in_use" accessor based on fairy_ref being present or not - allow for the exclusions system and SuiteRequirements to be usable without the full plugin_base setup. - move some Python-env requirements to the importable requirements.py module. - allow starttime to be queried - add additional events for engine plugins - have "dialect" be a first-class parameter to the pool, ensure the engine strategy supplies it up front Change-Id: Ibf549f7a1766e49d335cd6f5e26bacfaef9a8229
* Ensure 'options' is always present in foreign key infoMike Bayer2016-06-031-0/+4
| | | | | | | | | Regarding 0e88bcc30ed49193b91f248123f526fa30007f22, "options" needs to be present as a key in the dictionary because Alembic uses this as a guide to know if the backend is even capable of reporting on foreign key options. Change-Id: I271090f75088cfeec24315a878060f9b8a265335
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - pg8000 fixes for jsonMike Bayer2016-01-071-0/+7
|
* - Added :class:`.mysql.JSON` for MySQL 5.7. The JSON type providesMike Bayer2016-01-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | persistence of JSON values in MySQL as well as basic operator support of "getitem" and "getpath", making use of the ``JSON_EXTRACT`` function in order to refer to individual paths in a JSON structure. fixes #3547 - Added a new type to core :class:`.types.JSON`. This is the base of the PostgreSQL :class:`.postgresql.JSON` type as well as that of the new :class:`.mysql.JSON` type, so that a PG/MySQL-agnostic JSON column may be used. The type features basic index and path searching support. fixes #3619 - reorganization of migration docs etc. to try to refer both to the fixes to JSON that helps Postgresql while at the same time indicating these are new features of the new base JSON type. - a rework of the Array/Indexable system some more, moving things that are specific to Array out of Indexable. - new operators for JSON indexing added to core so that these can be compiled by the PG and MySQL dialects individually - rename sqltypes.Array to sqltypes.ARRAY - as there is no generic Array implementation, this is an uppercase type for now, consistent with the new sqltypes.JSON type that is also not a generic implementation. There may need to be some convention change to handle the case of datatypes that aren't generic, rely upon DB-native implementations, but aren't necessarily all named the same thing.
* - make these failure cases more specific to catch Oracle.Mike Bayer2015-08-151-2/+17
| | | | Would be nice to fix Oracle here
* - The behavior of the :func:`.union` construct and related constructsMike Bayer2015-08-121-0/+11
| | | | | | | | | such as :meth:`.Query.union` now handle the case where the embedded SELECT statements need to be parenthesized due to the fact that they include LIMIT, OFFSET and/or ORDER BY. These queries **do not work on SQLite**, and will fail on that backend as they did before, but should now work on all other backends. fixes #2528
* - pg8000 wants to raise a ProgrammingError for a PK violationMike Bayer2015-05-151-0/+8
|
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - enhance only_on() to work with compound specsMike Bayer2014-12-061-0/+5
| | | | - fix "temporary_tables" requirement
* - Added :meth:`.Inspector.get_temp_table_names` andMike Bayer2014-09-171-0/+14
| | | | | | | | | | | | :meth:`.Inspector.get_temp_view_names`; currently, only the SQLite dialect supports these methods. The return of temporary table and view names has been **removed** from SQLite's version of :meth:`.Inspector.get_table_names` and :meth:`.Inspector.get_view_names`; other database backends cannot support this information (such as MySQL), and the scope of operation is different in that the tables can be local to a session and typically aren't supported in remote schemas. fixes #3204