requirements.py 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783
  1. # testing/requirements.py
  2. # Copyright (C) 2005-2024 the SQLAlchemy authors and contributors
  3. # <see AUTHORS file>
  4. #
  5. # This module is part of SQLAlchemy and is released under
  6. # the MIT License: https://www.opensource.org/licenses/mit-license.php
  7. # mypy: ignore-errors
  8. """Global database feature support policy.
  9. Provides decorators to mark tests requiring specific feature support from the
  10. target database.
  11. External dialect test suites should subclass SuiteRequirements
  12. to provide specific inclusion/exclusions.
  13. """
  14. from __future__ import annotations
  15. import platform
  16. from . import asyncio as _test_asyncio
  17. from . import exclusions
  18. from .exclusions import only_on
  19. from .. import create_engine
  20. from .. import util
  21. from ..pool import QueuePool
  22. class Requirements:
  23. pass
  24. class SuiteRequirements(Requirements):
  25. @property
  26. def create_table(self):
  27. """target platform can emit basic CreateTable DDL."""
  28. return exclusions.open()
  29. @property
  30. def drop_table(self):
  31. """target platform can emit basic DropTable DDL."""
  32. return exclusions.open()
  33. @property
  34. def table_ddl_if_exists(self):
  35. """target platform supports IF NOT EXISTS / IF EXISTS for tables."""
  36. return exclusions.closed()
  37. @property
  38. def index_ddl_if_exists(self):
  39. """target platform supports IF NOT EXISTS / IF EXISTS for indexes."""
  40. return exclusions.closed()
  41. @property
  42. def uuid_data_type(self):
  43. """Return databases that support the UUID datatype."""
  44. return exclusions.closed()
  45. @property
  46. def foreign_keys(self):
  47. """Target database must support foreign keys."""
  48. return exclusions.open()
  49. @property
  50. def foreign_keys_reflect_as_index(self):
  51. """Target database creates an index that's reflected for
  52. foreign keys."""
  53. return exclusions.closed()
  54. @property
  55. def unique_index_reflect_as_unique_constraints(self):
  56. """Target database reflects unique indexes as unique constrains."""
  57. return exclusions.closed()
  58. @property
  59. def unique_constraints_reflect_as_index(self):
  60. """Target database reflects unique constraints as indexes."""
  61. return exclusions.closed()
  62. @property
  63. def table_value_constructor(self):
  64. """Database / dialect supports a query like::
  65. SELECT * FROM VALUES ( (c1, c2), (c1, c2), ...)
  66. AS some_table(col1, col2)
  67. SQLAlchemy generates this with the :func:`_sql.values` function.
  68. """
  69. return exclusions.closed()
  70. @property
  71. def standard_cursor_sql(self):
  72. """Target database passes SQL-92 style statements to cursor.execute()
  73. when a statement like select() or insert() is run.
  74. A very small portion of dialect-level tests will ensure that certain
  75. conditions are present in SQL strings, and these tests use very basic
  76. SQL that will work on any SQL-like platform in order to assert results.
  77. It's normally a given for any pep-249 DBAPI that a statement like
  78. "SELECT id, name FROM table WHERE some_table.id=5" will work.
  79. However, there are dialects that don't actually produce SQL Strings
  80. and instead may work with symbolic objects instead, or dialects that
  81. aren't working with SQL, so for those this requirement can be marked
  82. as excluded.
  83. """
  84. return exclusions.open()
  85. @property
  86. def on_update_cascade(self):
  87. """target database must support ON UPDATE..CASCADE behavior in
  88. foreign keys."""
  89. return exclusions.open()
  90. @property
  91. def non_updating_cascade(self):
  92. """target database must *not* support ON UPDATE..CASCADE behavior in
  93. foreign keys."""
  94. return exclusions.closed()
  95. @property
  96. def deferrable_fks(self):
  97. return exclusions.closed()
  98. @property
  99. def on_update_or_deferrable_fks(self):
  100. # TODO: exclusions should be composable,
  101. # somehow only_if([x, y]) isn't working here, negation/conjunctions
  102. # getting confused.
  103. return exclusions.only_if(
  104. lambda: self.on_update_cascade.enabled
  105. or self.deferrable_fks.enabled
  106. )
  107. @property
  108. def queue_pool(self):
  109. """target database is using QueuePool"""
  110. def go(config):
  111. return isinstance(config.db.pool, QueuePool)
  112. return exclusions.only_if(go)
  113. @property
  114. def self_referential_foreign_keys(self):
  115. """Target database must support self-referential foreign keys."""
  116. return exclusions.open()
  117. @property
  118. def foreign_key_ddl(self):
  119. """Target database must support the DDL phrases for FOREIGN KEY."""
  120. return exclusions.open()
  121. @property
  122. def named_constraints(self):
  123. """target database must support names for constraints."""
  124. return exclusions.open()
  125. @property
  126. def implicitly_named_constraints(self):
  127. """target database must apply names to unnamed constraints."""
  128. return exclusions.open()
  129. @property
  130. def unusual_column_name_characters(self):
  131. """target database allows column names that have unusual characters
  132. in them, such as dots, spaces, slashes, or percent signs.
  133. The column names are as always in such a case quoted, however the
  134. DB still needs to support those characters in the name somehow.
  135. """
  136. return exclusions.open()
  137. @property
  138. def subqueries(self):
  139. """Target database must support subqueries."""
  140. return exclusions.open()
  141. @property
  142. def offset(self):
  143. """target database can render OFFSET, or an equivalent, in a
  144. SELECT.
  145. """
  146. return exclusions.open()
  147. @property
  148. def bound_limit_offset(self):
  149. """target database can render LIMIT and/or OFFSET using a bound
  150. parameter
  151. """
  152. return exclusions.open()
  153. @property
  154. def sql_expression_limit_offset(self):
  155. """target database can render LIMIT and/or OFFSET with a complete
  156. SQL expression, such as one that uses the addition operator.
  157. parameter
  158. """
  159. return exclusions.open()
  160. @property
  161. def parens_in_union_contained_select_w_limit_offset(self):
  162. """Target database must support parenthesized SELECT in UNION
  163. when LIMIT/OFFSET is specifically present.
  164. E.g. (SELECT ...) UNION (SELECT ..)
  165. This is known to fail on SQLite.
  166. """
  167. return exclusions.open()
  168. @property
  169. def parens_in_union_contained_select_wo_limit_offset(self):
  170. """Target database must support parenthesized SELECT in UNION
  171. when OFFSET/LIMIT is specifically not present.
  172. E.g. (SELECT ... LIMIT ..) UNION (SELECT .. OFFSET ..)
  173. This is known to fail on SQLite. It also fails on Oracle
  174. because without LIMIT/OFFSET, there is currently no step that
  175. creates an additional subquery.
  176. """
  177. return exclusions.open()
  178. @property
  179. def boolean_col_expressions(self):
  180. """Target database must support boolean expressions as columns"""
  181. return exclusions.closed()
  182. @property
  183. def nullable_booleans(self):
  184. """Target database allows boolean columns to store NULL."""
  185. return exclusions.open()
  186. @property
  187. def nullsordering(self):
  188. """Target backends that support nulls ordering."""
  189. return exclusions.closed()
  190. @property
  191. def standalone_binds(self):
  192. """target database/driver supports bound parameters as column
  193. expressions without being in the context of a typed column.
  194. """
  195. return exclusions.open()
  196. @property
  197. def standalone_null_binds_whereclause(self):
  198. """target database/driver supports bound parameters with NULL in the
  199. WHERE clause, in situations where it has to be typed.
  200. """
  201. return exclusions.open()
  202. @property
  203. def intersect(self):
  204. """Target database must support INTERSECT or equivalent."""
  205. return exclusions.closed()
  206. @property
  207. def except_(self):
  208. """Target database must support EXCEPT or equivalent (i.e. MINUS)."""
  209. return exclusions.closed()
  210. @property
  211. def window_functions(self):
  212. """Target database must support window functions."""
  213. return exclusions.closed()
  214. @property
  215. def ctes(self):
  216. """Target database supports CTEs"""
  217. return exclusions.closed()
  218. @property
  219. def ctes_with_update_delete(self):
  220. """target database supports CTES that ride on top of a normal UPDATE
  221. or DELETE statement which refers to the CTE in a correlated subquery.
  222. """
  223. return exclusions.closed()
  224. @property
  225. def ctes_on_dml(self):
  226. """target database supports CTES which consist of INSERT, UPDATE
  227. or DELETE *within* the CTE, e.g. WITH x AS (UPDATE....)"""
  228. return exclusions.closed()
  229. @property
  230. def autoincrement_insert(self):
  231. """target platform generates new surrogate integer primary key values
  232. when insert() is executed, excluding the pk column."""
  233. return exclusions.open()
  234. @property
  235. def fetch_rows_post_commit(self):
  236. """target platform will allow cursor.fetchone() to proceed after a
  237. COMMIT.
  238. Typically this refers to an INSERT statement with RETURNING which
  239. is invoked within "autocommit". If the row can be returned
  240. after the autocommit, then this rule can be open.
  241. """
  242. return exclusions.open()
  243. @property
  244. def group_by_complex_expression(self):
  245. """target platform supports SQL expressions in GROUP BY
  246. e.g.
  247. SELECT x + y AS somelabel FROM table GROUP BY x + y
  248. """
  249. return exclusions.open()
  250. @property
  251. def sane_rowcount(self):
  252. return exclusions.skip_if(
  253. lambda config: not config.db.dialect.supports_sane_rowcount,
  254. "driver doesn't support 'sane' rowcount",
  255. )
  256. @property
  257. def sane_multi_rowcount(self):
  258. return exclusions.fails_if(
  259. lambda config: not config.db.dialect.supports_sane_multi_rowcount,
  260. "driver %(driver)s %(doesnt_support)s 'sane' multi row count",
  261. )
  262. @property
  263. def sane_rowcount_w_returning(self):
  264. return exclusions.fails_if(
  265. lambda config: not (
  266. config.db.dialect.supports_sane_rowcount_returning
  267. ),
  268. "driver doesn't support 'sane' rowcount when returning is on",
  269. )
  270. @property
  271. def empty_inserts(self):
  272. """target platform supports INSERT with no values, i.e.
  273. INSERT DEFAULT VALUES or equivalent."""
  274. return exclusions.only_if(
  275. lambda config: config.db.dialect.supports_empty_insert
  276. or config.db.dialect.supports_default_values
  277. or config.db.dialect.supports_default_metavalue,
  278. "empty inserts not supported",
  279. )
  280. @property
  281. def empty_inserts_executemany(self):
  282. """target platform supports INSERT with no values, i.e.
  283. INSERT DEFAULT VALUES or equivalent, within executemany()"""
  284. return self.empty_inserts
  285. @property
  286. def insert_from_select(self):
  287. """target platform supports INSERT from a SELECT."""
  288. return exclusions.open()
  289. @property
  290. def delete_returning(self):
  291. """target platform supports DELETE ... RETURNING."""
  292. return exclusions.only_if(
  293. lambda config: config.db.dialect.delete_returning,
  294. "%(database)s %(does_support)s 'DELETE ... RETURNING'",
  295. )
  296. @property
  297. def insert_returning(self):
  298. """target platform supports INSERT ... RETURNING."""
  299. return exclusions.only_if(
  300. lambda config: config.db.dialect.insert_returning,
  301. "%(database)s %(does_support)s 'INSERT ... RETURNING'",
  302. )
  303. @property
  304. def update_returning(self):
  305. """target platform supports UPDATE ... RETURNING."""
  306. return exclusions.only_if(
  307. lambda config: config.db.dialect.update_returning,
  308. "%(database)s %(does_support)s 'UPDATE ... RETURNING'",
  309. )
  310. @property
  311. def insert_executemany_returning(self):
  312. """target platform supports RETURNING when INSERT is used with
  313. executemany(), e.g. multiple parameter sets, indicating
  314. as many rows come back as do parameter sets were passed.
  315. """
  316. return exclusions.only_if(
  317. lambda config: config.db.dialect.insert_executemany_returning,
  318. "%(database)s %(does_support)s 'RETURNING of "
  319. "multiple rows with INSERT executemany'",
  320. )
  321. @property
  322. def insertmanyvalues(self):
  323. return exclusions.only_if(
  324. lambda config: config.db.dialect.supports_multivalues_insert
  325. and config.db.dialect.insert_returning
  326. and config.db.dialect.use_insertmanyvalues,
  327. "%(database)s %(does_support)s 'insertmanyvalues functionality",
  328. )
  329. @property
  330. def tuple_in(self):
  331. """Target platform supports the syntax
  332. "(x, y) IN ((x1, y1), (x2, y2), ...)"
  333. """
  334. return exclusions.closed()
  335. @property
  336. def tuple_in_w_empty(self):
  337. """Target platform tuple IN w/ empty set"""
  338. return self.tuple_in
  339. @property
  340. def duplicate_names_in_cursor_description(self):
  341. """target platform supports a SELECT statement that has
  342. the same name repeated more than once in the columns list."""
  343. return exclusions.open()
  344. @property
  345. def denormalized_names(self):
  346. """Target database must have 'denormalized', i.e.
  347. UPPERCASE as case insensitive names."""
  348. return exclusions.skip_if(
  349. lambda config: not config.db.dialect.requires_name_normalize,
  350. "Backend does not require denormalized names.",
  351. )
  352. @property
  353. def multivalues_inserts(self):
  354. """target database must support multiple VALUES clauses in an
  355. INSERT statement."""
  356. return exclusions.skip_if(
  357. lambda config: not config.db.dialect.supports_multivalues_insert,
  358. "Backend does not support multirow inserts.",
  359. )
  360. @property
  361. def implements_get_lastrowid(self):
  362. """target dialect implements the executioncontext.get_lastrowid()
  363. method without reliance on RETURNING.
  364. """
  365. return exclusions.open()
  366. @property
  367. def arraysize(self):
  368. """dialect includes the required pep-249 attribute
  369. ``cursor.arraysize``"""
  370. return exclusions.open()
  371. @property
  372. def emulated_lastrowid(self):
  373. """target dialect retrieves cursor.lastrowid, or fetches
  374. from a database-side function after an insert() construct executes,
  375. within the get_lastrowid() method.
  376. Only dialects that "pre-execute", or need RETURNING to get last
  377. inserted id, would return closed/fail/skip for this.
  378. """
  379. return exclusions.closed()
  380. @property
  381. def emulated_lastrowid_even_with_sequences(self):
  382. """target dialect retrieves cursor.lastrowid or an equivalent
  383. after an insert() construct executes, even if the table has a
  384. Sequence on it.
  385. """
  386. return exclusions.closed()
  387. @property
  388. def dbapi_lastrowid(self):
  389. """target platform includes a 'lastrowid' accessor on the DBAPI
  390. cursor object.
  391. """
  392. return exclusions.closed()
  393. @property
  394. def views(self):
  395. """Target database must support VIEWs."""
  396. return exclusions.closed()
  397. @property
  398. def schemas(self):
  399. """Target database must support external schemas, and have one
  400. named 'test_schema'."""
  401. return only_on(lambda config: config.db.dialect.supports_schemas)
  402. @property
  403. def cross_schema_fk_reflection(self):
  404. """target system must support reflection of inter-schema
  405. foreign keys"""
  406. return exclusions.closed()
  407. @property
  408. def foreign_key_constraint_name_reflection(self):
  409. """Target supports reflection of FOREIGN KEY constraints and
  410. will return the name of the constraint that was used in the
  411. "CONSTRAINT <name> FOREIGN KEY" DDL.
  412. MySQL prior to version 8 and MariaDB prior to version 10.5
  413. don't support this.
  414. """
  415. return exclusions.closed()
  416. @property
  417. def implicit_default_schema(self):
  418. """target system has a strong concept of 'default' schema that can
  419. be referred to implicitly.
  420. basically, PostgreSQL.
  421. """
  422. return exclusions.closed()
  423. @property
  424. def default_schema_name_switch(self):
  425. """target dialect implements provisioning module including
  426. set_default_schema_on_connection"""
  427. return exclusions.closed()
  428. @property
  429. def server_side_cursors(self):
  430. """Target dialect must support server side cursors."""
  431. return exclusions.only_if(
  432. [lambda config: config.db.dialect.supports_server_side_cursors],
  433. "no server side cursors support",
  434. )
  435. @property
  436. def sequences(self):
  437. """Target database must support SEQUENCEs."""
  438. return exclusions.only_if(
  439. [lambda config: config.db.dialect.supports_sequences],
  440. "no sequence support",
  441. )
  442. @property
  443. def no_sequences(self):
  444. """the opposite of "sequences", DB does not support sequences at
  445. all."""
  446. return exclusions.NotPredicate(self.sequences)
  447. @property
  448. def sequences_optional(self):
  449. """Target database supports sequences, but also optionally
  450. as a means of generating new PK values."""
  451. return exclusions.only_if(
  452. [
  453. lambda config: config.db.dialect.supports_sequences
  454. and config.db.dialect.sequences_optional
  455. ],
  456. "no sequence support, or sequences not optional",
  457. )
  458. @property
  459. def supports_lastrowid(self):
  460. """target database / driver supports cursor.lastrowid as a means
  461. of retrieving the last inserted primary key value.
  462. note that if the target DB supports sequences also, this is still
  463. assumed to work. This is a new use case brought on by MariaDB 10.3.
  464. """
  465. return exclusions.only_if(
  466. [lambda config: config.db.dialect.postfetch_lastrowid]
  467. )
  468. @property
  469. def no_lastrowid_support(self):
  470. """the opposite of supports_lastrowid"""
  471. return exclusions.only_if(
  472. [lambda config: not config.db.dialect.postfetch_lastrowid]
  473. )
  474. @property
  475. def reflects_pk_names(self):
  476. return exclusions.closed()
  477. @property
  478. def table_reflection(self):
  479. """target database has general support for table reflection"""
  480. return exclusions.open()
  481. @property
  482. def reflect_tables_no_columns(self):
  483. """target database supports creation and reflection of tables with no
  484. columns, or at least tables that seem to have no columns."""
  485. return exclusions.closed()
  486. @property
  487. def comment_reflection(self):
  488. """Indicates if the database support table comment reflection"""
  489. return exclusions.closed()
  490. @property
  491. def comment_reflection_full_unicode(self):
  492. """Indicates if the database support table comment reflection in the
  493. full unicode range, including emoji etc.
  494. """
  495. return exclusions.closed()
  496. @property
  497. def constraint_comment_reflection(self):
  498. """indicates if the database support comments on constraints
  499. and their reflection"""
  500. return exclusions.closed()
  501. @property
  502. def view_column_reflection(self):
  503. """target database must support retrieval of the columns in a view,
  504. similarly to how a table is inspected.
  505. This does not include the full CREATE VIEW definition.
  506. """
  507. return self.views
  508. @property
  509. def view_reflection(self):
  510. """target database must support inspection of the full CREATE VIEW
  511. definition."""
  512. return self.views
  513. @property
  514. def schema_reflection(self):
  515. return self.schemas
  516. @property
  517. def schema_create_delete(self):
  518. """target database supports schema create and dropped with
  519. 'CREATE SCHEMA' and 'DROP SCHEMA'"""
  520. return exclusions.closed()
  521. @property
  522. def primary_key_constraint_reflection(self):
  523. return exclusions.open()
  524. @property
  525. def foreign_key_constraint_reflection(self):
  526. return exclusions.open()
  527. @property
  528. def foreign_key_constraint_option_reflection_ondelete(self):
  529. return exclusions.closed()
  530. @property
  531. def fk_constraint_option_reflection_ondelete_restrict(self):
  532. return exclusions.closed()
  533. @property
  534. def fk_constraint_option_reflection_ondelete_noaction(self):
  535. return exclusions.closed()
  536. @property
  537. def foreign_key_constraint_option_reflection_onupdate(self):
  538. return exclusions.closed()
  539. @property
  540. def fk_constraint_option_reflection_onupdate_restrict(self):
  541. return exclusions.closed()
  542. @property
  543. def temp_table_reflection(self):
  544. return exclusions.open()
  545. @property
  546. def temp_table_reflect_indexes(self):
  547. return self.temp_table_reflection
  548. @property
  549. def temp_table_names(self):
  550. """target dialect supports listing of temporary table names"""
  551. return exclusions.closed()
  552. @property
  553. def has_temp_table(self):
  554. """target dialect supports checking a single temp table name"""
  555. return exclusions.closed()
  556. @property
  557. def temporary_tables(self):
  558. """target database supports temporary tables"""
  559. return exclusions.open()
  560. @property
  561. def temporary_views(self):
  562. """target database supports temporary views"""
  563. return exclusions.closed()
  564. @property
  565. def index_reflection(self):
  566. return exclusions.open()
  567. @property
  568. def index_reflects_included_columns(self):
  569. return exclusions.closed()
  570. @property
  571. def indexes_with_ascdesc(self):
  572. """target database supports CREATE INDEX with per-column ASC/DESC."""
  573. return exclusions.open()
  574. @property
  575. def reflect_indexes_with_ascdesc(self):
  576. """target database supports reflecting INDEX with per-column
  577. ASC/DESC."""
  578. return exclusions.open()
  579. @property
  580. def reflect_indexes_with_ascdesc_as_expression(self):
  581. """target database supports reflecting INDEX with per-column
  582. ASC/DESC but reflects them as expressions (like oracle)."""
  583. return exclusions.closed()
  584. @property
  585. def indexes_with_expressions(self):
  586. """target database supports CREATE INDEX against SQL expressions."""
  587. return exclusions.closed()
  588. @property
  589. def reflect_indexes_with_expressions(self):
  590. """target database supports reflection of indexes with
  591. SQL expressions."""
  592. return exclusions.closed()
  593. @property
  594. def unique_constraint_reflection(self):
  595. """target dialect supports reflection of unique constraints"""
  596. return exclusions.open()
  597. @property
  598. def check_constraint_reflection(self):
  599. """target dialect supports reflection of check constraints"""
  600. return exclusions.closed()
  601. @property
  602. def duplicate_key_raises_integrity_error(self):
  603. """target dialect raises IntegrityError when reporting an INSERT
  604. with a primary key violation. (hint: it should)
  605. """
  606. return exclusions.open()
  607. @property
  608. def unbounded_varchar(self):
  609. """Target database must support VARCHAR with no length"""
  610. return exclusions.open()
  611. @property
  612. def unicode_data_no_special_types(self):
  613. """Target database/dialect can receive / deliver / compare data with
  614. non-ASCII characters in plain VARCHAR, TEXT columns, without the need
  615. for special "national" datatypes like NVARCHAR or similar.
  616. """
  617. return exclusions.open()
  618. @property
  619. def unicode_data(self):
  620. """Target database/dialect must support Python unicode objects with
  621. non-ASCII characters represented, delivered as bound parameters
  622. as well as in result rows.
  623. """
  624. return exclusions.open()
  625. @property
  626. def unicode_ddl(self):
  627. """Target driver must support some degree of non-ascii symbol
  628. names.
  629. """
  630. return exclusions.closed()
  631. @property
  632. def symbol_names_w_double_quote(self):
  633. """Target driver can create tables with a name like 'some " table'"""
  634. return exclusions.open()
  635. @property
  636. def datetime_interval(self):
  637. """target dialect supports rendering of a datetime.timedelta as a
  638. literal string, e.g. via the TypeEngine.literal_processor() method.
  639. """
  640. return exclusions.closed()
  641. @property
  642. def datetime_literals(self):
  643. """target dialect supports rendering of a date, time, or datetime as a
  644. literal string, e.g. via the TypeEngine.literal_processor() method.
  645. """
  646. return exclusions.closed()
  647. @property
  648. def datetime(self):
  649. """target dialect supports representation of Python
  650. datetime.datetime() objects."""
  651. return exclusions.open()
  652. @property
  653. def datetime_timezone(self):
  654. """target dialect supports representation of Python
  655. datetime.datetime() with tzinfo with DateTime(timezone=True)."""
  656. return exclusions.closed()
  657. @property
  658. def time_timezone(self):
  659. """target dialect supports representation of Python
  660. datetime.time() with tzinfo with Time(timezone=True)."""
  661. return exclusions.closed()
  662. @property
  663. def date_implicit_bound(self):
  664. """target dialect when given a date object will bind it such
  665. that the database server knows the object is a date, and not
  666. a plain string.
  667. """
  668. return exclusions.open()
  669. @property
  670. def time_implicit_bound(self):
  671. """target dialect when given a time object will bind it such
  672. that the database server knows the object is a time, and not
  673. a plain string.
  674. """
  675. return exclusions.open()
  676. @property
  677. def datetime_implicit_bound(self):
  678. """target dialect when given a datetime object will bind it such
  679. that the database server knows the object is a datetime, and not
  680. a plain string.
  681. """
  682. return exclusions.open()
  683. @property
  684. def datetime_microseconds(self):
  685. """target dialect supports representation of Python
  686. datetime.datetime() with microsecond objects."""
  687. return exclusions.open()
  688. @property
  689. def timestamp_microseconds(self):
  690. """target dialect supports representation of Python
  691. datetime.datetime() with microsecond objects but only
  692. if TIMESTAMP is used."""
  693. return exclusions.closed()
  694. @property
  695. def timestamp_microseconds_implicit_bound(self):
  696. """target dialect when given a datetime object which also includes
  697. a microseconds portion when using the TIMESTAMP data type
  698. will bind it such that the database server knows
  699. the object is a datetime with microseconds, and not a plain string.
  700. """
  701. return self.timestamp_microseconds
  702. @property
  703. def datetime_historic(self):
  704. """target dialect supports representation of Python
  705. datetime.datetime() objects with historic (pre 1970) values."""
  706. return exclusions.closed()
  707. @property
  708. def date(self):
  709. """target dialect supports representation of Python
  710. datetime.date() objects."""
  711. return exclusions.open()
  712. @property
  713. def date_coerces_from_datetime(self):
  714. """target dialect accepts a datetime object as the target
  715. of a date column."""
  716. return exclusions.open()
  717. @property
  718. def date_historic(self):
  719. """target dialect supports representation of Python
  720. datetime.datetime() objects with historic (pre 1970) values."""
  721. return exclusions.closed()
  722. @property
  723. def time(self):
  724. """target dialect supports representation of Python
  725. datetime.time() objects."""
  726. return exclusions.open()
  727. @property
  728. def time_microseconds(self):
  729. """target dialect supports representation of Python
  730. datetime.time() with microsecond objects."""
  731. return exclusions.open()
  732. @property
  733. def binary_comparisons(self):
  734. """target database/driver can allow BLOB/BINARY fields to be compared
  735. against a bound parameter value.
  736. """
  737. return exclusions.open()
  738. @property
  739. def binary_literals(self):
  740. """target backend supports simple binary literals, e.g. an
  741. expression like::
  742. SELECT CAST('foo' AS BINARY)
  743. Where ``BINARY`` is the type emitted from :class:`.LargeBinary`,
  744. e.g. it could be ``BLOB`` or similar.
  745. Basically fails on Oracle.
  746. """
  747. return exclusions.open()
  748. @property
  749. def autocommit(self):
  750. """target dialect supports 'AUTOCOMMIT' as an isolation_level"""
  751. return exclusions.closed()
  752. @property
  753. def isolation_level(self):
  754. """target dialect supports general isolation level settings.
  755. Note that this requirement, when enabled, also requires that
  756. the get_isolation_levels() method be implemented.
  757. """
  758. return exclusions.closed()
  759. def get_isolation_levels(self, config):
  760. """Return a structure of supported isolation levels for the current
  761. testing dialect.
  762. The structure indicates to the testing suite what the expected
  763. "default" isolation should be, as well as the other values that
  764. are accepted. The dictionary has two keys, "default" and "supported".
  765. The "supported" key refers to a list of all supported levels and
  766. it should include AUTOCOMMIT if the dialect supports it.
  767. If the :meth:`.DefaultRequirements.isolation_level` requirement is
  768. not open, then this method has no return value.
  769. E.g.::
  770. >>> testing.requirements.get_isolation_levels()
  771. {
  772. "default": "READ_COMMITTED",
  773. "supported": [
  774. "SERIALIZABLE", "READ UNCOMMITTED",
  775. "READ COMMITTED", "REPEATABLE READ",
  776. "AUTOCOMMIT"
  777. ]
  778. }
  779. """
  780. with config.db.connect() as conn:
  781. try:
  782. supported = conn.dialect.get_isolation_level_values(
  783. conn.connection.dbapi_connection
  784. )
  785. except NotImplementedError:
  786. return None
  787. else:
  788. return {
  789. "default": conn.dialect.default_isolation_level,
  790. "supported": supported,
  791. }
  792. @property
  793. def get_isolation_level_values(self):
  794. """target dialect supports the
  795. :meth:`_engine.Dialect.get_isolation_level_values`
  796. method added in SQLAlchemy 2.0.
  797. """
  798. def go(config):
  799. with config.db.connect() as conn:
  800. try:
  801. conn.dialect.get_isolation_level_values(
  802. conn.connection.dbapi_connection
  803. )
  804. except NotImplementedError:
  805. return False
  806. else:
  807. return True
  808. return exclusions.only_if(go)
  809. @property
  810. def dialect_level_isolation_level_param(self):
  811. """test that the dialect allows the 'isolation_level' argument
  812. to be handled by DefaultDialect"""
  813. def go(config):
  814. try:
  815. e = create_engine(
  816. config.db.url, isolation_level="READ COMMITTED"
  817. )
  818. except:
  819. return False
  820. else:
  821. return (
  822. e.dialect._on_connect_isolation_level == "READ COMMITTED"
  823. )
  824. return exclusions.only_if(go)
  825. @property
  826. def json_type(self):
  827. """target platform implements a native JSON type."""
  828. return exclusions.closed()
  829. @property
  830. def json_array_indexes(self):
  831. """target platform supports numeric array indexes
  832. within a JSON structure"""
  833. return self.json_type
  834. @property
  835. def json_index_supplementary_unicode_element(self):
  836. return exclusions.open()
  837. @property
  838. def legacy_unconditional_json_extract(self):
  839. """Backend has a JSON_EXTRACT or similar function that returns a
  840. valid JSON string in all cases.
  841. Used to test a legacy feature and is not needed.
  842. """
  843. return exclusions.closed()
  844. @property
  845. def precision_numerics_general(self):
  846. """target backend has general support for moderately high-precision
  847. numerics."""
  848. return exclusions.open()
  849. @property
  850. def precision_numerics_enotation_small(self):
  851. """target backend supports Decimal() objects using E notation
  852. to represent very small values."""
  853. return exclusions.closed()
  854. @property
  855. def precision_numerics_enotation_large(self):
  856. """target backend supports Decimal() objects using E notation
  857. to represent very large values."""
  858. return exclusions.open()
  859. @property
  860. def precision_numerics_many_significant_digits(self):
  861. """target backend supports values with many digits on both sides,
  862. such as 319438950232418390.273596, 87673.594069654243
  863. """
  864. return exclusions.closed()
  865. @property
  866. def cast_precision_numerics_many_significant_digits(self):
  867. """same as precision_numerics_many_significant_digits but within the
  868. context of a CAST statement (hello MySQL)
  869. """
  870. return self.precision_numerics_many_significant_digits
  871. @property
  872. def implicit_decimal_binds(self):
  873. """target backend will return a selected Decimal as a Decimal, not
  874. a string.
  875. e.g.::
  876. expr = decimal.Decimal("15.7563")
  877. value = e.scalar(
  878. select(literal(expr))
  879. )
  880. assert value == expr
  881. See :ticket:`4036`
  882. """
  883. return exclusions.open()
  884. @property
  885. def numeric_received_as_decimal_untyped(self):
  886. """target backend will return result columns that are explicitly
  887. against NUMERIC or similar precision-numeric datatypes (not including
  888. FLOAT or INT types) as Python Decimal objects, and not as floats
  889. or ints, including when no SQLAlchemy-side typing information is
  890. associated with the statement (e.g. such as a raw SQL string).
  891. This should be enabled if either the DBAPI itself returns Decimal
  892. objects, or if the dialect has set up DBAPI-specific return type
  893. handlers such that Decimal objects come back automatically.
  894. """
  895. return exclusions.open()
  896. @property
  897. def nested_aggregates(self):
  898. """target database can select an aggregate from a subquery that's
  899. also using an aggregate
  900. """
  901. return exclusions.open()
  902. @property
  903. def recursive_fk_cascade(self):
  904. """target database must support ON DELETE CASCADE on a self-referential
  905. foreign key
  906. """
  907. return exclusions.open()
  908. @property
  909. def precision_numerics_retains_significant_digits(self):
  910. """A precision numeric type will return empty significant digits,
  911. i.e. a value such as 10.000 will come back in Decimal form with
  912. the .000 maintained."""
  913. return exclusions.closed()
  914. @property
  915. def infinity_floats(self):
  916. """The Float type can persist and load float('inf'), float('-inf')."""
  917. return exclusions.closed()
  918. @property
  919. def float_or_double_precision_behaves_generically(self):
  920. return exclusions.closed()
  921. @property
  922. def precision_generic_float_type(self):
  923. """target backend will return native floating point numbers with at
  924. least seven decimal places when using the generic Float type.
  925. """
  926. return exclusions.open()
  927. @property
  928. def literal_float_coercion(self):
  929. """target backend will return the exact float value 15.7563
  930. with only four significant digits from this statement:
  931. SELECT :param
  932. where :param is the Python float 15.7563
  933. i.e. it does not return 15.75629997253418
  934. """
  935. return exclusions.open()
  936. @property
  937. def floats_to_four_decimals(self):
  938. """target backend can return a floating-point number with four
  939. significant digits (such as 15.7563) accurately
  940. (i.e. without FP inaccuracies, such as 15.75629997253418).
  941. """
  942. return exclusions.open()
  943. @property
  944. def fetch_null_from_numeric(self):
  945. """target backend doesn't crash when you try to select a NUMERIC
  946. value that has a value of NULL.
  947. Added to support Pyodbc bug #351.
  948. """
  949. return exclusions.open()
  950. @property
  951. def float_is_numeric(self):
  952. """target backend uses Numeric for Float/Dual"""
  953. return exclusions.open()
  954. @property
  955. def text_type(self):
  956. """Target database must support an unbounded Text() "
  957. "type such as TEXT or CLOB"""
  958. return exclusions.open()
  959. @property
  960. def empty_strings_varchar(self):
  961. """target database can persist/return an empty string with a
  962. varchar.
  963. """
  964. return exclusions.open()
  965. @property
  966. def empty_strings_text(self):
  967. """target database can persist/return an empty string with an
  968. unbounded text."""
  969. return exclusions.open()
  970. @property
  971. def expressions_against_unbounded_text(self):
  972. """target database supports use of an unbounded textual field in a
  973. WHERE clause."""
  974. return exclusions.open()
  975. @property
  976. def selectone(self):
  977. """target driver must support the literal statement 'select 1'"""
  978. return exclusions.open()
  979. @property
  980. def savepoints(self):
  981. """Target database must support savepoints."""
  982. return exclusions.closed()
  983. @property
  984. def two_phase_transactions(self):
  985. """Target database must support two-phase transactions."""
  986. return exclusions.closed()
  987. @property
  988. def update_from(self):
  989. """Target must support UPDATE..FROM syntax"""
  990. return exclusions.closed()
  991. @property
  992. def delete_from(self):
  993. """Target must support DELETE FROM..FROM or DELETE..USING syntax"""
  994. return exclusions.closed()
  995. @property
  996. def update_where_target_in_subquery(self):
  997. """Target must support UPDATE (or DELETE) where the same table is
  998. present in a subquery in the WHERE clause.
  999. This is an ANSI-standard syntax that apparently MySQL can't handle,
  1000. such as::
  1001. UPDATE documents SET flag=1 WHERE documents.title IN
  1002. (SELECT max(documents.title) AS title
  1003. FROM documents GROUP BY documents.user_id
  1004. )
  1005. """
  1006. return exclusions.open()
  1007. @property
  1008. def mod_operator_as_percent_sign(self):
  1009. """target database must use a plain percent '%' as the 'modulus'
  1010. operator."""
  1011. return exclusions.closed()
  1012. @property
  1013. def percent_schema_names(self):
  1014. """target backend supports weird identifiers with percent signs
  1015. in them, e.g. 'some % column'.
  1016. this is a very weird use case but often has problems because of
  1017. DBAPIs that use python formatting. It's not a critical use
  1018. case either.
  1019. """
  1020. return exclusions.closed()
  1021. @property
  1022. def order_by_col_from_union(self):
  1023. """target database supports ordering by a column from a SELECT
  1024. inside of a UNION
  1025. E.g. (SELECT id, ...) UNION (SELECT id, ...) ORDER BY id
  1026. """
  1027. return exclusions.open()
  1028. @property
  1029. def order_by_label_with_expression(self):
  1030. """target backend supports ORDER BY a column label within an
  1031. expression.
  1032. Basically this::
  1033. select data as foo from test order by foo || 'bar'
  1034. Lots of databases including PostgreSQL don't support this,
  1035. so this is off by default.
  1036. """
  1037. return exclusions.closed()
  1038. @property
  1039. def order_by_collation(self):
  1040. def check(config):
  1041. try:
  1042. self.get_order_by_collation(config)
  1043. return False
  1044. except NotImplementedError:
  1045. return True
  1046. return exclusions.skip_if(check)
  1047. def get_order_by_collation(self, config):
  1048. raise NotImplementedError()
  1049. @property
  1050. def unicode_connections(self):
  1051. """Target driver must support non-ASCII characters being passed at
  1052. all.
  1053. """
  1054. return exclusions.open()
  1055. @property
  1056. def graceful_disconnects(self):
  1057. """Target driver must raise a DBAPI-level exception, such as
  1058. InterfaceError, when the underlying connection has been closed
  1059. and the execute() method is called.
  1060. """
  1061. return exclusions.open()
  1062. @property
  1063. def independent_connections(self):
  1064. """
  1065. Target must support simultaneous, independent database connections.
  1066. """
  1067. return exclusions.open()
  1068. @property
  1069. def independent_readonly_connections(self):
  1070. """
  1071. Target must support simultaneous, independent database connections
  1072. that will be used in a readonly fashion.
  1073. """
  1074. return exclusions.open()
  1075. @property
  1076. def skip_mysql_on_windows(self):
  1077. """Catchall for a large variety of MySQL on Windows failures"""
  1078. return exclusions.open()
  1079. @property
  1080. def ad_hoc_engines(self):
  1081. """Test environment must allow ad-hoc engine/connection creation.
  1082. DBs that scale poorly for many connections, even when closed, i.e.
  1083. Oracle, may use the "--low-connections" option which flags this
  1084. requirement as not present.
  1085. """
  1086. return exclusions.skip_if(
  1087. lambda config: config.options.low_connections
  1088. )
  1089. @property
  1090. def no_windows(self):
  1091. return exclusions.skip_if(self._running_on_windows())
  1092. def _running_on_windows(self):
  1093. return exclusions.LambdaPredicate(
  1094. lambda: platform.system() == "Windows",
  1095. description="running on Windows",
  1096. )
  1097. @property
  1098. def timing_intensive(self):
  1099. from . import config
  1100. return config.add_to_marker.timing_intensive
  1101. @property
  1102. def memory_intensive(self):
  1103. from . import config
  1104. return config.add_to_marker.memory_intensive
  1105. @property
  1106. def threading_with_mock(self):
  1107. """Mark tests that use threading and mock at the same time - stability
  1108. issues have been observed with coverage
  1109. """
  1110. return exclusions.skip_if(
  1111. lambda config: config.options.has_coverage,
  1112. "Stability issues with coverage",
  1113. )
  1114. @property
  1115. def sqlalchemy2_stubs(self):
  1116. def check(config):
  1117. try:
  1118. __import__("sqlalchemy-stubs.ext.mypy")
  1119. except ImportError:
  1120. return False
  1121. else:
  1122. return True
  1123. return exclusions.only_if(check)
  1124. @property
  1125. def no_sqlalchemy2_stubs(self):
  1126. def check(config):
  1127. try:
  1128. __import__("sqlalchemy-stubs.ext.mypy")
  1129. except ImportError:
  1130. return False
  1131. else:
  1132. return True
  1133. return exclusions.skip_if(check)
  1134. @property
  1135. def python38(self):
  1136. return exclusions.only_if(
  1137. lambda: util.py38, "Python 3.8 or above required"
  1138. )
  1139. @property
  1140. def python39(self):
  1141. return exclusions.only_if(
  1142. lambda: util.py39, "Python 3.9 or above required"
  1143. )
  1144. @property
  1145. def python310(self):
  1146. return exclusions.only_if(
  1147. lambda: util.py310, "Python 3.10 or above required"
  1148. )
  1149. @property
  1150. def python311(self):
  1151. return exclusions.only_if(
  1152. lambda: util.py311, "Python 3.11 or above required"
  1153. )
  1154. @property
  1155. def python312(self):
  1156. return exclusions.only_if(
  1157. lambda: util.py312, "Python 3.12 or above required"
  1158. )
  1159. @property
  1160. def cpython(self):
  1161. return exclusions.only_if(
  1162. lambda: util.cpython, "cPython interpreter needed"
  1163. )
  1164. @property
  1165. def is64bit(self):
  1166. return exclusions.only_if(lambda: util.is64bit, "64bit required")
  1167. @property
  1168. def patch_library(self):
  1169. def check_lib():
  1170. try:
  1171. __import__("patch")
  1172. except ImportError:
  1173. return False
  1174. else:
  1175. return True
  1176. return exclusions.only_if(check_lib, "patch library needed")
  1177. @property
  1178. def predictable_gc(self):
  1179. """target platform must remove all cycles unconditionally when
  1180. gc.collect() is called, as well as clean out unreferenced subclasses.
  1181. """
  1182. return self.cpython
  1183. @property
  1184. def no_coverage(self):
  1185. """Test should be skipped if coverage is enabled.
  1186. This is to block tests that exercise libraries that seem to be
  1187. sensitive to coverage, such as PostgreSQL notice logging.
  1188. """
  1189. return exclusions.skip_if(
  1190. lambda config: config.options.has_coverage,
  1191. "Issues observed when coverage is enabled",
  1192. )
  1193. def _has_mysql_on_windows(self, config):
  1194. return False
  1195. def _has_mysql_fully_case_sensitive(self, config):
  1196. return False
  1197. @property
  1198. def sqlite(self):
  1199. return exclusions.skip_if(lambda: not self._has_sqlite())
  1200. @property
  1201. def cextensions(self):
  1202. return exclusions.skip_if(
  1203. lambda: not util.has_compiled_ext(),
  1204. "Cython extensions not installed",
  1205. )
  1206. def _has_sqlite(self):
  1207. from sqlalchemy import create_engine
  1208. try:
  1209. create_engine("sqlite://")
  1210. return True
  1211. except ImportError:
  1212. return False
  1213. @property
  1214. def async_dialect(self):
  1215. """dialect makes use of await_() to invoke operations on the DBAPI."""
  1216. return exclusions.closed()
  1217. @property
  1218. def asyncio(self):
  1219. return self.greenlet
  1220. @property
  1221. def no_greenlet(self):
  1222. def go(config):
  1223. try:
  1224. import greenlet # noqa: F401
  1225. except ImportError:
  1226. return True
  1227. else:
  1228. return False
  1229. return exclusions.only_if(go)
  1230. @property
  1231. def greenlet(self):
  1232. def go(config):
  1233. if not _test_asyncio.ENABLE_ASYNCIO:
  1234. return False
  1235. try:
  1236. import greenlet # noqa: F401
  1237. except ImportError:
  1238. return False
  1239. else:
  1240. return True
  1241. return exclusions.only_if(go)
  1242. @property
  1243. def computed_columns(self):
  1244. "Supports computed columns"
  1245. return exclusions.closed()
  1246. @property
  1247. def computed_columns_stored(self):
  1248. "Supports computed columns with `persisted=True`"
  1249. return exclusions.closed()
  1250. @property
  1251. def computed_columns_virtual(self):
  1252. "Supports computed columns with `persisted=False`"
  1253. return exclusions.closed()
  1254. @property
  1255. def computed_columns_default_persisted(self):
  1256. """If the default persistence is virtual or stored when `persisted`
  1257. is omitted"""
  1258. return exclusions.closed()
  1259. @property
  1260. def computed_columns_reflect_persisted(self):
  1261. """If persistence information is returned by the reflection of
  1262. computed columns"""
  1263. return exclusions.closed()
  1264. @property
  1265. def supports_distinct_on(self):
  1266. """If a backend supports the DISTINCT ON in a select"""
  1267. return exclusions.closed()
  1268. @property
  1269. def supports_is_distinct_from(self):
  1270. """Supports some form of "x IS [NOT] DISTINCT FROM y" construct.
  1271. Different dialects will implement their own flavour, e.g.,
  1272. sqlite will emit "x IS NOT y" instead of "x IS DISTINCT FROM y".
  1273. .. seealso::
  1274. :meth:`.ColumnOperators.is_distinct_from`
  1275. """
  1276. return exclusions.skip_if(
  1277. lambda config: not config.db.dialect.supports_is_distinct_from,
  1278. "driver doesn't support an IS DISTINCT FROM construct",
  1279. )
  1280. @property
  1281. def identity_columns(self):
  1282. """If a backend supports GENERATED { ALWAYS | BY DEFAULT }
  1283. AS IDENTITY"""
  1284. return exclusions.closed()
  1285. @property
  1286. def identity_columns_standard(self):
  1287. """If a backend supports GENERATED { ALWAYS | BY DEFAULT }
  1288. AS IDENTITY with a standard syntax.
  1289. This is mainly to exclude MSSql.
  1290. """
  1291. return exclusions.closed()
  1292. @property
  1293. def regexp_match(self):
  1294. """backend supports the regexp_match operator."""
  1295. return exclusions.closed()
  1296. @property
  1297. def regexp_replace(self):
  1298. """backend supports the regexp_replace operator."""
  1299. return exclusions.closed()
  1300. @property
  1301. def fetch_first(self):
  1302. """backend supports the fetch first clause."""
  1303. return exclusions.closed()
  1304. @property
  1305. def fetch_percent(self):
  1306. """backend supports the fetch first clause with percent."""
  1307. return exclusions.closed()
  1308. @property
  1309. def fetch_ties(self):
  1310. """backend supports the fetch first clause with ties."""
  1311. return exclusions.closed()
  1312. @property
  1313. def fetch_no_order_by(self):
  1314. """backend supports the fetch first without order by"""
  1315. return exclusions.closed()
  1316. @property
  1317. def fetch_offset_with_options(self):
  1318. """backend supports the offset when using fetch first with percent
  1319. or ties. basically this is "not mssql"
  1320. """
  1321. return exclusions.closed()
  1322. @property
  1323. def fetch_expression(self):
  1324. """backend supports fetch / offset with expression in them, like
  1325. SELECT * FROM some_table
  1326. OFFSET 1 + 1 ROWS FETCH FIRST 1 + 1 ROWS ONLY
  1327. """
  1328. return exclusions.closed()
  1329. @property
  1330. def autoincrement_without_sequence(self):
  1331. """If autoincrement=True on a column does not require an explicit
  1332. sequence. This should be false only for oracle.
  1333. """
  1334. return exclusions.open()
  1335. @property
  1336. def generic_classes(self):
  1337. "If X[Y] can be implemented with ``__class_getitem__``. py3.7+"
  1338. return exclusions.open()
  1339. @property
  1340. def json_deserializer_binary(self):
  1341. "indicates if the json_deserializer function is called with bytes"
  1342. return exclusions.closed()
  1343. @property
  1344. def reflect_table_options(self):
  1345. """Target database must support reflecting table_options."""
  1346. return exclusions.closed()
  1347. @property
  1348. def materialized_views(self):
  1349. """Target database must support MATERIALIZED VIEWs."""
  1350. return exclusions.closed()
  1351. @property
  1352. def materialized_views_reflect_pk(self):
  1353. """Target database reflect MATERIALIZED VIEWs pks."""
  1354. return exclusions.closed()