def no_fk_names(self): """foreign key constraints *never* have names in the DB""" return exclusions.only_if( lambda config: exclusions.against(config, "sqlite") and not util.sqla_100 )
def no_fk_names(self): """foreign key constraints *never* have names in the DB""" return exclusions.only_if( lambda config: exclusions.against(config, "sqlite") and not util.sqla_100 )
def sequences(self): """Target database must support SEQUENCEs.""" return exclusions.only_if( [lambda config: config.db.dialect.supports_sequences], "no sequence support", )
def mysql_timestamp_reflection(self): def go(config): return ( not self._mariadb_102(config) or self.sqlalchemy_1115.enabled ) return exclusions.only_if(go)
def mysql_timestamp_reflection(self): def go(config): return ( not self._mariadb_102(config) or self.sqlalchemy_1115.enabled ) return exclusions.only_if(go)
def _has_pg_extension(self, name): def check(config): if not exclusions.against(config, "postgresql"): return False count = config.db.scalar("SELECT count(*) FROM pg_extension " "WHERE extname='%s'" % name) return bool(count) return exclusions.only_if(check, "needs %s extension" % name)
def computed_reflects_as_server_default(self): # note that this rule will go away when SQLAlchemy correctly # supports reflection of the "computed" construct; the element # will consistently be present as both column.computed and # column.server_default for all supported backends. return (self.computed_columns + exclusions.only_if( ["postgresql", "oracle"], "backend reflects computed construct as a server default", ) + exclusions.skip_if(self.computed_reflects_normally))
def editor_installed(self): def go(): try: import editor # noqa except ImportError: return False else: return True return exclusions.only_if(go, "editor package not installed")
def postgresql_uuid_ossp(self): def check_uuid_ossp(config): if not exclusions.against(config, "postgresql"): return False try: config.db.execute("SELECT uuid_generate_v4()") return True except: return False return exclusions.only_if(check_uuid_ossp)
def postgresql_uuid_ossp(self): def check_uuid_ossp(config): if not exclusions.against(config, "postgresql"): return False try: config.db.execute("SELECT uuid_generate_v4()") return True except: return False return exclusions.only_if(check_uuid_ossp)
def _has_pg_extension(self, name): def check(config): if not exclusions.against(config, "postgresql"): return False count = config.db.scalar( "SELECT count(*) FROM pg_extension " "WHERE extname='%s'" % name ) return bool(count) return exclusions.only_if(check, "needs %s extension" % name)
def stubs_test(self): def requirements(): try: import black # noqa import zimports # noqa return False except Exception: return True imports = exclusions.skip_if( requirements, "black and zimports are required for this test") version = exclusions.only_if(lambda _: compat.py39, "python 3.9 is required") return imports + version
def computed_reflects_normally(self): return exclusions.only_if( exclusions.BooleanPredicate(sqla_compat.has_computed_reflection) )
def legacy_engine(self): return exclusions.only_if( lambda config: not getattr(config.db, "_is_future", False))
def identity_columns_api(self): return exclusions.only_if( exclusions.BooleanPredicate(sqla_compat.has_identity))
def computed_columns_api(self): return exclusions.only_if( exclusions.BooleanPredicate(sqla_compat.has_computed))
def comments(self): return exclusions.only_if( lambda config: config.db.dialect.supports_comments)
def pep3147(self): return exclusions.only_if(lambda config: util.compat.has_pep3147())
def comments(self): return exclusions.only_if( lambda config: sqla_compat._dialect_supports_comments(config.db. dialect))
def comments_api(self): return exclusions.only_if(lambda config: util.sqla_120)