Exemplo n.º 1
0
    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")
        ])
Exemplo n.º 2
0
    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'),
        ])
Exemplo n.º 3
0
 def mssql_freetds(self):
     return only_on(
         LambdaPredicate(
             lambda config: (
                 (against(config, 'mssql+pyodbc') and
                  config.db.dialect.freetds)
                 or against(config, 'mssql+pymssql')
             )
         )
     )
Exemplo n.º 4
0
    def two_phase_transactions(self):
        """Target database must support two-phase transactions."""

        def pg_prepared_transaction(config):
            if not against(config, "postgresql"):
                return False

            with config.db.connect() as conn:
                try:
                    num = conn.scalar(
                        text(
                            "select cast(setting AS integer) from pg_settings "
                            "where name = 'max_prepared_transactions'"
                        )
                    )
                except exc.OperationalError:
                    return False
                else:
                    return num > 0

        return skip_if(
            [
                no_support("firebird", "no SA implementation"),
                no_support("mssql", "two-phase xact not supported by drivers"),
                no_support(
                    "oracle", "two-phase xact not implemented in SQLA/oracle"
                ),
                no_support(
                    "drizzle", "two-phase xact not supported by database"
                ),
                no_support(
                    "sqlite", "two-phase xact not supported by database"
                ),
                no_support(
                    "sybase", "two-phase xact not supported by drivers/SQLA"
                ),
                no_support(
                    "mysql",
                    "recent MySQL communiity editions have too many issues "
                    "(late 2016), disabling for now",
                ),
                NotPredicate(
                    LambdaPredicate(
                        pg_prepared_transaction,
                        "max_prepared_transactions not available or zero",
                    )
                ),
            ]
        )
Exemplo n.º 5
0
    def two_phase_transactions(self):
        """Target database must support two-phase transactions."""

        def pg_prepared_transaction(config):
            if not against(config, "postgresql"):
                return True

            with config.db.connect() as conn:
                try:
                    num = conn.scalar(
                        text(
                            "select cast(setting AS integer) from pg_settings "
                            "where name = 'max_prepared_transactions'"
                        )
                    )
                except exc.OperationalError:
                    return False
                else:
                    return num > 0

        return skip_if(
            [
                no_support("firebird", "no SA implementation"),
                no_support("mssql", "two-phase xact not supported by drivers"),
                no_support(
                    "oracle", "two-phase xact not implemented in SQLA/oracle"
                ),
                no_support(
                    "sqlite", "two-phase xact not supported by database"
                ),
                no_support(
                    "sybase", "two-phase xact not supported by drivers/SQLA"
                ),
                # in Ia3cbbf56d4882fcc7980f90519412f1711fae74d
                # we are evaluating which modern MySQL / MariaDB versions
                # can handle two-phase testing without too many problems
                # no_support(
                #     "mysql",
                #    "recent MySQL communiity editions have too many issues "
                #    "(late 2016), disabling for now",
                # ),
                NotPredicate(
                    LambdaPredicate(
                        pg_prepared_transaction,
                        "max_prepared_transactions not available or zero",
                    )
                ),
            ]
        )
Exemplo n.º 6
0
    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"),
        ])