• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python exclusions.against函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sqlalchemy.testing.exclusions.against函数的典型用法代码示例。如果您正苦于以下问题:Python against函数的具体用法?Python against怎么用?Python against使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了against函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: array_type

 def array_type(self):
     return only_on(
         [
             lambda config: against(config, "postgresql")
             and not against(config, "+pg8000")
             and not against(config, "+zxjdbc")
         ]
     )
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:8,代码来源:requirements.py


示例2: mssql_freetds

 def mssql_freetds(self):
     return only_on(
         LambdaPredicate(
             lambda config: (
                 (against(config, 'mssql+pyodbc') and
                  config.db.dialect.freetds)
                 or against(config, 'mssql+pymssql')
             )
         )
     )
开发者ID:FlipperPA,项目名称:sqlalchemy,代码行数:10,代码来源:requirements.py


示例3: check

        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)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:14,代码来源:requirements.py


示例4: json_type

 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"
     ])
开发者ID:nakagami,项目名称:sqlalchemy,代码行数:15,代码来源:requirements.py


示例5: reflects_json_type

 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"
     ])
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:7,代码来源:requirements.py


示例6: broken_cx_oracle6_numerics

 def broken_cx_oracle6_numerics(config):
     return exclusions.LambdaPredicate(
         lambda config: against(config, 'oracle+cx_oracle') and
         config.db.dialect.cx_oracle_ver <= (6, 0, 2) and
         config.db.dialect.cx_oracle_ver > (6, ),
         "cx_Oracle github issue #77"
     )
开发者ID:gencer,项目名称:sqlalchemy,代码行数:7,代码来源:requirements.py


示例7: check

 def check(config):
     if not against(config, "postgresql"):
         return False
     count = config.db.scalar(
         "SELECT count(*) FROM pg_extension "
         "WHERE extname='%s'" % name)
     return bool(count)
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:7,代码来源:requirements.py


示例8: check_hstore

 def check_hstore(config):
     if not against(config, "postgresql"):
         return False
     try:
         config.db.execute("SELECT 'a=>1,a=>2'::hstore;")
         return True
     except:
         return False
开发者ID:FlipperPA,项目名称:sqlalchemy,代码行数:8,代码来源:requirements.py


示例9: check_hstore

 def check_hstore():
     if not against("postgresql"):
         return False
     try:
         self.db.execute("SELECT 'a=>1,a=>2'::hstore;")
         return True
     except:
         return False
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:8,代码来源:requirements.py


示例10: json_type

 def json_type(self):
     return only_on([
         lambda config: against(config, "mysql >= 5.7") and
         not config.db.dialect._is_mariadb and
         # workaround for:
         # https://github.com/PyMySQL/PyMySQL/issues/488
         not (config.db.dialect.driver == 'pymysql'),
         "postgresql >= 9.3"
     ])
开发者ID:KiYugadgeter,项目名称:sqlalchemy,代码行数:9,代码来源:requirements.py


示例11: check_range_types

 def check_range_types(config):
     if not against(
             config,
             ["postgresql+psycopg2", "postgresql+psycopg2cffi"]):
         return False
     try:
         config.db.scalar("select '[1,2)'::int4range;")
         return True
     except:
         return False
开发者ID:FlipperPA,项目名称:sqlalchemy,代码行数:10,代码来源:requirements.py


示例12: check_range_types

 def check_range_types():
     if not against("postgresql+psycopg2"):
         return False
     try:
         self.db.execute("select '[1,2)'::int4range;")
         # only supported in psycopg 2.5+
         from psycopg2.extras import NumericRange
         return True
     except:
         return False
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:10,代码来源:requirements.py


示例13: has_fastexecutemany

 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 'libmsodbcsql-13.1.so.9.2'.
         # don't know what it is on windows
         return "msodbc" in drivername
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:11,代码来源:requirements.py


示例14: _prep_testing_database

def _prep_testing_database(options, file_config):
    from sqlalchemy.testing import config, util
    from sqlalchemy.testing.exclusions import against
    from sqlalchemy import schema, inspect

    if options.dropfirst:
        for cfg in config.Config.all_configs():
            e = cfg.db
            inspector = inspect(e)
            try:
                view_names = inspector.get_view_names()
            except NotImplementedError:
                pass
            else:
                for vname in view_names:
                    e.execute(
                        schema._DropView(
                            schema.Table(vname, schema.MetaData())
                        )
                    )

            if config.requirements.schemas.enabled_for_config(cfg):
                try:
                    view_names = inspector.get_view_names(schema="test_schema")
                except NotImplementedError:
                    pass
                else:
                    for vname in view_names:
                        e.execute(
                            schema._DropView(
                                schema.Table(
                                    vname,
                                    schema.MetaData(),
                                    schema="test_schema",
                                )
                            )
                        )

            util.drop_all_tables(e, inspector)

            if config.requirements.schemas.enabled_for_config(cfg):
                util.drop_all_tables(e, inspector, schema=cfg.test_schema)

            if against(cfg, "postgresql"):
                from sqlalchemy.dialects import postgresql

                for enum in inspector.get_enums("*"):
                    e.execute(
                        postgresql.DropEnumType(
                            postgresql.ENUM(
                                name=enum["name"], schema=enum["schema"]
                            )
                        )
                    )
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:54,代码来源:plugin_base.py


示例15: _prep_testing_database

def _prep_testing_database(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy.testing.exclusions import against
    from sqlalchemy import schema, inspect

    if options.dropfirst:
        for cfg in config.Config.all_configs():
            e = cfg.db
            inspector = inspect(e)
            try:
                view_names = inspector.get_view_names()
            except NotImplementedError:
                pass
            else:
                for vname in view_names:
                    e.execute(schema._DropView(
                        schema.Table(vname, schema.MetaData())
                    ))

            if config.requirements.schemas.enabled_for_config(cfg):
                try:
                    view_names = inspector.get_view_names(
                        schema="test_schema")
                except NotImplementedError:
                    pass
                else:
                    for vname in view_names:
                        e.execute(schema._DropView(
                            schema.Table(vname, schema.MetaData(),
                                         schema="test_schema")
                        ))

            for tname in reversed(inspector.get_table_names(
                    order_by="foreign_key")):
                e.execute(schema.DropTable(
                    schema.Table(tname, schema.MetaData())
                ))

            if config.requirements.schemas.enabled_for_config(cfg):
                for tname in reversed(inspector.get_table_names(
                        order_by="foreign_key", schema="test_schema")):
                    e.execute(schema.DropTable(
                        schema.Table(tname, schema.MetaData(),
                                     schema="test_schema")
                    ))

            if against(cfg, "postgresql"):
                from sqlalchemy.dialects import postgresql
                for enum in inspector.get_enums("*"):
                    e.execute(postgresql.DropEnumType(
                        postgresql.ENUM(
                            name=enum['name'],
                            schema=enum['schema'])))
开发者ID:duesenfranz,项目名称:sqlalchemy,代码行数:53,代码来源:plugin_base.py


示例16: unicode_ddl

    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"
            ),
            LambdaPredicate(
                lambda config: against(config, 'mssql+pyodbc') and
                config.db.dialect.freetds and
                config.db.dialect.freetds_driver_version < "0.91",
                "older freetds doesn't support unicode DDL"
            ),
            exclude('mysql', '<', (4, 1, 1), 'no unicode connection support'),
        ])
开发者ID:FlipperPA,项目名称:sqlalchemy,代码行数:22,代码来源:requirements.py


示例17: ctes

    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)
            ),
            "postgresql",
            "mssql",
            "oracle"
        ])
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:13,代码来源:requirements.py


示例18: _mysql_and_check_constraints_exist

 def _mysql_and_check_constraints_exist(self, config):
     # 1. we have mysql / mariadb and
     # 2. it enforces check constraints
     if exclusions.against(config, "mysql"):
         if config.db.dialect._is_mariadb:
             norm_version_info = (
                 config.db.dialect._mariadb_normalized_version_info
             )
             return norm_version_info >= (10, 2)
         else:
             norm_version_info = config.db.dialect.server_version_info
             return norm_version_info >= (8, 0, 16)
     else:
         return False
开发者ID:monetate,项目名称:sqlalchemy,代码行数:14,代码来源:requirements.py


示例19: non_native_boolean_unconstrained

    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"
            )
        ])
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:14,代码来源:requirements.py


示例20: unicode_ddl

    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"
                ),
            ]
        )
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:20,代码来源:requirements.py



注:本文中的sqlalchemy.testing.exclusions.against函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python exclusions.closed函数代码示例发布时间:2022-05-27
下一篇:
Python engines.testing_engine函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap