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

Python exclusions.only_if函数代码示例

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

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



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

示例1: bulletproof_pickle

 def bulletproof_pickle(self):
     from sqlalchemy.util import pickle
     return only_if(
         lambda: pickle.__name__ == 'cPickle' and \
             sys.version_info < (3, 0) and not util.pypy,
         "Needs Python 2.x cPickle"
     )
开发者ID:ericlongxuan,项目名称:Practice,代码行数:7,代码来源:requirements.py


示例2: mod_operator_as_percent_sign

    def mod_operator_as_percent_sign(self):
        """target database must use a plain percent '%' as the 'modulus'
        operator."""

        return only_if(
                    ['mysql', 'sqlite', 'postgresql+psycopg2', 'mssql']
                )
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:7,代码来源:requirements.py


示例3: non_broken_pickle

 def non_broken_pickle(self):
     from sqlalchemy.util import pickle
     return only_if(
         lambda: not util.pypy and pickle.__name__ == 'cPickle'
             or sys.version_info >= (3, 2),
         "Needs cPickle+cPython or newer Python 3 pickle"
     )
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:7,代码来源:requirements.py


示例4: ctes_on_dml

    def ctes_on_dml(self):
        """target database supports CTES which consist of INSERT, UPDATE
        or DELETE *within* the CTE, e.g. WITH x AS (UPDATE....)"""

        return only_if(
            ['postgresql']
        )
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:7,代码来源:requirements.py


示例5: ctes_on_dml

    def ctes_on_dml(self):
        """target database supports CTES which consist of INSERT, UPDATE
        or DELETE"""

        return only_if(
            ['postgresql']
        )
开发者ID:zhsj,项目名称:sqlalchemy,代码行数:7,代码来源:requirements.py


示例6: mysql_ngram_fulltext

    def mysql_ngram_fulltext(self):
        def check(config):
            return (
                against(config, "mysql")
                and not config.db.dialect._is_mariadb
                and config.db.dialect.server_version_info >= (5, 7)
            )

        return only_if(check)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:9,代码来源:requirements.py


示例7: _has_pg_extension

 def _has_pg_extension(self, name):
     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)
     return only_if(check, "needs %s extension" % name)
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:9,代码来源:requirements.py


示例8: mysql_non_strict

    def mysql_non_strict(self):
        def check(config):
            if not against(config, 'mysql'):
                return False

            row = config.db.execute("show variables like 'sql_mode'").first()
            return not row or "STRICT_TRANS_TABLES" not in row[1]

        return only_if(check)
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:9,代码来源:requirements.py


示例9: mysql_zero_date

    def mysql_zero_date(self):
        def check(config):
            if not against(config, 'mysql'):
                return False

            row = config.db.execute("show variables like 'sql_mode'").first()
            return not row or "NO_ZERO_DATE" not in row[1]

        return only_if(check)
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:9,代码来源:requirements.py


示例10: hstore

    def hstore(self):
        def check_hstore():
            if not against("postgresql"):
                return False
            try:
                self.db.execute("SELECT 'a=>1,a=>2'::hstore;")
                return True
            except:
                return False

        return only_if(check_hstore)
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:11,代码来源:requirements.py


示例11: hstore

    def hstore(self):
        def check_hstore(config):
            if not against(config, "postgresql"):
                return False
            try:
                config.db.execute("SELECT 'a=>1,a=>2'::hstore;")
                return True
            except Exception:
                return False

        return only_if(check_hstore)
开发者ID:rlugojr,项目名称:sqlalchemy,代码行数:11,代码来源:requirements.py


示例12: range_types

    def range_types(self):
        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

        return only_if(check_range_types)
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:13,代码来源:requirements.py


示例13: range_types

    def range_types(self):
        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

        return only_if(check_range_types)
开发者ID:FlipperPA,项目名称:sqlalchemy,代码行数:13,代码来源:requirements.py


示例14: pyodbc_fast_executemany

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


示例15: mysql_non_strict

    def mysql_non_strict(self):
        def check(config):
             row = config.db.execute("show variables like 'sql_mode'").first()
             return not row or "STRICT" not in row[1]

        return only_if(check)
开发者ID:robin900,项目名称:sqlalchemy,代码行数:6,代码来源:requirements.py


示例16: oracle5x

 def oracle5x(self):
     return only_if(
         lambda config: against(config, "oracle+cx_oracle") and
         config.db.dialect.cx_oracle_ver < (6, )
     )
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:5,代码来源:requirements.py


示例17: cxoracle6_or_greater

 def cxoracle6_or_greater(self):
     return only_if(
         lambda config: against(config, "oracle+cx_oracle")
         and config.db.dialect.cx_oracle_ver >= (6,)
     )
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:5,代码来源:requirements.py


示例18: cpython

 def cpython(self):
     return only_if(lambda: util.cpython,
            "cPython interpreter needed"
          )
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:4,代码来源:requirements.py


示例19: window_functions

 def window_functions(self):
     return only_if([
                 "postgresql", "mssql", "oracle"
             ], "Backend does not support window functions")
开发者ID:NeilTruick,项目名称:sqlalchemy,代码行数:4,代码来源:requirements.py


示例20: sql_expressions_inserted_as_primary_key

 def sql_expressions_inserted_as_primary_key(self):
     return only_if([self.returning, self.sqlite])
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:2,代码来源:requirements.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python exclusions.only_on函数代码示例发布时间:2022-05-27
下一篇:
Python exclusions.fails_on_everything_except函数代码示例发布时间: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