B 4]h@sHdZddlZddlmZddlmZGdddeZGd d d eZdS) 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. N) exclusions)utilc@s eZdZdS) RequirementsN)__name__ __module__ __qualname__r r R/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/testing/requirements.pyrsrc@seZdZeddZeddZeddZeddZed 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քZndd؄ZoeddڄZpedd܄ZqeddބZreddZseddZteddZueddZveddZweddZxeddZyeddZzeddZ{eddZ|ddZ}ddZ~eddZeddZddZddZdS(SuiteRequirementscCstS)z/target platform can emit basic CreateTable DDL.)ropen)selfr r r create_tableszSuiteRequirements.create_tablecCstS)z-target platform can emit basic DropTable DDL.)rr )rr r r drop_table#szSuiteRequirements.drop_tablecCstS)z*Target database must support foreign keys.)rr )rr r r foreign_keys)szSuiteRequirements.foreign_keyscCstS)zR"target database must support ON UPDATE..CASCADE behavior in foreign keys.)rr )rr r r on_update_cascade/sz#SuiteRequirements.on_update_cascadecCstS)zWtarget database must *not* support ON UPDATE..CASCADE behavior in foreign keys.)rclosed)rr r r non_updating_cascade6sz&SuiteRequirements.non_updating_cascadecCstS)N)rr)rr r r deferrable_fks<sz SuiteRequirements.deferrable_fkscstfddS)NcsjjpjjS)N)rZenabledrr )rr r Fsz?SuiteRequirements.on_update_or_deferrable_fks..)ronly_if)rr )rr on_update_or_deferrable_fks@sz-SuiteRequirements.on_update_or_deferrable_fkscCstS)z;Target database must support self-referential foreign keys.)rr )rr r r self_referential_foreign_keysJsz/SuiteRequirements.self_referential_foreign_keyscCstS)z=Target database must support the DDL phrases for FOREIGN KEY.)rr )rr r r foreign_key_ddlPsz!SuiteRequirements.foreign_key_ddlcCstS)z3target database must support names for constraints.)rr )rr r r named_constraintsVsz#SuiteRequirements.named_constraintscCstS)z(Target database must support subqueries.)rr )rr r r subqueries\szSuiteRequirements.subqueriescCstS)zRtarget database can render OFFSET, or an equivalent, in a SELECT. )rr )rr r r offsetbszSuiteRequirements.offsetcCstS)zWtarget database can render LIMIT and/or OFFSET using a bound parameter )rr )rr r r bound_limit_offsetjsz$SuiteRequirements.bound_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. )rr )rr r r /parens_in_union_contained_select_w_limit_offsetrs 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. )rr )rr r r 0parens_in_union_contained_select_wo_limit_offset~s zBSuiteRequirements.parens_in_union_contained_select_wo_limit_offsetcCstS)z;Target database must support boolean expressions as columns)rr)rr r r boolean_col_expressionssz)SuiteRequirements.boolean_col_expressionscCstS)z,Target backends that support nulls ordering.)rr)rr r r nullsorderingszSuiteRequirements.nullsorderingcCstS)ztarget database/driver supports bound parameters as column expressions without being in the context of a typed column. )rr)rr r r standalone_bindssz"SuiteRequirements.standalone_bindscCstS)z5Target database must support INTERSECT or equivalent.)rr)rr r r intersectszSuiteRequirements.intersectcCstS)z?Target database must support EXCEPT or equivalent (i.e. MINUS).)rr)rr r r except_szSuiteRequirements.except_cCstS)z.Target database must support window functions.)rr)rr r r window_functionssz"SuiteRequirements.window_functionscCstS)zTarget database supports CTEs)rr)rr r r ctesszSuiteRequirements.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. )rr)rr r r ctes_with_update_deletesz)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....))rr)rr r r ctes_on_dmlszSuiteRequirements.ctes_on_dmlcCstS)z~target platform generates new surrogate integer primary key values when insert() is executed, excluding the pk column.)rr )rr r r autoincrement_insertsz&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. )rr )rr r r fetch_rows_post_commits 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 )rr )rr r r group_by_complex_expressions z-SuiteRequirements.group_by_complex_expressioncCstdddS)NcSs |jjj S)N)dbdialectZsupports_sane_rowcount)configr r r rz1SuiteRequirements.sane_rowcount..z&driver doesn't support 'sane' rowcount)rskip_if)rr r r sane_rowcountszSuiteRequirements.sane_rowcountcCstdddS)NcSs |jjj S)N)r-r.Zsupports_sane_multi_rowcount)r/r r r rr0z7SuiteRequirements.sane_multi_rowcount..z;driver %(driver)s %(doesnt_support)s 'sane' multi row count)rfails_if)rr r r sane_multi_rowcountsz%SuiteRequirements.sane_multi_rowcountcCstdddS)NcSs |jjj S)N)r-r.Z supports_sane_rowcount_returning)r/r r r rsz=SuiteRequirements.sane_rowcount_w_returning..z;driver doesn't support 'sane' rowcount when returning is on)rr3)rr r r sane_rowcount_w_returningsz+SuiteRequirements.sane_rowcount_w_returningcCstdddS)zatarget platform supports INSERT with no values, i.e. INSERT DEFAULT VALUES or equivalent.cSs|jjjp|jjjS)N)r-r.Zsupports_empty_insertZsupports_default_values)r/r r r rs z1SuiteRequirements.empty_inserts..zempty inserts not supported)rr)rr r r empty_insertsszSuiteRequirements.empty_insertscCstS)z.target platform supports INSERT from a SELECT.)rr )rr r r insert_from_selectsz$SuiteRequirements.insert_from_selectcCstdddS)z#target platform supports RETURNING.cSs |jjjS)N)r-r.Zimplicit_returning)r/r r r rr0z-SuiteRequirements.returning..z)%(database)s %(does_support)s 'returning')rr)rr r r returning szSuiteRequirements.returningcCstS)zZTarget platform supports the syntax "(x, y) IN ((x1, y1), (x2, y2), ...)" )rr)rr r r tuple_inszSuiteRequirements.tuple_incCstS)zwtarget platform supports a SELECT statement that has the same name repeated more than once in the columns list.)rr )rr r r %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 S)N)r-r.Zrequires_name_normalize)r/r r r r+r0z6SuiteRequirements.denormalized_names..z,Backend does not require denormalized names.)rr1)rr r r denormalized_names%sz$SuiteRequirements.denormalized_namescCstdddS)zTtarget database must support multiple VALUES clauses in an INSERT statement.cSs |jjj S)N)r-r.Zsupports_multivalues_insert)r/r r r r5r0z7SuiteRequirements.multivalues_inserts..z*Backend does not support multirow inserts.)rr1)rr r r multivalues_inserts/sz%SuiteRequirements.multivalues_insertscCstS)zw"target dialect implements the executioncontext.get_lastrowid() method without reliance on RETURNING. )rr )rr r r implements_get_lastrowid9sz*SuiteRequirements.implements_get_lastrowidcCstS)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. )rr)rr r r emulated_lastrowidAs z$SuiteRequirements.emulated_lastrowidcCstS)z^"target platform includes a 'lastrowid' accessor on the DBAPI cursor object. )rr)rr r r dbapi_lastrowidMsz!SuiteRequirements.dbapi_lastrowidcCstS)z#Target database must support VIEWs.)rr)rr r r viewsUszSuiteRequirements.viewscCstS)zXTarget database must support external schemas, and have one named 'test_schema'.)rr)rr r r schemas[szSuiteRequirements.schemascCstddgdS)z0Target dialect must support server side cursors.cSs |jjjS)N)r-r.Zsupports_server_side_cursors)r/r r r rgr0z7SuiteRequirements.server_side_cursors..zno server side cursors support)rr)rr r r server_side_cursorsbsz%SuiteRequirements.server_side_cursorscCstddgdS)z'Target database must support SEQUENCEs.cSs |jjjS)N)r-r.supports_sequences)r/r r r rpr0z-SuiteRequirements.sequences..zno sequence support)rr)rr r r sequenceskszSuiteRequirements.sequencescCstddgdS)zgTarget database supports sequences, but also optionally as a means of generating new PK values.cSs|jjjo|jjjS)N)r-r.rCsequences_optional)r/r r r r{s z6SuiteRequirements.sequences_optional..z.no sequence support, or sequences not optional)rr)rr r r rEtsz$SuiteRequirements.sequences_optionalcCstS)N)rr)rr r r reflects_pk_namessz#SuiteRequirements.reflects_pk_namescCstS)N)rr )rr r r table_reflectionsz"SuiteRequirements.table_reflectioncCstS)N)rr)rr r r comment_reflectionsz$SuiteRequirements.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. )r@)rr r r view_column_reflectionsz(SuiteRequirements.view_column_reflectioncCs|jS)zTtarget database must support inspection of the full CREATE VIEW definition. )r@)rr r r view_reflectionsz!SuiteRequirements.view_reflectioncCs|jS)N)rA)rr r r schema_reflectionsz#SuiteRequirements.schema_reflectioncCstS)N)rr )rr r r !primary_key_constraint_reflectionsz3SuiteRequirements.primary_key_constraint_reflectioncCstS)N)rr )rr r r !foreign_key_constraint_reflectionsz3SuiteRequirements.foreign_key_constraint_reflectioncCstS)N)rr)rr r r 1foreign_key_constraint_option_reflection_ondeleteszCSuiteRequirements.foreign_key_constraint_option_reflection_ondeletecCstS)N)rr)rr r r 1foreign_key_constraint_option_reflection_onupdateszCSuiteRequirements.foreign_key_constraint_option_reflection_onupdatecCstS)N)rr )rr r r temp_table_reflectionsz'SuiteRequirements.temp_table_reflectioncCstS)z8target dialect supports listing of temporary table names)rr)rr r r temp_table_namessz"SuiteRequirements.temp_table_namescCstS)z)target database supports temporary tables)rr )rr r r temporary_tablessz"SuiteRequirements.temporary_tablescCstS)z(target database supports temporary views)rr)rr r r temporary_viewssz!SuiteRequirements.temporary_viewscCstS)N)rr )rr r r index_reflectionsz"SuiteRequirements.index_reflectioncCstS)z>target database supports CREATE INDEX against SQL expressions.)rr)rr r r indexes_with_expressionssz*SuiteRequirements.indexes_with_expressionscCstS)z8target dialect supports reflection of unique constraints)rr )rr r r unique_constraint_reflectionsz.SuiteRequirements.unique_constraint_reflectioncCstS)z7target dialect supports reflection of check constraints)rr)rr r r check_constraint_reflectionsz-SuiteRequirements.check_constraint_reflectioncCstS)ztarget dialect raises IntegrityError when reporting an INSERT with a primary key violation. (hint: it should) )rr )rr r r $duplicate_key_raises_integrity_errorsz6SuiteRequirements.duplicate_key_raises_integrity_errorcCstS)z3Target database must support VARCHAR with no length)rr )rr r r unbounded_varcharsz#SuiteRequirements.unbounded_varcharcCstS)zTarget database/dialect must support Python unicode objects with non-ASCII characters represented, delivered as bound parameters as well as in result rows. )rr )rr r r unicode_dataszSuiteRequirements.unicode_datacCstS)zRTarget driver must support some degree of non-ascii symbol names. )rr)rr r r unicode_ddlszSuiteRequirements.unicode_ddlcCstS)ztarget dialect supports rendering of a date, time, or datetime as a literal string, e.g. via the TypeEngine.literal_processor() method. )rr)rr r r datetime_literalssz#SuiteRequirements.datetime_literalscCstS)zUtarget dialect supports representation of Python datetime.datetime() objects.)rr )rr r r datetimeszSuiteRequirements.datetimecCstS)zftarget dialect supports representation of Python datetime.datetime() with microsecond objects.)rr )rr r r datetime_microsecondssz'SuiteRequirements.datetime_microsecondscCstS)ztarget dialect supports representation of Python datetime.datetime() with microsecond objects but only if TIMESTAMP is used.)rr)rr r r timestamp_microseconds sz(SuiteRequirements.timestamp_microsecondscCstS)zutarget dialect supports representation of Python datetime.datetime() objects with historic (pre 1970) values.)rr)rr r r datetime_historicsz#SuiteRequirements.datetime_historiccCstS)zQtarget dialect supports representation of Python datetime.date() objects.)rr )rr r r dateszSuiteRequirements.datecCstS)zPtarget dialect accepts a datetime object as the target of a date column.)rr )rr r r date_coerces_from_datetime!sz,SuiteRequirements.date_coerces_from_datetimecCstS)zutarget dialect supports representation of Python datetime.datetime() objects with historic (pre 1970) values.)rr)rr r r date_historic(szSuiteRequirements.date_historiccCstS)zQtarget dialect supports representation of Python datetime.time() objects.)rr )rr r r time/szSuiteRequirements.timecCstS)zbtarget dialect supports representation of Python datetime.time() with microsecond objects.)rr )rr r r time_microseconds6sz#SuiteRequirements.time_microsecondscCstS)zttarget database/driver can allow BLOB/BINARY fields to be compared against a bound parameter value. )rr )rr r r binary_comparisons=sz$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. )rr )rr r r binary_literalsEsz!SuiteRequirements.binary_literalscCstS)z:target dialect supports 'AUTOCOMMIT' as an isolation_level)rr)rr r r autocommitUszSuiteRequirements.autocommitcCstS)z.target platform implements a native JSON type.)rr)rr r r json_typeZszSuiteRequirements.json_typecCs|jS)zO"target platform supports numeric array indexes within a JSON structure)ri)rr r r json_array_indexes`sz$SuiteRequirements.json_array_indexescCstS)zRtarget backend has general support for moderately high-precision numerics.)rr )rr r r precision_numerics_generalgsz,SuiteRequirements.precision_numerics_generalcCstS)zbtarget backend supports Decimal() objects using E notation to represent very small values.)rr)rr r r "precision_numerics_enotation_smallmsz4SuiteRequirements.precision_numerics_enotation_smallcCstS)zbtarget backend supports Decimal() objects using E notation to represent very large values.)rr)rr r r "precision_numerics_enotation_largessz4SuiteRequirements.precision_numerics_enotation_largecCstS)ztarget backend supports values with many digits on both sides, such as 319438950232418390.273596, 87673.594069654243 )rr)rr r r *precision_numerics_many_significant_digitsysz.check)rr1)rrr )rr order_by_collation2s z$SuiteRequirements.order_by_collationcCs tdS)N)r)rr/r r r r=sz(SuiteRequirements.get_order_by_collationcCstS)zUTarget driver must support non-ASCII characters being passed at all. )rr )rr r r unicode_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. )rr )rr r r graceful_disconnectsGsz&SuiteRequirements.graceful_disconnectscCstS)z9Catchall for a large variety of MySQL on Windows failures)rr )rr r r skip_mysql_on_windowsOsz'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|jjS)N)optionsZlow_connections)r/r r r r^r0z2SuiteRequirements.ad_hoc_engines..)rr1)rr r r ad_hoc_enginesTs z SuiteRequirements.ad_hoc_enginescCs tdS)Ntiming_intensive)r requires_tag)rr r r rasz"SuiteRequirements.timing_intensivecCs tdS)Nmemory_intensive)rr)rr r r resz"SuiteRequirements.memory_intensivecCstdddS)zMark tests that use threading and mock at the same time - stability issues have been observed with coverage + python 3.3 cSstjo |jjS)N)rZpy3kr has_coverage)r/r r r rpr0z7SuiteRequirements.threading_with_mock..z%Stability issues with coverage + py3k)rr1)rr r r threading_with_mockisz%SuiteRequirements.threading_with_mockcCstdddS)NcSs tjdkS)N))sys version_infor r r r rwr0z+SuiteRequirements.python2..z Python version 2.xx is required.)rr1)rr r r python2tszSuiteRequirements.python2cCstdddS)NcSs tjdkS)N)r)rrr r r r r~r0z+SuiteRequirements.python3..z Python version 3.xx is required.)rr1)rr r r python3{szSuiteRequirements.python3cCstdddS)NcSstjS)N)rcpythonr r r r rr0z+SuiteRequirements.cpython..zcPython interpreter needed)rr)rr r r rszSuiteRequirements.cpythoncs ddlmtfdddS)Nr)picklecstj rjdkptjdkS)NZcPickle)rr)rZpypyrrrr )rr r rs z5SuiteRequirements.non_broken_pickle..z.Needs cPickle+cPython or newer Python 3 pickle)Zsqlalchemy.utilrrr)rr )rr non_broken_pickles  z#SuiteRequirements.non_broken_picklecCs|jS)ztarget platform must remove all cycles unconditionally when gc.collect() is called, as well as clean out unreferenced subclasses. )r)rr r r predictable_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|jjS)N)rr)r/r r r rr0z/SuiteRequirements.no_coverage..z(Issues observed when coverage is enabled)rr1)rr r r no_coverageszSuiteRequirements.no_coveragecCsdS)NFr )rr/r r r _has_mysql_on_windowssz'SuiteRequirements._has_mysql_on_windowscCsdS)NFr )rr/r r r _has_mysql_fully_case_sensitivesz1SuiteRequirements._has_mysql_fully_case_sensitivecstfddS)Ncs S)N) _has_sqliter )rr r rr0z*SuiteRequirements.sqlite..)rr1)rr )rr sqliteszSuiteRequirements.sqlitecstfdddS)Ncs S)N)_has_cextensionsr )rr r rr0z/SuiteRequirements.cextensions..zC extensions not installed)rr1)rr )rr cextensionsszSuiteRequirements.cextensionscCs2ddlm}y |ddStk r,dSXdS)Nr) create_enginez sqlite://TF) sqlalchemyr ImportError)rrr r r rs  zSuiteRequirements._has_sqlitecCs.yddlm}m}dStk r(dSXdS)Nr) cresultproxy cprocessorsTF)rrrr)rrrr r r rs z"SuiteRequirements._has_cextensionsN)rrr propertyrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r2r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrr r r r r s                                                                                                    r )__doc__rrrobjectrr r r r r s