U kf&@sdZddlmZddlZddlmZddlmZddlmZdd lm Z dd lm Z dd l m Z Gd d d Z Gddde ZdS)zGlobal database feature support policy. Provides decorators to mark tests requiring specific feature support from the target database. External dialect test suites should subclass SuiteRequirements to provide specific inclusion/exclusions. ) annotationsN)asyncio) exclusionsonly_on create_engine)util) QueuePoolc@s eZdZdS) RequirementsN)__name__ __module__ __qualname__rrO/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/testing/requirements.pyr sr c@s eZdZeddZeddZeddZeddZed d Zed d Z ed dZ eddZ eddZ eddZ eddZeddZeddZeddZeddZedd Zed!d"Zed#d$Zed%d&Zed'd(Zed)d*Zed+d,Zed-d.Zed/d0Zed1d2Zed3d4Zed5d6Zed7d8Zed9d:Z ed;d<Z!ed=d>Z"ed?d@Z#edAdBZ$edCdDZ%edEdFZ&edGdHZ'edIdJZ(edKdLZ)edMdNZ*edOdPZ+edQdRZ,edSdTZ-edUdVZ.edWdXZ/edYdZZ0ed[d\Z1ed]d^Z2ed_d`Z3edadbZ4edcddZ5ededfZ6edgdhZ7edidjZ8edkdlZ9edmdnZ:edodpZ;edqdrZedwdxZ?edydzZ@ed{d|ZAed}d~ZBeddZCeddZDeddZEeddZFeddZGeddZHeddZIeddZJeddZKeddZLeddZMeddZNeddZOeddZPeddZQeddZReddZSeddZTeddZUeddZVeddZWeddZXeddZYeddZZeddZ[eddZ\eddZ]eddZ^eddZ_eddZ`eddZaeddZbeddZcedd„ZdeddĄZeeddƄZfeddȄZgeddʄZhedd̄Ziedd΄ZjeddЄZkedd҄ZleddԄZmeddքZnedd؄ZoeddڄZpedd܄ZqeddބZreddZseddZteddZueddZveddZweddZxeddZyeddZzeddZ{eddZ|eddZ}eddZ~eddZeddZeddZeddZeddZeddZeddZeddZeddZed d Zd d Zed dZeddZeddZeddZeddZeddZeddZeddZeddZedd Zed!d"Zed#d$Zed%d&Zed'd(Zed)d*Zed+d,Zed-d.Zed/d0Zed1d2Zed3d4Zed5d6Zed7d8Zed9d:Zed;d<Zed=d>Zed?d@ZedAdBZedCdDZedEdFZedGdHZedIdJZedKdLZedMdNZedOdPZedQdRZedSdTZedUdVZedWdXZdYdZZed[d\Zed]d^Zed_d`ZedadbZedcddZededfZedgdhZdidjZedkdlZedmdnZedodpZedqdrZedsdtZedudvZedwdxZedydzZed{d|Zed}d~ZeddZeddZeddZeddZeddZǐddZȐddZeddZeddZːddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZeddZedd„ZedÐdĄZedŐdƄZedǐdȄZedɐdʄZedːd̄Zed͐d΄ZedϐdЄZedѐd҄ZdS(SuiteRequirementscCstS)z/target platform can emit basic CreateTable DDL.ropenselfrrr create_table%szSuiteRequirements.create_tablecCstS)z-target platform can emit basic DropTable DDL.rrrrr drop_table+szSuiteRequirements.drop_tablecCstS)z>target platform supports IF NOT EXISTS / IF EXISTS for tables.rclosedrrrrtable_ddl_if_exists1sz%SuiteRequirements.table_ddl_if_existscCstS)z?target platform supports IF NOT EXISTS / IF EXISTS for indexes.rrrrrindex_ddl_if_exists7sz%SuiteRequirements.index_ddl_if_existscCstS)z0Return databases that support the UUID datatype.rrrrruuid_data_type=sz SuiteRequirements.uuid_data_typecCstS)z*Target database must support foreign keys.rrrrr foreign_keysCszSuiteRequirements.foreign_keyscCstS)zKTarget database creates an index that's reflected for foreign keys.rrrrrforeign_keys_reflect_as_indexIsz/SuiteRequirements.foreign_keys_reflect_as_indexcCstS)z=Target database reflects unique indexes as unique constrains.rrrrr*unique_index_reflect_as_unique_constraintsPszsz?SuiteRequirements.on_update_or_deferrable_fks..rZonly_ifrrrron_update_or_deferrable_fkss z-SuiteRequirements.on_update_or_deferrable_fkscCsdd}t|S)z"target database is using QueuePoolcSst|jjtSr') isinstancedbpoolr configrrrgosz(SuiteRequirements.queue_pool..gor+rr2rrr queue_poolszSuiteRequirements.queue_poolcCstS)z;Target database must support self-referential foreign keys.rrrrrself_referential_foreign_keyssz/SuiteRequirements.self_referential_foreign_keyscCstS)z=Target database must support the DDL phrases for FOREIGN KEY.rrrrrforeign_key_ddlsz!SuiteRequirements.foreign_key_ddlcCstS)z3target database must support names for constraints.rrrrrnamed_constraintssz#SuiteRequirements.named_constraintscCstS)z8target database must apply names to unnamed constraints.rrrrrimplicitly_named_constraintssz.SuiteRequirements.implicitly_named_constraintscCstS)atarget database allows column names that have unusual characters in them, such as dots, spaces, slashes, or percent signs. The column names are as always in such a case quoted, however the DB still needs to support those characters in the name somehow. rrrrrunusual_column_name_characterss z0SuiteRequirements.unusual_column_name_characterscCstS)z(Target database must support subqueries.rrrrr subqueriesszSuiteRequirements.subqueriescCstS)zRtarget database can render OFFSET, or an equivalent, in a SELECT. rrrrroffsetszSuiteRequirements.offsetcCstS)zWtarget database can render LIMIT and/or OFFSET using a bound parameter rrrrrbound_limit_offsetsz$SuiteRequirements.bound_limit_offsetcCstS)ztarget database can render LIMIT and/or OFFSET with a complete SQL expression, such as one that uses the addition operator. parameter rrrrrsql_expression_limit_offsetsz-SuiteRequirements.sql_expression_limit_offsetcCstS)zTarget 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. rrrrr/parens_in_union_contained_select_w_limit_offsets zASuiteRequirements.parens_in_union_contained_select_w_limit_offsetcCstS)alTarget 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. rrrrr0parens_in_union_contained_select_wo_limit_offsets zBSuiteRequirements.parens_in_union_contained_select_wo_limit_offsetcCstS)z;Target database must support boolean expressions as columnsrrrrrboolean_col_expressionssz)SuiteRequirements.boolean_col_expressionscCstS)z5Target database allows boolean columns to store NULL.rrrrrnullable_booleanssz#SuiteRequirements.nullable_booleanscCstS)z,Target backends that support nulls ordering.rrrrr nullsorderingszSuiteRequirements.nullsorderingcCstS)ztarget database/driver supports bound parameters as column expressions without being in the context of a typed column. rrrrrstandalone_bindssz"SuiteRequirements.standalone_bindscCstS)ztarget database/driver supports bound parameters with NULL in the WHERE clause, in situations where it has to be typed. rrrrr!standalone_null_binds_whereclausesz3SuiteRequirements.standalone_null_binds_whereclausecCstS)z5Target database must support INTERSECT or equivalent.rrrrr intersectszSuiteRequirements.intersectcCstS)z?Target database must support EXCEPT or equivalent (i.e. MINUS).rrrrrexcept_"szSuiteRequirements.except_cCstS)z.Target database must support window functions.rrrrrwindow_functions'sz"SuiteRequirements.window_functionscCstS)zTarget database supports CTEsrrrrrctes,szSuiteRequirements.ctescCstS)ztarget database supports CTES that ride on top of a normal UPDATE or DELETE statement which refers to the CTE in a correlated subquery. rrrrrctes_with_update_delete2sz)SuiteRequirements.ctes_with_update_deletecCstS)z}target database supports CTES which consist of INSERT, UPDATE or DELETE *within* the CTE, e.g. WITH x AS (UPDATE....)rrrrr ctes_on_dml;szSuiteRequirements.ctes_on_dmlcCstS)z~target platform generates new surrogate integer primary key values when insert() is executed, excluding the pk column.rrrrrautoincrement_insertBsz&SuiteRequirements.autoincrement_insertcCstS)a#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. rrrrrfetch_rows_post_commitIs z(SuiteRequirements.fetch_rows_post_commitcCstS)ztarget platform supports SQL expressions in GROUP BY e.g. SELECT x + y AS somelabel FROM table GROUP BY x + y rrrrrgroup_by_complex_expressionVs z-SuiteRequirements.group_by_complex_expressioncCstdddS)NcSs |jjj Sr')r.dialectZsupports_sane_rowcountr0rrrr*ez1SuiteRequirements.sane_rowcount..z&driver doesn't support 'sane' rowcountrskip_ifrrrr sane_rowcountbszSuiteRequirements.sane_rowcountcCstdddS)NcSs |jjj Sr')r.rNZsupports_sane_multi_rowcountr0rrrr*lrOz7SuiteRequirements.sane_multi_rowcount..z;driver %(driver)s %(doesnt_support)s 'sane' multi row countrZfails_ifrrrrsane_multi_rowcountisz%SuiteRequirements.sane_multi_rowcountcCstdddS)NcSs |jjj Sr')r.rNZ supports_sane_rowcount_returningr0rrrr*ssz=SuiteRequirements.sane_rowcount_w_returning..z;driver doesn't support 'sane' rowcount when returning is onrSrrrrsane_rowcount_w_returningpsz+SuiteRequirements.sane_rowcount_w_returningcCstdddS)zatarget platform supports INSERT with no values, i.e. INSERT DEFAULT VALUES or equivalent.cSs|jjjp|jjjp|jjjSr')r.rNZsupports_empty_insertZsupports_default_valuesZsupports_default_metavaluer0rrrr*s z1SuiteRequirements.empty_inserts..zempty inserts not supportedr+rrrr empty_insertsyszSuiteRequirements.empty_insertscCs|jS)zvtarget platform supports INSERT with no values, i.e. INSERT DEFAULT VALUES or equivalent, within executemany())rVrrrrempty_inserts_executemanysz+SuiteRequirements.empty_inserts_executemanycCstS)z.target platform supports INSERT from a SELECT.rrrrrinsert_from_selectsz$SuiteRequirements.insert_from_selectcCstdddS)z.target platform supports DELETE ... RETURNING.cSs |jjjSr')r.rNdelete_returningr0rrrr*rOz4SuiteRequirements.delete_returning..z4%(database)s %(does_support)s 'DELETE ... RETURNING'r+rrrrrYsz"SuiteRequirements.delete_returningcCstdddS)z.target platform supports INSERT ... RETURNING.cSs |jjjSr')r.rNinsert_returningr0rrrr*rOz4SuiteRequirements.insert_returning..z4%(database)s %(does_support)s 'INSERT ... RETURNING'r+rrrrrZsz"SuiteRequirements.insert_returningcCstdddS)z.target platform supports UPDATE ... RETURNING.cSs |jjjSr')r.rNupdate_returningr0rrrr*rOz4SuiteRequirements.update_returning..z4%(database)s %(does_support)s 'UPDATE ... RETURNING'r+rrrrr[sz"SuiteRequirements.update_returningcCstdddS)ztarget 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. cSs |jjjSr')r.rNinsert_executemany_returningr0rrrr*rOz@SuiteRequirements.insert_executemany_returning..zR%(database)s %(does_support)s 'RETURNING of multiple rows with INSERT executemany'r+rrrrr\sz.SuiteRequirements.insert_executemany_returningcCstdddS)NcSs|jjjo|jjjo|jjjSr')r.rNsupports_multivalues_insertrZZuse_insertmanyvaluesr0rrrr*s z4SuiteRequirements.insertmanyvalues..z=%(database)s %(does_support)s 'insertmanyvalues functionalityr+rrrrinsertmanyvaluessz"SuiteRequirements.insertmanyvaluescCstS)zZTarget platform supports the syntax "(x, y) IN ((x1, y1), (x2, y2), ...)" rrrrrtuple_inszSuiteRequirements.tuple_incCs|jS)z%Target platform tuple IN w/ empty set)r_rrrrtuple_in_w_emptysz"SuiteRequirements.tuple_in_w_emptycCstS)zwtarget platform supports a SELECT statement that has the same name repeated more than once in the columns list.rrrrr%duplicate_names_in_cursor_descriptionsz7SuiteRequirements.duplicate_names_in_cursor_descriptioncCstdddS)z[Target database must have 'denormalized', i.e. UPPERCASE as case insensitive names.cSs |jjj Sr')r.rNZrequires_name_normalizer0rrrr*rOz6SuiteRequirements.denormalized_names..z,Backend does not require denormalized names.rPrrrrdenormalized_namessz$SuiteRequirements.denormalized_namescCstdddS)zTtarget database must support multiple VALUES clauses in an INSERT statement.cSs |jjj Sr')r.rNr]r0rrrr*rOz7SuiteRequirements.multivalues_inserts..z*Backend does not support multirow inserts.rPrrrrmultivalues_insertssz%SuiteRequirements.multivalues_insertscCstS)zvtarget dialect implements the executioncontext.get_lastrowid() method without reliance on RETURNING. rrrrrimplements_get_lastrowidsz*SuiteRequirements.implements_get_lastrowidcCstS)zLdialect includes the required pep-249 attribute ``cursor.arraysize``rrrrr arraysizeszSuiteRequirements.arraysizecCstS)a<target 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. rrrrremulated_lastrowids z$SuiteRequirements.emulated_lastrowidcCstS)ztarget dialect retrieves cursor.lastrowid or an equivalent after an insert() construct executes, even if the table has a Sequence on it. rrrrr&emulated_lastrowid_even_with_sequencessz8SuiteRequirements.emulated_lastrowid_even_with_sequencescCstS)z]target platform includes a 'lastrowid' accessor on the DBAPI cursor object. rrrrrdbapi_lastrowidsz!SuiteRequirements.dbapi_lastrowidcCstS)z#Target database must support VIEWs.rrrrrviewsszSuiteRequirements.viewscCs tddS)zXTarget database must support external schemas, and have one named 'test_schema'.cSs |jjjSr')r.rNZsupports_schemasr0rrrr*#rOz+SuiteRequirements.schemas..rrrrrschemasszSuiteRequirements.schemascCstS)zJtarget system must support reflection of inter-schema foreign keysrrrrrcross_schema_fk_reflection%sz,SuiteRequirements.cross_schema_fk_reflectioncCstS)aTarget supports reflection of FOREIGN KEY constraints and will return the name of the constraint that was used in the "CONSTRAINT FOREIGN KEY" DDL. MySQL prior to version 8 and MariaDB prior to version 10.5 don't support this. rrrrr&foreign_key_constraint_name_reflection+s z8SuiteRequirements.foreign_key_constraint_name_reflectioncCstS)ztarget system has a strong concept of 'default' schema that can be referred to implicitly. basically, PostgreSQL. rrrrrimplicit_default_schema7sz)SuiteRequirements.implicit_default_schemacCstS)z`target dialect implements provisioning module including set_default_schema_on_connectionrrrrrdefault_schema_name_switchAsz,SuiteRequirements.default_schema_name_switchcCstddgdS)z0Target dialect must support server side cursors.cSs |jjjSr')r.rNZsupports_server_side_cursorsr0rrrr*MrOz7SuiteRequirements.server_side_cursors..zno server side cursors supportr+rrrrserver_side_cursorsHsz%SuiteRequirements.server_side_cursorscCstddgdS)z'Target database must support SEQUENCEs.cSs |jjjSr')r.rNsupports_sequencesr0rrrr*VrOz-SuiteRequirements.sequences..zno sequence supportr+rrrr sequencesQszSuiteRequirements.sequencescCs t|jS)zJthe opposite of "sequences", DB does not support sequences at all.)rZ NotPredicaterqrrrr no_sequencesZszSuiteRequirements.no_sequencescCstddgdS)zgTarget database supports sequences, but also optionally as a means of generating new PK values.cSs|jjjo|jjjSr')r.rNrpsequences_optionalr0rrrr*hs z6SuiteRequirements.sequences_optional..z.no sequence support, or sequences not optionalr+rrrrrsas z$SuiteRequirements.sequences_optionalcCstddgS)atarget 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. cSs |jjjSr'r.rNZpostfetch_lastrowidr0rrrr*xrOz6SuiteRequirements.supports_lastrowid..r+rrrrsupports_lastrowidns z$SuiteRequirements.supports_lastrowidcCstddgS)z"the opposite of supports_lastrowidcSs |jjj Sr'rtr0rrrr*rOz8SuiteRequirements.no_lastrowid_support..r+rrrrno_lastrowid_support{sz&SuiteRequirements.no_lastrowid_supportcCstSr'rrrrrreflects_pk_namessz#SuiteRequirements.reflects_pk_namescCstS)z8target database has general support for table reflectionrrrrrtable_reflectionsz"SuiteRequirements.table_reflectioncCstS)ztarget database supports creation and reflection of tables with no columns, or at least tables that seem to have no columns.rrrrrreflect_tables_no_columnssz+SuiteRequirements.reflect_tables_no_columnscCstS)z:Indicates if the database support table comment reflectionrrrrrcomment_reflectionsz$SuiteRequirements.comment_reflectioncCstS)z{Indicates if the database support table comment reflection in the full unicode range, including emoji etc. rrrrrcomment_reflection_full_unicodesz1SuiteRequirements.comment_reflection_full_unicodecCstS)zVindicates if the database support comments on constraints and their reflectionrrrrrconstraint_comment_reflectionsz/SuiteRequirements.constraint_comment_reflectioncCs|jS)ztarget 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. rirrrrview_column_reflectionsz(SuiteRequirements.view_column_reflectioncCs|jS)zStarget database must support inspection of the full CREATE VIEW definition.r}rrrrview_reflectionsz!SuiteRequirements.view_reflectioncCs|jSr')rjrrrrschema_reflectionsz#SuiteRequirements.schema_reflectioncCstS)zatarget database supports schema create and dropped with 'CREATE SCHEMA' and 'DROP SCHEMA'rrrrrschema_create_deletesz&SuiteRequirements.schema_create_deletecCstSr'rrrrr!primary_key_constraint_reflectionsz3SuiteRequirements.primary_key_constraint_reflectioncCstSr'rrrrr!foreign_key_constraint_reflectionsz3SuiteRequirements.foreign_key_constraint_reflectioncCstSr'rrrrr1foreign_key_constraint_option_reflection_ondeleteszCSuiteRequirements.foreign_key_constraint_option_reflection_ondeletecCstSr'rrrrr1fk_constraint_option_reflection_ondelete_restrictszCSuiteRequirements.fk_constraint_option_reflection_ondelete_restrictcCstSr'rrrrr1fk_constraint_option_reflection_ondelete_noactionszCSuiteRequirements.fk_constraint_option_reflection_ondelete_noactioncCstSr'rrrrr1foreign_key_constraint_option_reflection_onupdateszCSuiteRequirements.foreign_key_constraint_option_reflection_onupdatecCstSr'rrrrr1fk_constraint_option_reflection_onupdate_restrictszCSuiteRequirements.fk_constraint_option_reflection_onupdate_restrictcCstSr'rrrrrtemp_table_reflectionsz'SuiteRequirements.temp_table_reflectioncCs|jSr')rrrrrtemp_table_reflect_indexessz,SuiteRequirements.temp_table_reflect_indexescCstS)z8target dialect supports listing of temporary table namesrrrrrtemp_table_namessz"SuiteRequirements.temp_table_namescCstS)z9target dialect supports checking a single temp table namerrrrrhas_temp_tablesz SuiteRequirements.has_temp_tablecCstS)z)target database supports temporary tablesrrrrrtemporary_tablessz"SuiteRequirements.temporary_tablescCstS)z(target database supports temporary viewsrrrrrtemporary_viewssz!SuiteRequirements.temporary_viewscCstSr'rrrrrindex_reflectionsz"SuiteRequirements.index_reflectioncCstSr'rrrrrindex_reflects_included_columnssz1SuiteRequirements.index_reflects_included_columnscCstS)z?target database supports CREATE INDEX with per-column ASC/DESC.rrrrrindexes_with_ascdescsz&SuiteRequirements.indexes_with_ascdesccCstS)zKtarget database supports reflecting INDEX with per-column ASC/DESC.rrrrrreflect_indexes_with_ascdescsz.SuiteRequirements.reflect_indexes_with_ascdesccCstS)zztarget database supports reflecting INDEX with per-column ASC/DESC but reflects them as expressions (like oracle).rrrrr*reflect_indexes_with_ascdesc_as_expression sztarget database supports CREATE INDEX against SQL expressions.rrrrrindexes_with_expressionssz*SuiteRequirements.indexes_with_expressionscCstS)zLtarget database supports reflection of indexes with SQL expressions.rrrrr reflect_indexes_with_expressionssz2SuiteRequirements.reflect_indexes_with_expressionscCstS)z8target dialect supports reflection of unique constraintsrrrrrunique_constraint_reflectionsz.SuiteRequirements.unique_constraint_reflectioncCstS)z7target dialect supports reflection of check constraintsrrrrrcheck_constraint_reflectionsz-SuiteRequirements.check_constraint_reflectioncCstS)ztarget dialect raises IntegrityError when reporting an INSERT with a primary key violation. (hint: it should) rrrrr$duplicate_key_raises_integrity_error$sz6SuiteRequirements.duplicate_key_raises_integrity_errorcCstS)z3Target database must support VARCHAR with no lengthrrrrrunbounded_varchar,sz#SuiteRequirements.unbounded_varcharcCstS)zTarget database/dialect can receive / deliver / compare data with non-ASCII characters in plain VARCHAR, TEXT columns, without the need for special "national" datatypes like NVARCHAR or similar. rrrrrunicode_data_no_special_types2sz/SuiteRequirements.unicode_data_no_special_typescCstS)zTarget database/dialect must support Python unicode objects with non-ASCII characters represented, delivered as bound parameters as well as in result rows. rrrrr unicode_data;szSuiteRequirements.unicode_datacCstS)zRTarget driver must support some degree of non-ascii symbol names. rrrrr unicode_ddlDszSuiteRequirements.unicode_ddlcCstS)z?Target driver can create tables with a name like 'some " table'rrrrrsymbol_names_w_double_quoteKsz-SuiteRequirements.symbol_names_w_double_quotecCstS)ztarget dialect supports rendering of a datetime.timedelta as a literal string, e.g. via the TypeEngine.literal_processor() method. rrrrrdatetime_intervalPsz#SuiteRequirements.datetime_intervalcCstS)ztarget dialect supports rendering of a date, time, or datetime as a literal string, e.g. via the TypeEngine.literal_processor() method. rrrrrdatetime_literalsXsz#SuiteRequirements.datetime_literalscCstS)zUtarget dialect supports representation of Python datetime.datetime() objects.rrrrrdatetimeaszSuiteRequirements.datetimecCstS)zvtarget dialect supports representation of Python datetime.datetime() with tzinfo with DateTime(timezone=True).rrrrrdatetime_timezonehsz#SuiteRequirements.datetime_timezonecCstS)zntarget dialect supports representation of Python datetime.time() with tzinfo with Time(timezone=True).rrrrr time_timezoneoszSuiteRequirements.time_timezonecCstS)ztarget dialect when given a date object will bind it such that the database server knows the object is a date, and not a plain string. rrrrrdate_implicit_boundvsz%SuiteRequirements.date_implicit_boundcCstS)ztarget dialect when given a time object will bind it such that the database server knows the object is a time, and not a plain string. rrrrrtime_implicit_boundsz%SuiteRequirements.time_implicit_boundcCstS)ztarget 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. rrrrrdatetime_implicit_boundsz)SuiteRequirements.datetime_implicit_boundcCstS)zftarget dialect supports representation of Python datetime.datetime() with microsecond objects.rrrrrdatetime_microsecondssz'SuiteRequirements.datetime_microsecondscCstS)ztarget dialect supports representation of Python datetime.datetime() with microsecond objects but only if TIMESTAMP is used.rrrrrtimestamp_microsecondssz(SuiteRequirements.timestamp_microsecondscCs|jS)atarget dialect when given a datetime object which also includes a microseconds portion when using the TIMESTAMP data type will bind it such that the database server knows the object is a datetime with microseconds, and not a plain string. )rrrrr%timestamp_microseconds_implicit_boundsz7SuiteRequirements.timestamp_microseconds_implicit_boundcCstSzutarget dialect supports representation of Python datetime.datetime() objects with historic (pre 1970) values.rrrrrdatetime_historicsz#SuiteRequirements.datetime_historiccCstS)zQtarget dialect supports representation of Python datetime.date() objects.rrrrrdateszSuiteRequirements.datecCstS)zPtarget dialect accepts a datetime object as the target of a date column.rrrrrdate_coerces_from_datetimesz,SuiteRequirements.date_coerces_from_datetimecCstSrrrrrr date_historicszSuiteRequirements.date_historiccCstS)zQtarget dialect supports representation of Python datetime.time() objects.rrrrrtimeszSuiteRequirements.timecCstS)zbtarget dialect supports representation of Python datetime.time() with microsecond objects.rrrrrtime_microsecondssz#SuiteRequirements.time_microsecondscCstS)zttarget database/driver can allow BLOB/BINARY fields to be compared against a bound parameter value. rrrrrbinary_comparisonssz$SuiteRequirements.binary_comparisonscCstS)a!target backend supports simple binary literals, e.g. an expression like:: SELECT CAST('foo' AS BINARY) Where ``BINARY`` is the type emitted from :class:`.LargeBinary`, e.g. it could be ``BLOB`` or similar. Basically fails on Oracle. rrrrrbinary_literalssz!SuiteRequirements.binary_literalscCstS)z:target dialect supports 'AUTOCOMMIT' as an isolation_levelrrrrr autocommitszSuiteRequirements.autocommitcCstS)ztarget dialect supports general isolation level settings. Note that this requirement, when enabled, also requires that the get_isolation_levels() method be implemented. rrrrrisolation_levelsz!SuiteRequirements.isolation_levelc Csj|jV}z|j|jj}Wn tk r@YW5QRdSX|jj|dW5QRSW5QRXdS)aReturn 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 :meth:`.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" ] } N)default supported)r.connectrNget_isolation_level_values connectiondbapi_connectionNotImplementedErrorZdefault_isolation_level)rr1connrrrrget_isolation_levelss z&SuiteRequirements.get_isolation_levelscCsdd}t|S)ztarget dialect supports the :meth:`_engine.Dialect.get_isolation_level_values` method added in SQLAlchemy 2.0. c Ss^|jJ}z|j|jjWn tk r@YW5QRdSXW5QRdSW5QRXdSNFT)r.rrNrrrr)r1rrrrr2(s z8SuiteRequirements.get_isolation_level_values..gor+r3rrrr s z,SuiteRequirements.get_isolation_level_valuescCsdd}t|S)zctest that the dialect allows the 'isolation_level' argument to be handled by DefaultDialectcSs4zt|jjdd}WnYdSX|jjdkSdS)NzREAD COMMITTED)rF)r r.urlrNZ_on_connect_isolation_level)r1errrr2:s  zASuiteRequirements.dialect_level_isolation_level_param..gor+r3rrr#dialect_level_isolation_level_param5s z5SuiteRequirements.dialect_level_isolation_level_paramcCstS)z.target platform implements a native JSON type.rrrrr json_typeHszSuiteRequirements.json_typecCs|jS)zNtarget platform supports numeric array indexes within a JSON structure)rrrrrjson_array_indexesNsz$SuiteRequirements.json_array_indexescCstSr'rrrrr(json_index_supplementary_unicode_elementUsz:SuiteRequirements.json_index_supplementary_unicode_elementcCstS)zBackend 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. rrrrr!legacy_unconditional_json_extractYsz3SuiteRequirements.legacy_unconditional_json_extractcCstS)zRtarget backend has general support for moderately high-precision numerics.rrrrrprecision_numerics_generalcsz,SuiteRequirements.precision_numerics_generalcCstS)zbtarget backend supports Decimal() objects using E notation to represent very small values.rrrrr"precision_numerics_enotation_smallisz4SuiteRequirements.precision_numerics_enotation_smallcCstS)zbtarget backend supports Decimal() objects using E notation to represent very large values.rrrrr"precision_numerics_enotation_largeosz4SuiteRequirements.precision_numerics_enotation_largecCstS)ztarget backend supports values with many digits on both sides, such as 319438950232418390.273596, 87673.594069654243 rrrrr*precision_numerics_many_significant_digitsusz.checkrPrrrrrorder_by_collationms z$SuiteRequirements.order_by_collationcCs tdSr')rrr1rrrrxsz(SuiteRequirements.get_order_by_collationcCstS)zUTarget driver must support non-ASCII characters being passed at all. rrrrrunicode_connections{sz%SuiteRequirements.unicode_connectionscCstS)zTarget driver must raise a DBAPI-level exception, such as InterfaceError, when the underlying connection has been closed and the execute() method is called. rrrrrgraceful_disconnectssz&SuiteRequirements.graceful_disconnectscCstS)zU Target must support simultaneous, independent database connections. rrrrrindependent_connectionssz)SuiteRequirements.independent_connectionscCstS)z Target must support simultaneous, independent database connections that will be used in a readonly fashion. rrrrr independent_readonly_connectionssz2SuiteRequirements.independent_readonly_connectionscCstS)z9Catchall for a large variety of MySQL on Windows failuresrrrrrskip_mysql_on_windowssz'SuiteRequirements.skip_mysql_on_windowscCstddS)aTest 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. cSs|jjSr')optionsZlow_connectionsr0rrrr*rOz2SuiteRequirements.ad_hoc_engines..rPrrrrad_hoc_enginess z SuiteRequirements.ad_hoc_enginescCst|Sr')rrQ_running_on_windowsrrrr no_windowsszSuiteRequirements.no_windowscCstjddddS)NcSs tdkS)NWindows)platformsystemrrrrr*rOz7SuiteRequirements._running_on_windows..zrunning on Windows) description)rZLambdaPredicaterrrrrsz%SuiteRequirements._running_on_windowscCsddlm}|jjSNrr0)r1 add_to_markertiming_intensiverrrrrs z"SuiteRequirements.timing_intensivecCsddlm}|jjSr)rr1rmemory_intensiverrrrrs z"SuiteRequirements.memory_intensivecCstdddS)z}Mark tests that use threading and mock at the same time - stability issues have been observed with coverage cSs|jjSr'rZ has_coverager0rrrr*rOz7SuiteRequirements.threading_with_mock..zStability issues with coveragerPrrrrthreading_with_mocksz%SuiteRequirements.threading_with_mockcCsdd}t|S)NcSs,z tdWntk r"YdSXdSdSNzsqlalchemy-stubs.ext.mypyFT __import__ ImportErrorr0rrrrs  z2SuiteRequirements.sqlalchemy2_stubs..checkr+rrrrsqlalchemy2_stubssz#SuiteRequirements.sqlalchemy2_stubscCsdd}t|S)NcSs,z tdWntk r"YdSXdSdSrrr0rrrrs  z5SuiteRequirements.no_sqlalchemy2_stubs..checkrPrrrrno_sqlalchemy2_stubssz&SuiteRequirements.no_sqlalchemy2_stubscCstdddS)NcSstjSr')r Zpy38rrrrr*rOz,SuiteRequirements.python38..zPython 3.8 or above requiredr+rrrrpython38szSuiteRequirements.python38cCstdddS)NcSstjSr')r Zpy39rrrrr*rOz,SuiteRequirements.python39..zPython 3.9 or above requiredr+rrrrpython39szSuiteRequirements.python39cCstdddS)NcSstjSr')r Zpy310rrrrr*rOz-SuiteRequirements.python310..zPython 3.10 or above requiredr+rrrr python310szSuiteRequirements.python310cCstdddS)NcSstjSr')r Zpy311rrrrr*rOz-SuiteRequirements.python311..zPython 3.11 or above requiredr+rrrr python311szSuiteRequirements.python311cCstdddS)NcSstjSr')r Zpy312rrrrr*rOz-SuiteRequirements.python312..zPython 3.12 or above requiredr+rrrr python312szSuiteRequirements.python312cCstdddS)NcSstjSr')r cpythonrrrrr*rOz+SuiteRequirements.cpython..zcPython interpreter neededr+rrrrrszSuiteRequirements.cpythoncCstdddS)NcSstjSr')r is64bitrrrrr* rOz+SuiteRequirements.is64bit..z64bit requiredr+rrrrr  szSuiteRequirements.is64bitcCsdd}t|dS)NcSs,z tdWntk r"YdSXdSdS)NpatchFTrrrrr check_libs  z2SuiteRequirements.patch_library..check_libzpatch library neededr+)rr rrr patch_library szSuiteRequirements.patch_librarycCs|jS)ztarget platform must remove all cycles unconditionally when gc.collect() is called, as well as clean out unreferenced subclasses. )rrrrrpredictable_gcsz SuiteRequirements.predictable_gccCstdddS)zTest 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. cSs|jjSr'rr0rrrr**rOz/SuiteRequirements.no_coverage..z(Issues observed when coverage is enabledrPrrrr no_coverage!szSuiteRequirements.no_coveragecCsdSNFrrrrr_has_mysql_on_windows.sz'SuiteRequirements._has_mysql_on_windowscCsdSrrrrrr_has_mysql_fully_case_sensitive1sz1SuiteRequirements._has_mysql_fully_case_sensitivecstfddS)Ncs Sr') _has_sqliterrrrr*6rOz*SuiteRequirements.sqlite..rPrrrrsqlite4szSuiteRequirements.sqlitecCstdddS)NcSs t Sr')r Zhas_compiled_extrrrrr*;rOz/SuiteRequirements.cextensions..zCython extensions not installedrPrrrr cextensions8szSuiteRequirements.cextensionscCs6ddlm}z|dWdStk r0YdSXdS)Nrr z sqlite://TF)Z sqlalchemyr r)rr rrrr?s  zSuiteRequirements._has_sqlitecCstS)z@dialect makes use of await_() to invoke operations on the DBAPI.rrrrr async_dialectHszSuiteRequirements.async_dialectcCs|jSr')greenletrrrrrNszSuiteRequirements.asynciocCsdd}t|S)NcSs,z ddl}Wntk r"YdSXdSdS)NrTF)rrr1rrrrr2Ts  z)SuiteRequirements.no_greenlet..gor+r3rrr no_greenletRszSuiteRequirements.no_greenletcCsdd}t|S)NcSs6tjs dSz ddl}Wntk r,YdSXdSdS)NFrT) _test_asyncioZENABLE_ASYNCIOrrrrrrr2`s z&SuiteRequirements.greenlet..gor+r3rrrr^s zSuiteRequirements.greenletcCstS)zSupports computed columnsrrrrrcomputed_columnsmsz"SuiteRequirements.computed_columnscCstS)z/Supports computed columns with `persisted=True`rrrrrcomputed_columns_storedrsz)SuiteRequirements.computed_columns_storedcCstS)z0Supports computed columns with `persisted=False`rrrrrcomputed_columns_virtualwsz*SuiteRequirements.computed_columns_virtualcCstS)zSIf the default persistence is virtual or stored when `persisted` is omittedrrrrr"computed_columns_default_persisted|sz4SuiteRequirements.computed_columns_default_persistedcCstS)zTIf persistence information is returned by the reflection of computed columnsrrrrr"computed_columns_reflect_persistedsz4SuiteRequirements.computed_columns_reflect_persistedcCstS)z1If a backend supports the DISTINCT ON in a selectrrrrrsupports_distinct_onsz&SuiteRequirements.supports_distinct_oncCstdddS)a 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". .. seealso:: :meth:`.ColumnOperators.is_distinct_from` cSs |jjj Sr')r.rNsupports_is_distinct_fromr0rrrr*rOz=SuiteRequirements.supports_is_distinct_from..z4driver doesn't support an IS DISTINCT FROM constructrPrrrrr s z+SuiteRequirements.supports_is_distinct_fromcCstS)zKIf a backend supports GENERATED { ALWAYS | BY DEFAULT } AS IDENTITYrrrrridentity_columnssz"SuiteRequirements.identity_columnscCstS)zIf a backend supports GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY with a standard syntax. This is mainly to exclude MSSql. rrrrridentity_columns_standardsz+SuiteRequirements.identity_columns_standardcCstS)z+backend supports the regexp_match operator.rrrrr regexp_matchszSuiteRequirements.regexp_matchcCstS)z-backend supports the regexp_replace operator.rrrrrregexp_replacesz SuiteRequirements.regexp_replacecCstS)z(backend supports the fetch first clause.rrrrr fetch_firstszSuiteRequirements.fetch_firstcCstS)z5backend supports the fetch first clause with percent.rrrrr fetch_percentszSuiteRequirements.fetch_percentcCstS)z2backend supports the fetch first clause with ties.rrrrr fetch_tiesszSuiteRequirements.fetch_tiescCstS)z1backend supports the fetch first without order byrrrrrfetch_no_order_bysz#SuiteRequirements.fetch_no_order_bycCstS)zwbackend supports the offset when using fetch first with percent or ties. basically this is "not mssql" rrrrrfetch_offset_with_optionssz+SuiteRequirements.fetch_offset_with_optionscCstS)zbackend supports fetch / offset with expression in them, like SELECT * FROM some_table OFFSET 1 + 1 ROWS FETCH FIRST 1 + 1 ROWS ONLY rrrrrfetch_expressionsz"SuiteRequirements.fetch_expressioncCstS)zIf autoincrement=True on a column does not require an explicit sequence. This should be false only for oracle. rrrrrautoincrement_without_sequencesz0SuiteRequirements.autoincrement_without_sequencecCstS)z=If X[Y] can be implemented with ``__class_getitem__``. py3.7+rrrrrgeneric_classessz!SuiteRequirements.generic_classescCstS)z@indicates if the json_deserializer function is called with bytesrrrrrjson_deserializer_binarysz*SuiteRequirements.json_deserializer_binarycCstS)z6Target database must support reflecting table_options.rrrrrreflect_table_optionssz'SuiteRequirements.reflect_table_optionscCstS)z0Target database must support MATERIALIZED VIEWs.rrrrrmaterialized_viewssz$SuiteRequirements.materialized_viewscCstS)z/Target database reflect MATERIALIZED VIEWs pks.rrrrrmaterialized_views_reflect_pksz/SuiteRequirements.materialized_views_reflect_pkcCstS)z#Target database supports bitwise orrrrrrsupports_bitwise_orsz%SuiteRequirements.supports_bitwise_orcCstS)z$Target database supports bitwise andrrrrrsupports_bitwise_andsz&SuiteRequirements.supports_bitwise_andcCstS)z$Target database supports bitwise notrrrrrsupports_bitwise_notsz&SuiteRequirements.supports_bitwise_notcCstS)z$Target database supports bitwise xorrrrrrsupports_bitwise_xorsz&SuiteRequirements.supports_bitwise_xorcCstS)z4Target database supports bitwise left or right shiftrrrrrsupports_bitwise_shift sz(SuiteRequirements.supports_bitwise_shiftN)rrrpropertyrrrrrrr r!r"r#r$r%r&r(r,r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrRrTrUrVrWrXrYrZr[r\r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorqrrrsrurvrwrxryrzr{r|r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5rrrrr$s                                                                                                                                 &                r)__doc__ __future__rrrrrrrr r r/r r rrrrr s