def computed_doesnt_reflect_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.skip_if( ["postgresql", "oracle"], "backend reflects computed construct as a server default", ) + exclusions.skip_if(self.computed_reflects_normally))
def flexible_fk_cascades(self): """target database must support ON UPDATE/DELETE..CASCADE with the full range of keywords (e.g. NO ACTION, etc.)""" return exclusions.skip_if( ["oracle"], "target backend has poor FK cascade syntax" )
def schemas(self): """Target database must support external schemas, and have one named 'test_schema'.""" return exclusions.skip_if([ "sqlite", "firebird" ], "no schema support")
def sqlalchemy_issue_4436(self): def check(config): vers = sqla_compat._vers if vers == (1, 3, 0, "b1"): return True elif vers >= (1, 2, 16): return False else: return True return exclusions.skip_if( check, "SQLAlchemy 1.2.16, 1.3.0b2 or greater required")
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 unique_constraint_reflection(self): def doesnt_have_check_uq_constraints(config): from sqlalchemy import inspect insp = inspect(config.db) try: insp.get_unique_constraints("x") except NotImplementedError: return True except TypeError: return True except Exception: pass return False return exclusions.skip_if(doesnt_have_check_uq_constraints)
def python3(self): return exclusions.skip_if(lambda: sys.version_info < (3, ), "Python version 3.xx is required.")
def sqlalchemy_14(self): return exclusions.skip_if( lambda config: not util.sqla_14, "SQLAlchemy 1.4 or greater required", )
def no_name_normalize(self): return exclusions.skip_if( lambda config: config.db.dialect.requires_name_normalize)
def autoincrement_on_composite_pk(self): return exclusions.skip_if(["sqlite"], "not supported by database")
def integer_subtype_comparisons(self): """if a compare of Integer and BigInteger is supported yet.""" return exclusions.skip_if(["oracle"], "not supported by alembic impl")
def unicode_string(self): return exclusions.skip_if(["oracle"])
def computed_columns(self): # TODO: in theory if these could come from SQLAlchemy dialects # that would be helpful return self.computed_columns_api + exclusions.skip_if( ["postgresql < 12", "sqlite < 3.31", "mysql < 5.7"])
def alter_column(self): return exclusions.skip_if(["sqlite"], "no ALTER COLUMN support")
def sqlalchemy_issue_3740(self): """Fixes percent sign escaping for paramstyles that don't require it""" return exclusions.skip_if( lambda config: not util.sqla_120, "SQLAlchemy 1.2 or greater required", )
def long_names(self): if sqla_compat.sqla_14: return exclusions.skip_if("oracle<18") else: return exclusions.skip_if("oracle")
def no_name_normalize(self): return exclusions.skip_if( lambda config: config.db.dialect.requires_name_normalize )