class SuiteRequirements(Requirements):
Undocumented
Method | _has_mysql_fully_case_sensitive |
Undocumented |
Method | _has_mysql_on_windows |
Undocumented |
Method | _has_sqlite |
Undocumented |
Method | _running_on_windows |
Undocumented |
Method | get_isolation_levels |
Return a structure of supported isolation levels for the current testing dialect. |
Method | get_order_by_collation |
Undocumented |
Property | ad_hoc_engines |
Test environment must allow ad-hoc engine/connection creation. |
Property | async_dialect |
dialect makes use of await_() to invoke operations on the DBAPI. |
Property | autocommit |
target dialect supports 'AUTOCOMMIT' as an isolation_level |
Property | autoincrement_insert |
target platform generates new surrogate integer primary key values when insert() is executed, excluding the pk column. |
Property | autoincrement_without_sequence |
If autoincrement=True on a column does not require an explicit sequence. This should be false only for oracle. |
Property | binary_comparisons |
target database/driver can allow BLOB/BINARY fields to be compared against a bound parameter value. |
Property | binary_literals |
target backend supports simple binary literals, e.g. an expression like: |
Property | boolean_col_expressions |
Target database must support boolean expressions as columns |
Property | bound_limit_offset |
target database can render LIMIT and/or OFFSET using a bound parameter |
Property | cast_precision_numerics_many_significant_digits |
same as precision_numerics_many_significant_digits but within the context of a CAST statement (hello MySQL) |
Property | cextensions |
Undocumented |
Property | check_constraint_reflection |
target dialect supports reflection of check constraints |
Property | comment_reflection |
Undocumented |
Property | computed_columns |
Supports computed columns |
Property | computed_columns_default_persisted |
If the default persistence is virtual or stored when persisted is omitted |
Property | computed_columns_reflect_persisted |
If persistence information is returned by the reflection of computed columns |
Property | computed_columns_stored |
Supports computed columns with persisted=True |
Property | computed_columns_virtual |
Supports computed columns with persisted=False |
Property | cpython |
Undocumented |
Property | create_table |
target platform can emit basic CreateTable DDL. |
Property | cross_schema_fk_reflection |
target system must support reflection of inter-schema foreign keys |
Property | ctes |
Target database supports CTEs |
Property | ctes_on_dml |
target database supports CTES which consist of INSERT, UPDATE or DELETE within the CTE, e.g. WITH x AS (UPDATE....) |
Property | ctes_with_update_delete |
target database supports CTES that ride on top of a normal UPDATE or DELETE statement which refers to the CTE in a correlated subquery. |
Property | dataclasses |
Undocumented |
Property | date |
target dialect supports representation of Python datetime.date() objects. |
Property | date_coerces_from_datetime |
target dialect accepts a datetime object as the target of a date column. |
Property | date_historic |
target dialect supports representation of Python datetime.datetime() objects with historic (pre 1970) values. |
Property | datetime |
target dialect supports representation of Python datetime.datetime() objects. |
Property | datetime_historic |
target dialect supports representation of Python datetime.datetime() objects with historic (pre 1970) values. |
Property | datetime_implicit_bound |
target dialect when given a datetime object will bind it such that the database server knows the object is a datetime, and not a plain string. |
Property | datetime_literals |
target dialect supports rendering of a date, time, or datetime as a literal string, e.g. via the TypeEngine.literal_processor() method. |
Property | datetime_microseconds |
target dialect supports representation of Python datetime.datetime() with microsecond objects. |
Property | datetime_timezone |
target dialect supports representation of Python datetime.datetime() with tzinfo with DateTime(timezone=True). |
Property | dbapi_lastrowid |
target platform includes a 'lastrowid' accessor on the DBAPI cursor object. |
Property | default_schema_name_switch |
target dialect implements provisioning module including set_default_schema_on_connection |
Property | deferrable_fks |
Undocumented |
Property | delete_from |
Target must support DELETE FROM..FROM or DELETE..USING syntax |
Property | denormalized_names |
Target database must have 'denormalized', i.e. UPPERCASE as case insensitive names. |
Property | drop_table |
target platform can emit basic DropTable DDL. |
Property | duplicate_key_raises_integrity_error |
target dialect raises IntegrityError when reporting an INSERT with a primary key violation. (hint: it should) |
Property | duplicate_names_in_cursor_description |
target platform supports a SELECT statement that has the same name repeated more than once in the columns list. |
Property | empty_inserts |
target platform supports INSERT with no values, i.e. INSERT DEFAULT VALUES or equivalent. |
Property | empty_inserts_executemany |
target platform supports INSERT with no values, i.e. INSERT DEFAULT VALUES or equivalent, within executemany() |
Property | empty_strings_text |
target database can persist/return an empty string with an unbounded text. |
Property | empty_strings_varchar |
target database can persist/return an empty string with a varchar. |
Property | emulated_lastrowid |
target dialect retrieves cursor.lastrowid, or fetches from a database-side function after an insert() construct executes, within the get_lastrowid() method. |
Property | emulated_lastrowid_even_with_sequences |
target dialect retrieves cursor.lastrowid or an equivalent after an insert() construct executes, even if the table has a Sequence on it. |
Property | except_ |
Target database must support EXCEPT or equivalent (i.e. MINUS). |
Property | expressions_against_unbounded_text |
target database supports use of an unbounded textual field in a WHERE clause. |
Property | fetch_expression |
backend supports fetch / offset with expression in them, like |
Property | fetch_first |
backend supports the fetch first clause. |
Property | fetch_no_order_by |
backend supports the fetch first without order by |
Property | fetch_null_from_numeric |
target backend doesn't crash when you try to select a NUMERIC value that has a value of NULL. |
Property | fetch_offset_with_options |
backend supports the offset when using fetch first with percent or ties. basically this is "not mssql" |
Property | fetch_percent |
backend supports the fetch first clause with percent. |
Property | fetch_rows_post_commit |
target platform will allow cursor.fetchone() to proceed after a COMMIT. |
Property | fetch_ties |
backend supports the fetch first clause with ties. |
Property | fk_constraint_option_reflection_ondelete_noaction |
Undocumented |
Property | fk_constraint_option_reflection_ondelete_restrict |
Undocumented |
Property | fk_constraint_option_reflection_onupdate_restrict |
Undocumented |
Property | floats_to_four_decimals |
target backend can return a floating-point number with four significant digits (such as 15.7563) accurately (i.e. without FP inaccuracies, such as 15.75629997253418). |
Property | foreign_key_constraint_name_reflection |
Target supports refleciton of FOREIGN KEY constraints and will return the name of the constraint that was used in the "CONSTRAINT <name> FOREIGN KEY" DDL. |
Property | foreign_key_constraint_option_reflection_ondelete |
Undocumented |
Property | foreign_key_constraint_option_reflection_onupdate |
Undocumented |
Property | foreign_key_constraint_reflection |
Undocumented |
Property | foreign_key_ddl |
Target database must support the DDL phrases for FOREIGN KEY. |
Property | foreign_keys |
Target database must support foreign keys. |
Property | full_returning |
target platform supports RETURNING completely, including multiple rows returned. |
Property | generic_classes |
If X[Y] can be implemented with __class_getitem__. py3.7+ |
Property | graceful_disconnects |
Target driver must raise a DBAPI-level exception, such as InterfaceError, when the underlying connection has been closed and the execute() method is called. |
Property | greenlet |
Undocumented |
Property | group_by_complex_expression |
target platform supports SQL expressions in GROUP BY |
Property | identity_columns |
If a backend supports GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY |
Property | identity_columns_standard |
If a backend supports GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY with a standard syntax. This is mainly to exclude MSSql. |
Property | implements_get_lastrowid |
target dialect implements the executioncontext.get_lastrowid() method without reliance on RETURNING. |
Property | implicit_decimal_binds |
target backend will return a selected Decimal as a Decimal, not a string. |
Property | implicit_default_schema |
target system has a strong concept of 'default' schema that can be referred to implicitly. |
Property | implicitly_named_constraints |
target database must apply names to unnamed constraints. |
Property | independent_connections |
Target must support simultaneous, independent database connections. |
Property | index_ddl_if_exists |
target platform supports IF NOT EXISTS / IF EXISTS for indexes. |
Property | index_reflection |
Undocumented |
Property | index_reflects_included_columns |
Undocumented |
Property | indexes_with_ascdesc |
target database supports CREATE INDEX with per-column ASC/DESC. |
Property | indexes_with_expressions |
target database supports CREATE INDEX against SQL expressions. |
Property | infinity_floats |
The Float type can persist and load float('inf'), float('-inf'). |
Property | insert_executemany_returning |
target platform supports RETURNING when INSERT is used with executemany(), e.g. multiple parameter sets, indicating as many rows come back as do parameter sets were passed. |
Property | insert_from_select |
target platform supports INSERT from a SELECT. |
Property | insert_order_dicts |
Undocumented |
Property | intersect |
Target database must support INTERSECT or equivalent. |
Property | isolation_level |
target dialect supports general isolation level settings. |
Property | json_array_indexes |
target platform supports numeric array indexes within a JSON structure |
Property | json_index_supplementary_unicode_element |
Undocumented |
Property | json_type |
target platform implements a native JSON type. |
Property | legacy_unconditional_json_extract |
Backend has a JSON_EXTRACT or similar function that returns a valid JSON string in all cases. |
Property | memory_intensive |
Undocumented |
Property | mod_operator_as_percent_sign |
target database must use a plain percent '%' as the 'modulus' operator. |
Property | multivalues_inserts |
target database must support multiple VALUES clauses in an INSERT statement. |
Property | named_constraints |
target database must support names for constraints. |
Property | nested_aggregates |
target database can select an aggregate from a subquery that's also using an aggregate |
Property | no_coverage |
Test should be skipped if coverage is enabled. |
Property | no_lastrowid_support |
the opposite of supports_lastrowid |
Property | no_sequences |
the opposite of "sequences", DB does not support sequences at all. |
Property | no_windows |
Undocumented |
Property | non_broken_pickle |
Undocumented |
Property | non_updating_cascade |
target database must not support ON UPDATE..CASCADE behavior in foreign keys. |
Property | nullable_booleans |
Target database allows boolean columns to store NULL. |
Property | nullsordering |
Target backends that support nulls ordering. |
Property | offset |
target database can render OFFSET, or an equivalent, in a SELECT. |
Property | on_update_cascade |
target database must support ON UPDATE..CASCADE behavior in foreign keys. |
Property | on_update_or_deferrable_fks |
Undocumented |
Property | order_by_col_from_union |
target database supports ordering by a column from a SELECT inside of a UNION |
Property | order_by_collation |
Undocumented |
Property | order_by_label_with_expression |
target backend supports ORDER BY a column label within an expression. |
Property | parens_in_union_contained_select_w_limit_offset |
Target database must support parenthesized SELECT in UNION when LIMIT/OFFSET is specifically present. |
Property | parens_in_union_contained_select_wo_limit_offset |
Target database must support parenthesized SELECT in UNION when OFFSET/LIMIT is specifically not present. |
Property | patch_library |
Undocumented |
Property | pep520 |
Undocumented |
Property | percent_schema_names |
target backend supports weird identifiers with percent signs in them, e.g. 'some % column'. |
Property | precision_generic_float_type |
target backend will return native floating point numbers with at least seven decimal places when using the generic Float type. |
Property | precision_numerics_enotation_large |
target backend supports Decimal() objects using E notation to represent very large values. |
Property | precision_numerics_enotation_small |
target backend supports Decimal() objects using E notation to represent very small values. |
Property | precision_numerics_general |
target backend has general support for moderately high-precision numerics. |
Property | precision_numerics_many_significant_digits |
target backend supports values with many digits on both sides, such as 319438950232418390.273596, 87673.594069654243 |
Property | precision_numerics_retains_significant_digits |
A precision numeric type will return empty significant digits, i.e. a value such as 10.000 will come back in Decimal form with the .000 maintained. |
Property | predictable_gc |
target platform must remove all cycles unconditionally when gc.collect() is called, as well as clean out unreferenced subclasses. |
Property | primary_key_constraint_reflection |
Undocumented |
Property | python2 |
Undocumented |
Property | python3 |
Undocumented |
Property | python36 |
Undocumented |
Property | python37 |
Undocumented |
Property | python38 |
Undocumented |
Property | queue_pool |
target database is using QueuePool |
Property | recursive_fk_cascade |
target database must support ON DELETE CASCADE on a self-referential foreign key |
Property | reflect_tables_no_columns |
target database supports creation and reflection of tables with no columns, or at least tables that seem to have no columns. |
Property | reflects_pk_names |
Undocumented |
Property | regexp_match |
backend supports the regexp_match operator. |
Property | regexp_replace |
backend supports the regexp_replace operator. |
Property | returning |
target platform supports RETURNING for at least one row. |
Property | sane_multi_rowcount |
Undocumented |
Property | sane_rowcount |
Undocumented |
Property | sane_rowcount_w_returning |
Undocumented |
Property | savepoints |
Target database must support savepoints. |
Property | schema_reflection |
Undocumented |
Property | schemas |
Target database must support external schemas, and have one named 'test_schema'. |
Property | selectone |
target driver must support the literal statement 'select 1' |
Property | self_referential_foreign_keys |
Target database must support self-referential foreign keys. |
Property | sequences |
Target database must support SEQUENCEs. |
Property | sequences_optional |
Target database supports sequences, but also optionally as a means of generating new PK values. |
Property | server_side_cursors |
Target dialect must support server side cursors. |
Property | skip_mysql_on_windows |
Catchall for a large variety of MySQL on Windows failures |
Property | sql_expression_limit_offset |
target database can render LIMIT and/or OFFSET with a complete SQL expression, such as one that uses the addition operator. parameter |
Property | sqlalchemy2_stubs |
Undocumented |
Property | sqlite |
Undocumented |
Property | standalone_binds |
target database/driver supports bound parameters as column expressions without being in the context of a typed column. |
Property | standalone_null_binds_whereclause |
target database/driver supports bound parameters with NULL in the WHERE clause, in situations where it has to be typed. |
Property | standard_cursor_sql |
Target database passes SQL-92 style statements to cursor.execute() when a statement like select() or insert() is run. |
Property | subqueries |
Target database must support subqueries. |
Property | supports_distinct_on |
If a backend supports the DISTINCT ON in a select |
Property | supports_is_distinct_from |
Supports some form of "x IS [NOT] DISTINCT FROM y" construct. Different dialects will implement their own flavour, e.g., sqlite will emit "x IS NOT y" instead of "x IS DISTINCT FROM y". |
Property | supports_lastrowid |
target database / driver supports cursor.lastrowid as a means of retrieving the last inserted primary key value. |
Property | symbol_names_w_double_quote |
Target driver can create tables with a name like 'some " table' |
Property | table_ddl_if_exists |
target platform supports IF NOT EXISTS / IF EXISTS for tables. |
Property | table_reflection |
target database has general support for table reflection |
Property | table_value_constructor |
Database / dialect supports a query like: |
Property | temp_table_names |
target dialect supports listing of temporary table names |
Property | temp_table_reflect_indexes |
Undocumented |
Property | temp_table_reflection |
Undocumented |
Property | temporary_tables |
target database supports temporary tables |
Property | temporary_views |
target database supports temporary views |
Property | text_type |
Target database must support an unbounded Text() " "type such as TEXT or CLOB |
Property | threading_with_mock |
Mark tests that use threading and mock at the same time - stability issues have been observed with coverage + python 3.3 |
Property | time |
target dialect supports representation of Python datetime.time() objects. |
Property | time_microseconds |
target dialect supports representation of Python datetime.time() with microsecond objects. |
Property | time_timezone |
target dialect supports representation of Python datetime.time() with tzinfo with Time(timezone=True). |
Property | timestamp_microseconds |
target dialect supports representation of Python datetime.datetime() with microsecond objects but only if TIMESTAMP is used. |
Property | timestamp_microseconds_implicit_bound |
No summary |
Property | timing_intensive |
Undocumented |
Property | tuple_in |
Target platform supports the syntax "(x, y) IN ((x1, y1), (x2, y2), ...)" |
Property | tuple_in_w_empty |
Target platform tuple IN w/ empty set |
Property | two_phase_transactions |
Target database must support two-phase transactions. |
Property | unbounded_varchar |
Target database must support VARCHAR with no length |
Property | unicode_connections |
Target driver must support non-ASCII characters being passed at all. |
Property | unicode_data |
Target database/dialect must support Python unicode objects with non-ASCII characters represented, delivered as bound parameters as well as in result rows. |
Property | unicode_ddl |
Target driver must support some degree of non-ascii symbol names. |
Property | unique_constraint_reflection |
target dialect supports reflection of unique constraints |
Property | update_from |
Target must support UPDATE..FROM syntax |
Property | update_where_target_in_subquery |
Target must support UPDATE (or DELETE) where the same table is present in a subquery in the WHERE clause. |
Property | view_column_reflection |
target database must support retrieval of the columns in a view, similarly to how a table is inspected. |
Property | view_reflection |
target database must support inspection of the full CREATE VIEW definition. |
Property | views |
Target database must support VIEWs. |
Property | window_functions |
Target database must support window functions. |
Return a structure of supported isolation levels for the current testing dialect.
The structure indicates to the testing suite what the expected "default" isolation should be, as well as the other values that are accepted. The dictionary has two keys, "default" and "supported". The "supported" key refers to a list of all supported levels and it should include AUTOCOMMIT if the dialect supports it.
If the .DefaultRequirements.isolation_level
requirement is
not open, then this method has no return value.
E.g.:
>>> testing.requirements.get_isolation_levels() { "default": "READ_COMMITTED", "supported": [ "SERIALIZABLE", "READ UNCOMMITTED", "READ COMMITTED", "REPEATABLE READ", "AUTOCOMMIT" ] }
Test environment must allow ad-hoc engine/connection creation.
DBs that scale poorly for many connections, even when closed, i.e. Oracle, may use the "--low-connections" option which flags this requirement as not present.
target backend supports simple binary literals, e.g. an expression like:
SELECT CAST('foo' AS BINARY)
Where BINARY is the type emitted from .LargeBinary
,
e.g. it could be BLOB or similar.
Basically fails on Oracle.
persisted
is omittedtarget dialect retrieves cursor.lastrowid, or fetches from a database-side function after an insert() construct executes, within the get_lastrowid() method.
Only dialects that "pre-execute", or need RETURNING to get last inserted id, would return closed/fail/skip for this.
backend supports fetch / offset with expression in them, like
SELECT * FROM some_table OFFSET 1 + 1 ROWS FETCH FIRST 1 + 1 ROWS ONLY
target backend doesn't crash when you try to select a NUMERIC value that has a value of NULL.
Added to support Pyodbc bug #351.
target platform will allow cursor.fetchone() to proceed after a COMMIT.
Typically this refers to an INSERT statement with RETURNING which is invoked within "autocommit". If the row can be returned after the autocommit, then this rule can be open.
Target supports refleciton of FOREIGN KEY constraints and will return the name of the constraint that was used in the "CONSTRAINT <name> FOREIGN KEY" DDL.
MySQL prior to version 8 and MariaDB prior to version 10.5 don't support this.
target platform supports SQL expressions in GROUP BY
e.g.
SELECT x + y AS somelabel FROM table GROUP BY x + y
target backend will return a selected Decimal as a Decimal, not a string.
e.g.:
expr = decimal.Decimal("15.7563") value = e.scalar( select(literal(expr)) ) assert value == expr
See :ticket:`4036`
target system has a strong concept of 'default' schema that can be referred to implicitly.
basically, PostgreSQL.
target dialect supports general isolation level settings.
Note that this requirement, when enabled, also requires that the get_isolation_levels() method be implemented.
Backend has a JSON_EXTRACT or similar function that returns a valid JSON string in all cases.
Used to test a legacy feature and is not needed.
Test should be skipped if coverage is enabled.
This is to block tests that exercise libraries that seem to be sensitive to coverage, such as PostgreSQL notice logging.
target database supports ordering by a column from a SELECT inside of a UNION
E.g. (SELECT id, ...) UNION (SELECT id, ...) ORDER BY id
target backend supports ORDER BY a column label within an expression.
Basically this:
select data as foo from test order by foo || 'bar'
Lots of databases including PostgreSQL don't support this, so this is off by default.
Target database must support parenthesized SELECT in UNION when LIMIT/OFFSET is specifically present.
E.g. (SELECT ...) UNION (SELECT ..)
This is known to fail on SQLite.
Target database must support parenthesized SELECT in UNION when OFFSET/LIMIT is specifically not present.
E.g. (SELECT ... LIMIT ..) UNION (SELECT .. OFFSET ..)
This is known to fail on SQLite. It also fails on Oracle because without LIMIT/OFFSET, there is currently no step that creates an additional subquery.
target backend supports weird identifiers with percent signs in them, e.g. 'some % column'.
this is a very weird use case but often has problems because of DBAPIs that use python formatting. It's not a critical use case either.
target platform supports RETURNING for at least one row.
See Also
.Requirements.full_returning
Target database passes SQL-92 style statements to cursor.execute() when a statement like select() or insert() is run.
A very small portion of dialect-level tests will ensure that certain conditions are present in SQL strings, and these tests use very basic SQL that will work on any SQL-like platform in order to assert results.
It's normally a given for any pep-249 DBAPI that a statement like "SELECT id, name FROM table WHERE some_table.id=5" will work. However, there are dialects that don't actually produce SQL Strings and instead may work with symbolic objects instead, or dialects that aren't working with SQL, so for those this requirement can be marked as excluded.
Supports some form of "x IS [NOT] DISTINCT FROM y" construct. Different dialects will implement their own flavour, e.g., sqlite will emit "x IS NOT y" instead of "x IS DISTINCT FROM y".
See Also
.ColumnOperators.is_distinct_from
target database / driver supports cursor.lastrowid as a means of retrieving the last inserted primary key value.
note that if the target DB supports sequences also, this is still assumed to work. This is a new use case brought on by MariaDB 10.3.
Database / dialect supports a query like:
SELECT * FROM VALUES ( (c1, c2), (c1, c2), ...) AS some_table(col1, col2)
SQLAlchemy generates this with the _sql.values
function.
Target must support UPDATE (or DELETE) where the same table is present in a subquery in the WHERE clause.
This is an ANSI-standard syntax that apparently MySQL can't handle, such as:
UPDATE documents SET flag=1 WHERE documents.title IN (SELECT max(documents.title) AS title FROM documents GROUP BY documents.user_id )
target database must support retrieval of the columns in a view, similarly to how a table is inspected.
This does not include the full CREATE VIEW definition.