requirements.py 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551
  1. """Requirements specific to SQLAlchemy's own unit tests.
  2. """
  3. import sys
  4. from sqlalchemy import exc
  5. from sqlalchemy import util
  6. from sqlalchemy.sql import text
  7. from sqlalchemy.testing import exclusions
  8. from sqlalchemy.testing.exclusions import against
  9. from sqlalchemy.testing.exclusions import fails_if
  10. from sqlalchemy.testing.exclusions import fails_on
  11. from sqlalchemy.testing.exclusions import fails_on_everything_except
  12. from sqlalchemy.testing.exclusions import LambdaPredicate
  13. from sqlalchemy.testing.exclusions import NotPredicate
  14. from sqlalchemy.testing.exclusions import only_if
  15. from sqlalchemy.testing.exclusions import only_on
  16. from sqlalchemy.testing.exclusions import skip_if
  17. from sqlalchemy.testing.exclusions import SpecPredicate
  18. from sqlalchemy.testing.exclusions import succeeds_if
  19. from sqlalchemy.testing.requirements import SuiteRequirements
  20. def no_support(db, reason):
  21. return SpecPredicate(db, description=reason)
  22. def exclude(db, op, spec, description=None):
  23. return SpecPredicate(db, op, spec, description=description)
  24. class DefaultRequirements(SuiteRequirements):
  25. @property
  26. def deferrable_or_no_constraints(self):
  27. """Target database must support deferrable constraints."""
  28. return skip_if(
  29. [
  30. no_support("firebird", "not supported by database"),
  31. no_support("mysql", "not supported by database"),
  32. no_support("mssql", "not supported by database"),
  33. ]
  34. )
  35. @property
  36. def check_constraints(self):
  37. """Target database must support check constraints."""
  38. return exclusions.open()
  39. @property
  40. def enforces_check_constraints(self):
  41. """Target database must also enforce check constraints."""
  42. return self.check_constraints + fails_on(
  43. self._mysql_check_constraints_dont_exist,
  44. "check constraints don't enforce on MySQL, MariaDB<10.2",
  45. )
  46. @property
  47. def named_constraints(self):
  48. """target database must support names for constraints."""
  49. return exclusions.open()
  50. @property
  51. def implicitly_named_constraints(self):
  52. """target database must apply names to unnamed constraints."""
  53. return skip_if([no_support("sqlite", "not supported by database")])
  54. @property
  55. def foreign_keys(self):
  56. """Target database must support foreign keys."""
  57. return skip_if(no_support("sqlite", "not supported by database"))
  58. @property
  59. def on_update_cascade(self):
  60. """target database must support ON UPDATE..CASCADE behavior in
  61. foreign keys."""
  62. return skip_if(
  63. ["sqlite", "oracle"],
  64. "target backend %(doesnt_support)s ON UPDATE CASCADE",
  65. )
  66. @property
  67. def non_updating_cascade(self):
  68. """target database must *not* support ON UPDATE..CASCADE behavior in
  69. foreign keys."""
  70. return fails_on_everything_except(
  71. "sqlite", "oracle", "+zxjdbc"
  72. ) + skip_if("mssql")
  73. @property
  74. def recursive_fk_cascade(self):
  75. """target database must support ON DELETE CASCADE on a self-referential
  76. foreign key"""
  77. return skip_if(["mssql"])
  78. @property
  79. def deferrable_fks(self):
  80. """target database must support deferrable fks"""
  81. return only_on(["oracle"])
  82. @property
  83. def foreign_key_constraint_option_reflection_ondelete(self):
  84. return only_on(["postgresql", "mysql", "sqlite", "oracle"])
  85. @property
  86. def foreign_key_constraint_option_reflection_onupdate(self):
  87. return only_on(["postgresql", "mysql", "sqlite"])
  88. @property
  89. def comment_reflection(self):
  90. return only_on(["postgresql", "mysql", "oracle"])
  91. @property
  92. def unbounded_varchar(self):
  93. """Target database must support VARCHAR with no length"""
  94. return skip_if(
  95. ["firebird", "oracle", "mysql"], "not supported by database"
  96. )
  97. @property
  98. def boolean_col_expressions(self):
  99. """Target database must support boolean expressions as columns"""
  100. return skip_if(
  101. [
  102. no_support("firebird", "not supported by database"),
  103. no_support("oracle", "not supported by database"),
  104. no_support("mssql", "not supported by database"),
  105. no_support("sybase", "not supported by database"),
  106. ]
  107. )
  108. @property
  109. def non_native_boolean_unconstrained(self):
  110. """target database is not native boolean and allows arbitrary integers
  111. in it's "bool" column"""
  112. return skip_if(
  113. [
  114. LambdaPredicate(
  115. lambda config: against(config, "mssql"),
  116. "SQL Server drivers / odbc seem to change "
  117. "their mind on this",
  118. ),
  119. LambdaPredicate(
  120. lambda config: config.db.dialect.supports_native_boolean,
  121. "native boolean dialect",
  122. ),
  123. ]
  124. )
  125. @property
  126. def standalone_binds(self):
  127. """target database/driver supports bound parameters as column expressions
  128. without being in the context of a typed column.
  129. """
  130. return skip_if(["firebird", "mssql+mxodbc"], "not supported by driver")
  131. @property
  132. def no_quoting_special_bind_names(self):
  133. """Target database will quote bound parameter names, doesn't support
  134. EXPANDING"""
  135. return skip_if(["oracle"])
  136. @property
  137. def identity(self):
  138. """Target database must support GENERATED AS IDENTITY or a facsimile.
  139. Includes GENERATED AS IDENTITY, AUTOINCREMENT, AUTO_INCREMENT, or other
  140. column DDL feature that fills in a DB-generated identifier at
  141. INSERT-time without requiring pre-execution of a SEQUENCE or other
  142. artifact.
  143. """
  144. return skip_if(
  145. ["firebird", "oracle", "postgresql", "sybase"],
  146. "not supported by database",
  147. )
  148. @property
  149. def temporary_tables(self):
  150. """target database supports temporary tables"""
  151. return skip_if(
  152. ["mssql", "firebird", self._sqlite_file_db], "not supported (?)"
  153. )
  154. @property
  155. def temp_table_reflection(self):
  156. return self.temporary_tables
  157. @property
  158. def reflectable_autoincrement(self):
  159. """Target database must support tables that can automatically generate
  160. PKs assuming they were reflected.
  161. this is essentially all the DBs in "identity" plus PostgreSQL, which
  162. has SERIAL support. FB and Oracle (and sybase?) require the Sequence
  163. to be explicitly added, including if the table was reflected.
  164. """
  165. return skip_if(
  166. ["firebird", "oracle", "sybase"], "not supported by database"
  167. )
  168. @property
  169. def insert_from_select(self):
  170. return skip_if(["firebird"], "crashes for unknown reason")
  171. @property
  172. def fetch_rows_post_commit(self):
  173. return skip_if(["firebird"], "not supported")
  174. @property
  175. def non_broken_binary(self):
  176. """target DBAPI must work fully with binary values"""
  177. # see https://github.com/pymssql/pymssql/issues/504
  178. return skip_if(["mssql+pymssql"])
  179. @property
  180. def binary_comparisons(self):
  181. """target database/driver can allow BLOB/BINARY fields to be compared
  182. against a bound parameter value.
  183. """
  184. return skip_if(["oracle", "mssql"], "not supported by database/driver")
  185. @property
  186. def binary_literals(self):
  187. """target backend supports simple binary literals, e.g. an
  188. expression like::
  189. SELECT CAST('foo' AS BINARY)
  190. Where ``BINARY`` is the type emitted from :class:`.LargeBinary`,
  191. e.g. it could be ``BLOB`` or similar.
  192. Basically fails on Oracle.
  193. """
  194. # adding mssql here since it doesn't support comparisons either,
  195. # have observed generally bad behavior with binary / mssql.
  196. return skip_if(["oracle", "mssql"], "not supported by database/driver")
  197. @property
  198. def tuple_in(self):
  199. def _sqlite_tuple_in(config):
  200. return against(
  201. config, "sqlite"
  202. ) and config.db.dialect.dbapi.sqlite_version_info >= (3, 15, 0)
  203. return only_on(["mysql", "postgresql", _sqlite_tuple_in])
  204. @property
  205. def independent_cursors(self):
  206. """Target must support simultaneous, independent database cursors
  207. on a single connection."""
  208. return skip_if(["mssql", "mysql"], "no driver support")
  209. @property
  210. def independent_connections(self):
  211. """
  212. Target must support simultaneous, independent database connections.
  213. """
  214. # This is also true of some configurations of UnixODBC and probably
  215. # win32 ODBC as well.
  216. return skip_if(
  217. [
  218. no_support(
  219. "sqlite",
  220. "independent connections disabled "
  221. "when :memory: connections are used",
  222. ),
  223. exclude(
  224. "mssql",
  225. "<",
  226. (9, 0, 0),
  227. "SQL Server 2005+ is required for "
  228. "independent connections",
  229. ),
  230. ]
  231. )
  232. @property
  233. def memory_process_intensive(self):
  234. """Driver is able to handle the memory tests which run in a subprocess
  235. and iterate through hundreds of connections
  236. """
  237. return skip_if(
  238. [
  239. no_support("oracle", "Oracle XE usually can't handle these"),
  240. no_support("mssql+pyodbc", "MS ODBC drivers struggle"),
  241. ]
  242. )
  243. @property
  244. def updateable_autoincrement_pks(self):
  245. """Target must support UPDATE on autoincrement/integer primary key."""
  246. return skip_if(
  247. ["mssql", "sybase"], "IDENTITY columns can't be updated"
  248. )
  249. @property
  250. def isolation_level(self):
  251. return only_on(
  252. ("postgresql", "sqlite", "mysql", "mssql", "oracle"),
  253. "DBAPI has no isolation level support",
  254. ) + fails_on(
  255. "postgresql+pypostgresql",
  256. "pypostgresql bombs on multiple isolation level calls",
  257. )
  258. def get_isolation_levels(self, config):
  259. levels = set(config.db.dialect._isolation_lookup)
  260. if against(config, "sqlite"):
  261. default = "SERIALIZABLE"
  262. levels.add("AUTOCOMMIT")
  263. elif against(config, "postgresql"):
  264. default = "READ COMMITTED"
  265. levels.add("AUTOCOMMIT")
  266. elif against(config, "mysql"):
  267. default = "REPEATABLE READ"
  268. levels.add("AUTOCOMMIT")
  269. elif against(config, "mssql"):
  270. default = "READ COMMITTED"
  271. levels.add("AUTOCOMMIT")
  272. elif against(config, "oracle"):
  273. default = "READ COMMITTED"
  274. levels.add("AUTOCOMMIT")
  275. else:
  276. raise NotImplementedError()
  277. return {"default": default, "supported": levels}
  278. @property
  279. def autocommit(self):
  280. """target dialect supports 'AUTOCOMMIT' as an isolation_level"""
  281. return self.isolation_level + only_if(
  282. lambda config: "AUTOCOMMIT"
  283. in self.get_isolation_levels(config)["supported"]
  284. )
  285. @property
  286. def row_triggers(self):
  287. """Target must support standard statement-running EACH ROW triggers."""
  288. return skip_if(
  289. [
  290. # no access to same table
  291. no_support("mysql", "requires SUPER priv"),
  292. exclude("mysql", "<", (5, 0, 10), "not supported by database"),
  293. # huh? TODO: implement triggers for PG tests, remove this
  294. no_support(
  295. "postgresql",
  296. "PG triggers need to be implemented for tests",
  297. ),
  298. ]
  299. )
  300. @property
  301. def sequences_as_server_defaults(self):
  302. """Target database must support SEQUENCE as a server side default."""
  303. return only_on(
  304. "postgresql", "doesn't support sequences as a server side default."
  305. )
  306. @property
  307. def sql_expressions_inserted_as_primary_key(self):
  308. return only_if([self.returning, self.sqlite])
  309. @property
  310. def computed_columns_on_update_returning(self):
  311. return self.computed_columns + skip_if("oracle")
  312. @property
  313. def correlated_outer_joins(self):
  314. """Target must support an outer join to a subquery which
  315. correlates to the parent."""
  316. return skip_if(
  317. "oracle",
  318. 'Raises "ORA-01799: a column may not be '
  319. 'outer-joined to a subquery"',
  320. )
  321. @property
  322. def update_from(self):
  323. """Target must support UPDATE..FROM syntax"""
  324. return only_on(
  325. ["postgresql", "mssql", "mysql"],
  326. "Backend does not support UPDATE..FROM",
  327. )
  328. @property
  329. def delete_from(self):
  330. """Target must support DELETE FROM..FROM or DELETE..USING syntax"""
  331. return only_on(
  332. ["postgresql", "mssql", "mysql", "sybase"],
  333. "Backend does not support DELETE..FROM",
  334. )
  335. @property
  336. def update_where_target_in_subquery(self):
  337. """Target must support UPDATE (or DELETE) where the same table is
  338. present in a subquery in the WHERE clause.
  339. This is an ANSI-standard syntax that apparently MySQL can't handle,
  340. such as::
  341. UPDATE documents SET flag=1 WHERE documents.title IN
  342. (SELECT max(documents.title) AS title
  343. FROM documents GROUP BY documents.user_id
  344. )
  345. """
  346. return fails_if(
  347. self._mysql_not_mariadb_103,
  348. 'MySQL error 1093 "Cant specify target table '
  349. 'for update in FROM clause", resolved by MariaDB 10.3',
  350. )
  351. @property
  352. def savepoints(self):
  353. """Target database must support savepoints."""
  354. return skip_if(
  355. ["sqlite", "sybase", ("mysql", "<", (5, 0, 3))],
  356. "savepoints not supported",
  357. )
  358. @property
  359. def savepoints_w_release(self):
  360. return self.savepoints + skip_if(
  361. ["oracle", "mssql"],
  362. "database doesn't support release of savepoint",
  363. )
  364. @property
  365. def schemas(self):
  366. """Target database must support external schemas, and have one
  367. named 'test_schema'."""
  368. return skip_if(["firebird"], "no schema support")
  369. @property
  370. def cross_schema_fk_reflection(self):
  371. """target system must support reflection of inter-schema foreign keys
  372. """
  373. return only_on(["postgresql", "mysql", "mssql"])
  374. @property
  375. def implicit_default_schema(self):
  376. """target system has a strong concept of 'default' schema that can
  377. be referred to implicitly.
  378. basically, PostgreSQL.
  379. """
  380. return only_on(["postgresql"])
  381. @property
  382. def unique_constraint_reflection(self):
  383. return fails_on_everything_except(
  384. "postgresql", "mysql", "sqlite", "oracle"
  385. )
  386. @property
  387. def unique_constraint_reflection_no_index_overlap(self):
  388. return (
  389. self.unique_constraint_reflection
  390. + skip_if("mysql")
  391. + skip_if("oracle")
  392. )
  393. @property
  394. def check_constraint_reflection(self):
  395. return fails_on_everything_except(
  396. "postgresql",
  397. "sqlite",
  398. "oracle",
  399. self._mysql_and_check_constraints_exist,
  400. )
  401. @property
  402. def indexes_with_expressions(self):
  403. return only_on(["postgresql", "sqlite>=3.9.0"])
  404. @property
  405. def temp_table_names(self):
  406. """target dialect supports listing of temporary table names"""
  407. return only_on(["sqlite", "oracle"]) + skip_if(self._sqlite_file_db)
  408. @property
  409. def temporary_views(self):
  410. """target database supports temporary views"""
  411. return only_on(["sqlite", "postgresql"]) + skip_if(
  412. self._sqlite_file_db
  413. )
  414. @property
  415. def update_nowait(self):
  416. """Target database must support SELECT...FOR UPDATE NOWAIT"""
  417. return skip_if(
  418. ["firebird", "mssql", "mysql", "sqlite", "sybase"],
  419. "no FOR UPDATE NOWAIT support",
  420. )
  421. @property
  422. def subqueries(self):
  423. """Target database must support subqueries."""
  424. return skip_if(exclude("mysql", "<", (4, 1, 1)), "no subquery support")
  425. @property
  426. def ctes(self):
  427. """Target database supports CTEs"""
  428. return only_on(
  429. [
  430. lambda config: against(config, "mysql")
  431. and (
  432. (
  433. config.db.dialect._is_mariadb
  434. and config.db.dialect._mariadb_normalized_version_info
  435. >= (10, 2)
  436. )
  437. or (
  438. not config.db.dialect._is_mariadb
  439. and config.db.dialect.server_version_info >= (8,)
  440. )
  441. ),
  442. "postgresql",
  443. "mssql",
  444. "oracle",
  445. "sqlite>=3.8.3",
  446. ]
  447. )
  448. @property
  449. def ctes_with_update_delete(self):
  450. """target database supports CTES that ride on top of a normal UPDATE
  451. or DELETE statement which refers to the CTE in a correlated subquery.
  452. """
  453. return only_on(
  454. [
  455. "postgresql",
  456. "mssql",
  457. # "oracle" - oracle can do this but SQLAlchemy doesn't support
  458. # their syntax yet
  459. ]
  460. )
  461. @property
  462. def ctes_on_dml(self):
  463. """target database supports CTES which consist of INSERT, UPDATE
  464. or DELETE *within* the CTE, e.g. WITH x AS (UPDATE....)"""
  465. return only_if(["postgresql"])
  466. @property
  467. def mod_operator_as_percent_sign(self):
  468. """target database must use a plain percent '%' as the 'modulus'
  469. operator."""
  470. return only_if(["mysql", "sqlite", "postgresql+psycopg2", "mssql"])
  471. @property
  472. def intersect(self):
  473. """Target database must support INTERSECT or equivalent."""
  474. return fails_if(
  475. ["firebird", self._mysql_not_mariadb_103, "sybase"],
  476. "no support for INTERSECT",
  477. )
  478. @property
  479. def except_(self):
  480. """Target database must support EXCEPT or equivalent (i.e. MINUS)."""
  481. return fails_if(
  482. ["firebird", self._mysql_not_mariadb_103, "sybase"],
  483. "no support for EXCEPT",
  484. )
  485. @property
  486. def order_by_col_from_union(self):
  487. """target database supports ordering by a column from a SELECT
  488. inside of a UNION
  489. E.g. (SELECT id, ...) UNION (SELECT id, ...) ORDER BY id
  490. Fails on SQL Server
  491. """
  492. return fails_if("mssql")
  493. @property
  494. def parens_in_union_contained_select_w_limit_offset(self):
  495. """Target database must support parenthesized SELECT in UNION
  496. when LIMIT/OFFSET is specifically present.
  497. E.g. (SELECT ... LIMIT ..) UNION (SELECT .. OFFSET ..)
  498. This is known to fail on SQLite.
  499. """
  500. return fails_if("sqlite")
  501. @property
  502. def parens_in_union_contained_select_wo_limit_offset(self):
  503. """Target database must support parenthesized SELECT in UNION
  504. when OFFSET/LIMIT is specifically not present.
  505. E.g. (SELECT ...) UNION (SELECT ..)
  506. This is known to fail on SQLite. It also fails on Oracle
  507. because without LIMIT/OFFSET, there is currently no step that
  508. creates an additional subquery.
  509. """
  510. return fails_if(["sqlite", "oracle"])
  511. @property
  512. def offset(self):
  513. """Target database must support some method of adding OFFSET or
  514. equivalent to a result set."""
  515. return fails_if(["sybase"], "no support for OFFSET or equivalent")
  516. @property
  517. def sql_expression_limit_offset(self):
  518. return (
  519. fails_if(
  520. ["mysql"],
  521. "Target backend can't accommodate full expressions in "
  522. "OFFSET or LIMIT",
  523. )
  524. + self.offset
  525. )
  526. @property
  527. def window_functions(self):
  528. return only_if(
  529. ["postgresql>=8.4", "mssql", "oracle", "sqlite>=3.25.0"],
  530. "Backend does not support window functions",
  531. )
  532. @property
  533. def two_phase_transactions(self):
  534. """Target database must support two-phase transactions."""
  535. def pg_prepared_transaction(config):
  536. if not against(config, "postgresql"):
  537. return False
  538. with config.db.connect() as conn:
  539. try:
  540. num = conn.scalar(
  541. text(
  542. "select cast(setting AS integer) from pg_settings "
  543. "where name = 'max_prepared_transactions'"
  544. )
  545. )
  546. except exc.OperationalError:
  547. return False
  548. else:
  549. return num > 0
  550. return skip_if(
  551. [
  552. no_support("firebird", "no SA implementation"),
  553. no_support("mssql", "two-phase xact not supported by drivers"),
  554. no_support(
  555. "oracle", "two-phase xact not implemented in SQLA/oracle"
  556. ),
  557. no_support(
  558. "drizzle", "two-phase xact not supported by database"
  559. ),
  560. no_support(
  561. "sqlite", "two-phase xact not supported by database"
  562. ),
  563. no_support(
  564. "sybase", "two-phase xact not supported by drivers/SQLA"
  565. ),
  566. no_support(
  567. "postgresql+zxjdbc",
  568. "FIXME: JDBC driver confuses the transaction state, "
  569. "may need separate XA implementation",
  570. ),
  571. no_support(
  572. "mysql",
  573. "recent MySQL communiity editions have too many issues "
  574. "(late 2016), disabling for now",
  575. ),
  576. NotPredicate(
  577. LambdaPredicate(
  578. pg_prepared_transaction,
  579. "max_prepared_transactions not available or zero",
  580. )
  581. ),
  582. ]
  583. )
  584. @property
  585. def two_phase_recovery(self):
  586. return self.two_phase_transactions + (
  587. skip_if("mysql", "crashes on most mariadb and mysql versions")
  588. )
  589. @property
  590. def views(self):
  591. """Target database must support VIEWs."""
  592. return skip_if("drizzle", "no VIEW support")
  593. @property
  594. def empty_strings_varchar(self):
  595. """
  596. target database can persist/return an empty string with a varchar.
  597. """
  598. return fails_if(
  599. ["oracle"], "oracle converts empty strings to a blank space"
  600. )
  601. @property
  602. def empty_strings_text(self):
  603. """target database can persist/return an empty string with an
  604. unbounded text."""
  605. return fails_if(
  606. ["oracle"], "oracle converts empty strings to a blank space"
  607. )
  608. @property
  609. def expressions_against_unbounded_text(self):
  610. """target database supports use of an unbounded textual field in a
  611. WHERE clause."""
  612. return fails_if(
  613. ["oracle"],
  614. "ORA-00932: inconsistent datatypes: expected - got CLOB",
  615. )
  616. @property
  617. def unicode_data(self):
  618. """target drive must support unicode data stored in columns."""
  619. return skip_if([no_support("sybase", "no unicode driver support")])
  620. @property
  621. def unicode_connections(self):
  622. """
  623. Target driver must support some encoding of Unicode across the wire.
  624. """
  625. # TODO: expand to exclude MySQLdb versions w/ broken unicode
  626. return skip_if(
  627. [exclude("mysql", "<", (4, 1, 1), "no unicode connection support")]
  628. )
  629. @property
  630. def unicode_ddl(self):
  631. """Target driver must support some degree of non-ascii symbol names."""
  632. # TODO: expand to exclude MySQLdb versions w/ broken unicode
  633. return skip_if(
  634. [
  635. no_support("oracle", "FIXME: no support in database?"),
  636. no_support("sybase", "FIXME: guessing, needs confirmation"),
  637. no_support("mssql+pymssql", "no FreeTDS support"),
  638. LambdaPredicate(
  639. lambda config: against(config, "mysql+mysqlconnector")
  640. and config.db.dialect._mysqlconnector_version_info > (2, 0)
  641. and util.py2k,
  642. "bug in mysqlconnector 2.0",
  643. ),
  644. exclude(
  645. "mysql", "<", (4, 1, 1), "no unicode connection support"
  646. ),
  647. ]
  648. )
  649. @property
  650. def emulated_lastrowid(self):
  651. """"target dialect retrieves cursor.lastrowid or an equivalent
  652. after an insert() construct executes.
  653. """
  654. return fails_on_everything_except(
  655. "mysql", "sqlite+pysqlite", "sqlite+pysqlcipher", "sybase", "mssql"
  656. )
  657. @property
  658. def implements_get_lastrowid(self):
  659. return skip_if([no_support("sybase", "not supported by database")])
  660. @property
  661. def dbapi_lastrowid(self):
  662. """"target backend includes a 'lastrowid' accessor on the DBAPI
  663. cursor object.
  664. """
  665. return skip_if(
  666. "mssql+pymssql", "crashes on pymssql"
  667. ) + fails_on_everything_except(
  668. "mysql", "sqlite+pysqlite", "sqlite+pysqlcipher"
  669. )
  670. @property
  671. def nullsordering(self):
  672. """Target backends that support nulls ordering."""
  673. return fails_on_everything_except(
  674. "postgresql", "oracle", "firebird", "sqlite >= 3.30.0"
  675. )
  676. @property
  677. def reflects_pk_names(self):
  678. """Target driver reflects the name of primary key constraints."""
  679. return fails_on_everything_except(
  680. "postgresql", "oracle", "mssql", "sybase", "sqlite"
  681. )
  682. @property
  683. def nested_aggregates(self):
  684. """target database can select an aggregate from a subquery that's
  685. also using an aggregate"""
  686. return skip_if(["mssql", "sqlite"])
  687. @property
  688. def array_type(self):
  689. return only_on(
  690. [
  691. lambda config: against(config, "postgresql")
  692. and not against(config, "+pg8000")
  693. and not against(config, "+zxjdbc")
  694. ]
  695. )
  696. @property
  697. def json_type(self):
  698. return only_on(
  699. [
  700. lambda config: against(config, "mysql")
  701. and (
  702. (
  703. not config.db.dialect._is_mariadb
  704. and against(config, "mysql >= 5.7")
  705. )
  706. or (
  707. config.db.dialect._mariadb_normalized_version_info
  708. >= (10, 2, 7)
  709. )
  710. ),
  711. "postgresql >= 9.3",
  712. self._sqlite_json,
  713. ]
  714. )
  715. @property
  716. def json_index_supplementary_unicode_element(self):
  717. # for sqlite see https://bugs.python.org/issue38749
  718. return skip_if(
  719. [
  720. lambda config: against(config, "mysql")
  721. and config.db.dialect._is_mariadb,
  722. "sqlite",
  723. ]
  724. )
  725. def _sqlite_file_db(self, config):
  726. return against(config, "sqlite") and config.db.dialect._is_url_file_db(
  727. config.db.url
  728. )
  729. def _sqlite_memory_db(self, config):
  730. return against(
  731. config, "sqlite"
  732. ) and not config.db.dialect._is_url_file_db(config.db.url)
  733. def _sqlite_json(self, config):
  734. if not against(config, "sqlite >= 3.9"):
  735. return False
  736. else:
  737. with config.db.connect() as conn:
  738. try:
  739. return (
  740. conn.scalar(
  741. """select json_extract('{"foo": "bar"}', """
  742. """'$."foo"')"""
  743. )
  744. == "bar"
  745. )
  746. except exc.DBAPIError:
  747. return False
  748. @property
  749. def reflects_json_type(self):
  750. return only_on(
  751. [
  752. lambda config: against(config, "mysql >= 5.7")
  753. and not config.db.dialect._is_mariadb,
  754. "postgresql >= 9.3",
  755. "sqlite >= 3.9",
  756. ]
  757. )
  758. @property
  759. def json_array_indexes(self):
  760. return self.json_type + fails_if("+pg8000")
  761. @property
  762. def datetime_literals(self):
  763. """target dialect supports rendering of a date, time, or datetime as a
  764. literal string, e.g. via the TypeEngine.literal_processor() method.
  765. """
  766. return fails_on_everything_except("sqlite")
  767. @property
  768. def datetime(self):
  769. """target dialect supports representation of Python
  770. datetime.datetime() objects."""
  771. return exclusions.open()
  772. @property
  773. def datetime_microseconds(self):
  774. """target dialect supports representation of Python
  775. datetime.datetime() with microsecond objects."""
  776. return skip_if(
  777. ["mssql", "mysql", "firebird", "+zxjdbc", "oracle", "sybase"]
  778. )
  779. @property
  780. def timestamp_microseconds(self):
  781. """target dialect supports representation of Python
  782. datetime.datetime() with microsecond objects but only
  783. if TIMESTAMP is used."""
  784. return only_on(["oracle"])
  785. @property
  786. def datetime_historic(self):
  787. """target dialect supports representation of Python
  788. datetime.datetime() objects with historic (pre 1900) values."""
  789. return succeeds_if(["sqlite", "postgresql", "firebird"])
  790. @property
  791. def date(self):
  792. """target dialect supports representation of Python
  793. datetime.date() objects."""
  794. return exclusions.open()
  795. @property
  796. def date_coerces_from_datetime(self):
  797. """target dialect accepts a datetime object as the target
  798. of a date column."""
  799. # does not work as of pyodbc 4.0.22
  800. return fails_on("mysql+mysqlconnector") + skip_if("mssql+pyodbc")
  801. @property
  802. def date_historic(self):
  803. """target dialect supports representation of Python
  804. datetime.datetime() objects with historic (pre 1900) values."""
  805. return succeeds_if(["sqlite", "postgresql", "firebird"])
  806. @property
  807. def time(self):
  808. """target dialect supports representation of Python
  809. datetime.time() objects."""
  810. return skip_if(["oracle"])
  811. @property
  812. def time_microseconds(self):
  813. """target dialect supports representation of Python
  814. datetime.time() with microsecond objects."""
  815. return skip_if(
  816. ["mssql", "mysql", "firebird", "+zxjdbc", "oracle", "sybase"]
  817. )
  818. @property
  819. def precision_numerics_general(self):
  820. """target backend has general support for moderately high-precision
  821. numerics."""
  822. return exclusions.open()
  823. @property
  824. def precision_numerics_enotation_small(self):
  825. """target backend supports Decimal() objects using E notation
  826. to represent very small values."""
  827. # NOTE: this exclusion isn't used in current tests.
  828. return exclusions.open()
  829. @property
  830. def precision_numerics_enotation_large(self):
  831. """target backend supports Decimal() objects using E notation
  832. to represent very large values."""
  833. return fails_if(
  834. [
  835. (
  836. "sybase+pyodbc",
  837. None,
  838. None,
  839. "Don't know how do get these values through "
  840. "FreeTDS + Sybase",
  841. ),
  842. ("firebird", None, None, "Precision must be from 1 to 18"),
  843. ]
  844. )
  845. @property
  846. def precision_numerics_many_significant_digits(self):
  847. """target backend supports values with many digits on both sides,
  848. such as 319438950232418390.273596, 87673.594069654243
  849. """
  850. def broken_cx_oracle(config):
  851. return (
  852. against(config, "oracle+cx_oracle")
  853. and config.db.dialect.cx_oracle_ver <= (6, 0, 2)
  854. and config.db.dialect.cx_oracle_ver > (6,)
  855. )
  856. return fails_if(
  857. [
  858. ("sqlite", None, None, "TODO"),
  859. ("firebird", None, None, "Precision must be from 1 to 18"),
  860. ("sybase+pysybase", None, None, "TODO"),
  861. ]
  862. )
  863. @property
  864. def precision_numerics_retains_significant_digits(self):
  865. """A precision numeric type will return empty significant digits,
  866. i.e. a value such as 10.000 will come back in Decimal form with
  867. the .000 maintained."""
  868. return fails_if(
  869. [
  870. ("oracle", None, None, "driver doesn't do this automatically"),
  871. (
  872. "firebird",
  873. None,
  874. None,
  875. "database and/or driver truncates decimal places.",
  876. ),
  877. ]
  878. )
  879. @property
  880. def precision_generic_float_type(self):
  881. """target backend will return native floating point numbers with at
  882. least seven decimal places when using the generic Float type."""
  883. return fails_if(
  884. [
  885. (
  886. "mysql",
  887. None,
  888. None,
  889. "mysql FLOAT type only returns 4 decimals",
  890. ),
  891. (
  892. "firebird",
  893. None,
  894. None,
  895. "firebird FLOAT type isn't high precision",
  896. ),
  897. ]
  898. )
  899. @property
  900. def floats_to_four_decimals(self):
  901. return fails_if(
  902. [
  903. ("mysql+oursql", None, None, "Floating point error"),
  904. (
  905. "firebird",
  906. None,
  907. None,
  908. "Firebird still has FP inaccuracy even "
  909. "with only four decimal places",
  910. ),
  911. (
  912. "mssql+pyodbc",
  913. None,
  914. None,
  915. "mssql+pyodbc has FP inaccuracy even with "
  916. "only four decimal places ",
  917. ),
  918. (
  919. "mssql+pymssql",
  920. None,
  921. None,
  922. "mssql+pymssql has FP inaccuracy even with "
  923. "only four decimal places ",
  924. ),
  925. (
  926. "postgresql+pg8000",
  927. None,
  928. None,
  929. "postgresql+pg8000 has FP inaccuracy even with "
  930. "only four decimal places ",
  931. ),
  932. (
  933. "postgresql+psycopg2cffi",
  934. None,
  935. None,
  936. "postgresql+psycopg2cffi has FP inaccuracy even with "
  937. "only four decimal places ",
  938. ),
  939. ]
  940. )
  941. @property
  942. def implicit_decimal_binds(self):
  943. """target backend will return a selected Decimal as a Decimal, not
  944. a string.
  945. e.g.::
  946. expr = decimal.Decimal("15.7563")
  947. value = e.scalar(
  948. select([literal(expr)])
  949. )
  950. assert value == expr
  951. See :ticket:`4036`
  952. """
  953. # fixed for mysqlclient in
  954. # https://github.com/PyMySQL/mysqlclient-python/commit/68b9662918577fc05be9610ef4824a00f2b051b0
  955. def check(config):
  956. if against(config, "mysql+mysqldb"):
  957. # can remove once post 1.3.13 is released
  958. try:
  959. from MySQLdb import converters
  960. from decimal import Decimal
  961. return Decimal not in converters.conversions
  962. except:
  963. return True
  964. return against(
  965. config, "mysql+mysqldb"
  966. ) and config.db.dialect._mysql_dbapi_version <= (1, 3, 13)
  967. return exclusions.fails_on(check, "fixed for mysqlclient post 1.3.13")
  968. @property
  969. def fetch_null_from_numeric(self):
  970. return skip_if(("mssql+pyodbc", None, None, "crashes due to bug #351"))
  971. @property
  972. def duplicate_key_raises_integrity_error(self):
  973. return fails_on("postgresql+pg8000")
  974. def _has_pg_extension(self, name):
  975. def check(config):
  976. if not against(config, "postgresql"):
  977. return False
  978. count = config.db.scalar(
  979. "SELECT count(*) FROM pg_extension "
  980. "WHERE extname='%s'" % name
  981. )
  982. return bool(count)
  983. return only_if(check, "needs %s extension" % name)
  984. @property
  985. def hstore(self):
  986. return self._has_pg_extension("hstore")
  987. @property
  988. def btree_gist(self):
  989. return self._has_pg_extension("btree_gist")
  990. @property
  991. def range_types(self):
  992. def check_range_types(config):
  993. if not against(
  994. config, ["postgresql+psycopg2", "postgresql+psycopg2cffi"]
  995. ):
  996. return False
  997. try:
  998. config.db.scalar("select '[1,2)'::int4range;")
  999. return True
  1000. except Exception:
  1001. return False
  1002. return only_if(check_range_types)
  1003. @property
  1004. def oracle_test_dblink(self):
  1005. return skip_if(
  1006. lambda config: not config.file_config.has_option(
  1007. "sqla_testing", "oracle_db_link"
  1008. ),
  1009. "oracle_db_link option not specified in config",
  1010. )
  1011. @property
  1012. def postgresql_test_dblink(self):
  1013. return skip_if(
  1014. lambda config: not config.file_config.has_option(
  1015. "sqla_testing", "postgres_test_db_link"
  1016. ),
  1017. "postgres_test_db_link option not specified in config",
  1018. )
  1019. @property
  1020. def postgresql_jsonb(self):
  1021. return only_on("postgresql >= 9.4") + skip_if(
  1022. lambda config: config.db.dialect.driver == "pg8000"
  1023. and config.db.dialect._dbapi_version <= (1, 10, 1)
  1024. )
  1025. @property
  1026. def psycopg2_native_json(self):
  1027. return self.psycopg2_compatibility
  1028. @property
  1029. def psycopg2_native_hstore(self):
  1030. return self.psycopg2_compatibility
  1031. @property
  1032. def psycopg2_compatibility(self):
  1033. return only_on(["postgresql+psycopg2", "postgresql+psycopg2cffi"])
  1034. @property
  1035. def psycopg2_or_pg8000_compatibility(self):
  1036. return only_on(
  1037. [
  1038. "postgresql+psycopg2",
  1039. "postgresql+psycopg2cffi",
  1040. "postgresql+pg8000",
  1041. ]
  1042. )
  1043. @property
  1044. def percent_schema_names(self):
  1045. return skip_if(
  1046. [
  1047. (
  1048. "+psycopg2",
  1049. None,
  1050. None,
  1051. "psycopg2 2.4 no longer accepts percent "
  1052. "sign in bind placeholders",
  1053. ),
  1054. (
  1055. "+psycopg2cffi",
  1056. None,
  1057. None,
  1058. "psycopg2cffi does not accept percent signs in "
  1059. "bind placeholders",
  1060. ),
  1061. ("mysql", None, None, "executemany() doesn't work here"),
  1062. ]
  1063. )
  1064. @property
  1065. def order_by_label_with_expression(self):
  1066. return fails_if(
  1067. [
  1068. (
  1069. "firebird",
  1070. None,
  1071. None,
  1072. "kinterbasdb doesn't send full type information",
  1073. ),
  1074. ("postgresql", None, None, "only simple labels allowed"),
  1075. ("sybase", None, None, "only simple labels allowed"),
  1076. ("mssql", None, None, "only simple labels allowed"),
  1077. ]
  1078. )
  1079. def get_order_by_collation(self, config):
  1080. lookup = {
  1081. # will raise without quoting
  1082. "postgresql": "POSIX",
  1083. # note MySQL databases need to be created w/ utf8mb4 charset
  1084. # for the test suite
  1085. "mysql": "utf8mb4_bin",
  1086. "sqlite": "NOCASE",
  1087. # will raise *with* quoting
  1088. "mssql": "Latin1_General_CI_AS",
  1089. }
  1090. try:
  1091. return lookup[config.db.name]
  1092. except KeyError:
  1093. raise NotImplementedError()
  1094. @property
  1095. def skip_mysql_on_windows(self):
  1096. """Catchall for a large variety of MySQL on Windows failures"""
  1097. return skip_if(
  1098. self._has_mysql_on_windows, "Not supported on MySQL + Windows"
  1099. )
  1100. @property
  1101. def mssql_freetds(self):
  1102. return only_on(["mssql+pymssql"])
  1103. @property
  1104. def ad_hoc_engines(self):
  1105. return exclusions.skip_if(
  1106. ["oracle"],
  1107. "works, but Oracle just gets tired with "
  1108. "this much connection activity",
  1109. )
  1110. @property
  1111. def no_mssql_freetds(self):
  1112. return self.mssql_freetds.not_()
  1113. @property
  1114. def pyodbc_fast_executemany(self):
  1115. def has_fastexecutemany(config):
  1116. if not against(config, "mssql+pyodbc"):
  1117. return False
  1118. if config.db.dialect._dbapi_version() < (4, 0, 19):
  1119. return False
  1120. with config.db.connect() as conn:
  1121. drivername = conn.connection.connection.getinfo(
  1122. config.db.dialect.dbapi.SQL_DRIVER_NAME
  1123. )
  1124. # on linux this is something like 'libmsodbcsql-13.1.so.9.2'.
  1125. # on Windows this is something like 'msodbcsql17.dll'.
  1126. return "msodbc" in drivername
  1127. return only_if(
  1128. has_fastexecutemany, "only on pyodbc > 4.0.19 w/ msodbc driver"
  1129. )
  1130. @property
  1131. def python_fixed_issue_8743(self):
  1132. return exclusions.skip_if(
  1133. lambda: sys.version_info < (2, 7, 8),
  1134. "Python issue 8743 fixed in Python 2.7.8",
  1135. )
  1136. @property
  1137. def granular_timezone(self):
  1138. """the datetime.timezone class, or SQLAlchemy's port, supports
  1139. seconds and microseconds.
  1140. SQLAlchemy ported the Python 3.7 version for Python 2, so
  1141. it passes on that. For Python 3.6 and earlier, it is not supported.
  1142. """
  1143. return exclusions.skip_if(
  1144. lambda: sys.version_info >= (3,) and sys.version_info < (3, 7)
  1145. )
  1146. @property
  1147. def selectone(self):
  1148. """target driver must support the literal statement 'select 1'"""
  1149. return skip_if(
  1150. ["oracle", "firebird"], "non-standard SELECT scalar syntax"
  1151. )
  1152. @property
  1153. def mysql_for_update(self):
  1154. return skip_if(
  1155. "mysql+mysqlconnector",
  1156. "lock-sensitive operations crash on mysqlconnector",
  1157. )
  1158. @property
  1159. def mysql_fsp(self):
  1160. return only_if("mysql >= 5.6.4")
  1161. @property
  1162. def mysql_fully_case_sensitive(self):
  1163. return only_if(self._has_mysql_fully_case_sensitive)
  1164. @property
  1165. def mysql_zero_date(self):
  1166. def check(config):
  1167. if not against(config, "mysql"):
  1168. return False
  1169. row = config.db.execute("show variables like 'sql_mode'").first()
  1170. return not row or "NO_ZERO_DATE" not in row[1]
  1171. return only_if(check)
  1172. @property
  1173. def mysql_non_strict(self):
  1174. def check(config):
  1175. if not against(config, "mysql"):
  1176. return False
  1177. row = config.db.execute("show variables like 'sql_mode'").first()
  1178. return not row or "STRICT_TRANS_TABLES" not in row[1]
  1179. return only_if(check)
  1180. @property
  1181. def mysql_ngram_fulltext(self):
  1182. def check(config):
  1183. return (
  1184. against(config, "mysql")
  1185. and not config.db.dialect._is_mariadb
  1186. and config.db.dialect.server_version_info >= (5, 7)
  1187. )
  1188. return only_if(check)
  1189. def _mariadb_102(self, config):
  1190. return (
  1191. against(config, "mysql")
  1192. and config.db.dialect._is_mariadb
  1193. and config.db.dialect._mariadb_normalized_version_info > (10, 2)
  1194. )
  1195. def _mysql_and_check_constraints_exist(self, config):
  1196. # 1. we have mysql / mariadb and
  1197. # 2. it enforces check constraints
  1198. if exclusions.against(config, "mysql"):
  1199. if config.db.dialect._is_mariadb:
  1200. norm_version_info = (
  1201. config.db.dialect._mariadb_normalized_version_info
  1202. )
  1203. return norm_version_info >= (10, 2)
  1204. else:
  1205. norm_version_info = config.db.dialect.server_version_info
  1206. return norm_version_info >= (8, 0, 16)
  1207. else:
  1208. return False
  1209. def _mysql_check_constraints_exist(self, config):
  1210. # 1. we dont have mysql / mariadb or
  1211. # 2. we have mysql / mariadb that enforces check constraints
  1212. return not exclusions.against(
  1213. config, "mysql"
  1214. ) or self._mysql_and_check_constraints_exist(config)
  1215. def _mysql_check_constraints_dont_exist(self, config):
  1216. # 1. we have mysql / mariadb and
  1217. # 2. they dont enforce check constraints
  1218. return not self._mysql_check_constraints_exist(config)
  1219. def _mysql_not_mariadb_102(self, config):
  1220. return against(config, "mysql") and (
  1221. not config.db.dialect._is_mariadb
  1222. or config.db.dialect._mariadb_normalized_version_info < (10, 2)
  1223. )
  1224. def _mysql_not_mariadb_103(self, config):
  1225. return against(config, "mysql") and (
  1226. not config.db.dialect._is_mariadb
  1227. or config.db.dialect._mariadb_normalized_version_info < (10, 3)
  1228. )
  1229. def _mysql_not_mariadb_104(self, config):
  1230. return against(config, "mysql") and (
  1231. not config.db.dialect._is_mariadb
  1232. or config.db.dialect._mariadb_normalized_version_info < (10, 4)
  1233. )
  1234. def _has_mysql_on_windows(self, config):
  1235. return (
  1236. against(config, "mysql")
  1237. and config.db.dialect._detect_casing(config.db) == 1
  1238. )
  1239. def _has_mysql_fully_case_sensitive(self, config):
  1240. return (
  1241. against(config, "mysql")
  1242. and config.db.dialect._detect_casing(config.db) == 0
  1243. )
  1244. @property
  1245. def postgresql_utf8_server_encoding(self):
  1246. return only_if(
  1247. lambda config: against(config, "postgresql")
  1248. and config.db.scalar("show server_encoding").lower() == "utf8"
  1249. )
  1250. @property
  1251. def cxoracle6_or_greater(self):
  1252. return only_if(
  1253. lambda config: against(config, "oracle+cx_oracle")
  1254. and config.db.dialect.cx_oracle_ver >= (6,)
  1255. )
  1256. @property
  1257. def oracle5x(self):
  1258. return only_if(
  1259. lambda config: against(config, "oracle+cx_oracle")
  1260. and config.db.dialect.cx_oracle_ver < (6,)
  1261. )
  1262. @property
  1263. def computed_columns(self):
  1264. return skip_if(["postgresql < 12", "sqlite", "mysql < 5.7"])
  1265. @property
  1266. def python_profiling_backend(self):
  1267. return only_on([self._sqlite_memory_db])
  1268. @property
  1269. def computed_columns_stored(self):
  1270. return self.computed_columns + skip_if(["oracle", "firebird"])
  1271. @property
  1272. def computed_columns_virtual(self):
  1273. return self.computed_columns + skip_if(["postgresql", "firebird"])
  1274. @property
  1275. def computed_columns_default_persisted(self):
  1276. return self.computed_columns + only_if("postgresql")
  1277. @property
  1278. def computed_columns_reflect_persisted(self):
  1279. return self.computed_columns + skip_if("oracle")