本文整理汇总了Python中sqlalchemy.testing.exclusions.against方法的典型用法代码示例。如果您正苦于以下问题:Python exclusions.against方法的具体用法?Python exclusions.against怎么用?Python exclusions.against使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy.testing.exclusions
的用法示例。
在下文中一共展示了exclusions.against方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: non_native_boolean_unconstrained
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def non_native_boolean_unconstrained(self):
"""target database is not native boolean and allows arbitrary integers
in it's "bool" column"""
return skip_if(
[
LambdaPredicate(
lambda config: against(config, "mssql"),
"SQL Server drivers / odbc seem to change "
"their mind on this",
),
LambdaPredicate(
lambda config: config.db.dialect.supports_native_boolean,
"native boolean dialect",
),
]
)
示例2: get_isolation_levels
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def get_isolation_levels(self, config):
levels = set(config.db.dialect._isolation_lookup)
if against(config, "sqlite"):
default = "SERIALIZABLE"
levels.add("AUTOCOMMIT")
elif against(config, "postgresql"):
default = "READ COMMITTED"
levels.add("AUTOCOMMIT")
elif against(config, "mysql"):
default = "REPEATABLE READ"
levels.add("AUTOCOMMIT")
elif against(config, "mssql"):
default = "READ COMMITTED"
levels.add("AUTOCOMMIT")
elif against(config, "oracle"):
default = "READ COMMITTED"
levels.add("AUTOCOMMIT")
else:
raise NotImplementedError()
return {"default": default, "supported": levels}
示例3: ctes
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def ctes(self):
"""Target database supports CTEs"""
return only_on(
[
lambda config: against(config, "mysql")
and (
(
config.db.dialect._is_mariadb
and config.db.dialect._mariadb_normalized_version_info
>= (10, 2)
)
or (
not config.db.dialect._is_mariadb
and config.db.dialect.server_version_info >= (8,)
)
),
"postgresql",
"mssql",
"oracle",
"sqlite>=3.8.3",
]
)
示例4: unicode_ddl
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def unicode_ddl(self):
"""Target driver must support some degree of non-ascii symbol names."""
# TODO: expand to exclude MySQLdb versions w/ broken unicode
return skip_if(
[
no_support("oracle", "FIXME: no support in database?"),
no_support("sybase", "FIXME: guessing, needs confirmation"),
no_support("mssql+pymssql", "no FreeTDS support"),
LambdaPredicate(
lambda config: against(config, "mysql+mysqlconnector")
and config.db.dialect._mysqlconnector_version_info > (2, 0)
and util.py2k,
"bug in mysqlconnector 2.0",
),
exclude(
"mysql", "<", (4, 1, 1), "no unicode connection support"
),
]
)
示例5: json_type
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def json_type(self):
return only_on(
[
lambda config: against(config, "mysql")
and (
(
not config.db.dialect._is_mariadb
and against(config, "mysql >= 5.7")
)
or (
config.db.dialect._mariadb_normalized_version_info
>= (10, 2, 7)
)
),
"postgresql >= 9.3",
self._sqlite_json,
]
)
示例6: precision_numerics_many_significant_digits
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def precision_numerics_many_significant_digits(self):
"""target backend supports values with many digits on both sides,
such as 319438950232418390.273596, 87673.594069654243
"""
def broken_cx_oracle(config):
return (
against(config, "oracle+cx_oracle")
and config.db.dialect.cx_oracle_ver <= (6, 0, 2)
and config.db.dialect.cx_oracle_ver > (6,)
)
return fails_if(
[
("sqlite", None, None, "TODO"),
("firebird", None, None, "Precision must be from 1 to 18"),
("sybase+pysybase", None, None, "TODO"),
]
)
示例7: pyodbc_fast_executemany
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def pyodbc_fast_executemany(self):
def has_fastexecutemany(config):
if not against(config, "mssql+pyodbc"):
return False
if config.db.dialect._dbapi_version() < (4, 0, 19):
return False
with config.db.connect() as conn:
drivername = conn.connection.connection.getinfo(
config.db.dialect.dbapi.SQL_DRIVER_NAME
)
# on linux this is something like 'libmsodbcsql-13.1.so.9.2'.
# on Windows this is something like 'msodbcsql17.dll'.
return "msodbc" in drivername
return only_if(
has_fastexecutemany, "only on pyodbc > 4.0.19 w/ msodbc driver"
)
示例8: binary_comparisons
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def binary_comparisons(self):
"""target database/driver can allow BLOB/BINARY fields to be compared
against a bound parameter value.
"""
return skip_if(["oracle", "mssql"], "not supported by database/driver")
示例9: tuple_in
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def tuple_in(self):
def _sqlite_tuple_in(config):
return against(
config, "sqlite"
) and config.db.dialect.dbapi.sqlite_version_info >= (3, 15, 0)
return only_on(["mysql", "postgresql", _sqlite_tuple_in])
示例10: array_type
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def array_type(self):
return only_on(
[
lambda config: against(config, "postgresql")
and not against(config, "+pg8000")
]
)
示例11: json_index_supplementary_unicode_element
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def json_index_supplementary_unicode_element(self):
# for sqlite see https://bugs.python.org/issue38749
return skip_if(
[
lambda config: against(config, "mysql")
and config.db.dialect._is_mariadb,
"sqlite",
]
)
示例12: _sqlite_file_db
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def _sqlite_file_db(self, config):
return against(config, "sqlite") and config.db.dialect._is_url_file_db(
config.db.url
)
示例13: _sqlite_json
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def _sqlite_json(self, config):
if not against(config, "sqlite >= 3.9"):
return False
else:
with config.db.connect() as conn:
try:
return (
conn.exec_driver_sql(
"""select json_extract('{"foo": "bar"}', """
"""'$."foo"')"""
).scalar()
== "bar"
)
except exc.DBAPIError:
return False
示例14: reflects_json_type
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def reflects_json_type(self):
return only_on(
[
lambda config: against(config, "mysql >= 5.7")
and not config.db.dialect._is_mariadb,
"postgresql >= 9.3",
"sqlite >= 3.9",
]
)
示例15: implicit_decimal_binds
# 需要导入模块: from sqlalchemy.testing import exclusions [as 别名]
# 或者: from sqlalchemy.testing.exclusions import against [as 别名]
def implicit_decimal_binds(self):
"""target backend will return a selected Decimal as a Decimal, not
a string.
e.g.::
expr = decimal.Decimal("15.7563")
value = e.scalar(
select([literal(expr)])
)
assert value == expr
See :ticket:`4036`
"""
# fixed for mysqlclient in
# https://github.com/PyMySQL/mysqlclient-python/commit/68b9662918577fc05be9610ef4824a00f2b051b0
def check(config):
if against(config, "mysql+mysqldb"):
# can remove once post 1.3.13 is released
try:
from MySQLdb import converters
from decimal import Decimal
return Decimal not in converters.conversions
except:
return True
return against(
config, "mysql+mysqldb"
) and config.db.dialect._mysql_dbapi_version <= (1, 3, 13)
return exclusions.fails_on(check, "fixed for mysqlclient post 1.3.13")