当前位置: 首页>>代码示例>>Python>>正文


Python exclusions.only_if函数代码示例

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


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


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