]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Drop support for all SQLAlchemy < 0.9
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 13 Jul 2018 16:36:06 +0000 (12:36 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 13 Jul 2018 16:37:28 +0000 (12:37 -0400)
With the 1.0 release, Alembic's minimum SQLAlchemy support version
moves to 0.9.0, previously 0.7.9.

Change-Id: I299d8af11c5982c4a792da1fcb96e4b437af687d

20 files changed:
alembic/autogenerate/render.py
alembic/ddl/impl.py
alembic/ddl/postgresql.py
alembic/operations/batch.py
alembic/operations/schemaobj.py
alembic/testing/plugin/plugin_base.py
alembic/testing/requirements.py
alembic/util/__init__.py
alembic/util/sqla_compat.py
docs/build/front.rst
docs/build/unreleased/sqla_09_minimum.rst [new file with mode: 0644]
setup.py
tests/test_autogen_fks.py
tests/test_autogen_indexes.py
tests/test_autogen_render.py
tests/test_batch.py
tests/test_external_dialect.py
tests/test_mssql.py
tests/test_op.py
tests/test_postgresql.py

index abdd277d082b96a08e595837b57f4e14121ed16b..ed289a6c0051a5a3bccbaa877a5b1c1b42a06afe 100644 (file)
@@ -421,11 +421,8 @@ def _ident(name):
 
 def _render_potential_expr(value, autogen_context, wrap_in_text=True):
     if isinstance(value, sql.ClauseElement):
-        if util.sqla_08:
-            compile_kw = dict(compile_kwargs={
-                'literal_binds': True, "include_table": False})
-        else:
-            compile_kw = {}
+        compile_kw = dict(compile_kwargs={
+            'literal_binds': True, "include_table": False})
 
         if wrap_in_text:
             template = "%(prefix)stext(%(sql)r)"
@@ -445,14 +442,10 @@ def _render_potential_expr(value, autogen_context, wrap_in_text=True):
 
 
 def _get_index_rendered_expressions(idx, autogen_context):
-    if util.sqla_08:
-        return [repr(_ident(getattr(exp, "name", None)))
-                if isinstance(exp, sa_schema.Column)
-                else _render_potential_expr(exp, autogen_context)
-                for exp in idx.expressions]
-    else:
-        return [
-            repr(_ident(getattr(col, "name", None))) for col in idx.columns]
+    return [repr(_ident(getattr(exp, "name", None)))
+            if isinstance(exp, sa_schema.Column)
+            else _render_potential_expr(exp, autogen_context)
+            for exp in idx.expressions]
 
 
 def _uq_constraint(constraint, autogen_context, alter):
index ec170fd09de2864dbead4126c9ffbe71ec12da78..98be164a9dfc201d8ebc0ad72bc582cf73f981d2 100644 (file)
@@ -45,9 +45,6 @@ class DefaultImpl(with_metaclass(ImplMeta)):
         self.connection = connection
         self.as_sql = as_sql
         self.literal_binds = context_opts.get('literal_binds', False)
-        if self.literal_binds and not util.sqla_08:
-            util.warn("'literal_binds' flag not supported in SQLAlchemy 0.7")
-            self.literal_binds = False
 
         self.output_buffer = output_buffer
         self.memo = {}
@@ -187,15 +184,13 @@ class DefaultImpl(with_metaclass(ImplMeta)):
                                     new_table_name, schema=schema))
 
     def create_table(self, table):
-        if util.sqla_07:
-            table.dispatch.before_create(table, self.connection,
-                                         checkfirst=False,
-                                         _ddl_runner=self)
+        table.dispatch.before_create(table, self.connection,
+                                     checkfirst=False,
+                                     _ddl_runner=self)
         self._exec(schema.CreateTable(table))
-        if util.sqla_07:
-            table.dispatch.after_create(table, self.connection,
-                                        checkfirst=False,
-                                        _ddl_runner=self)
+        table.dispatch.after_create(table, self.connection,
+                                    checkfirst=False,
+                                    _ddl_runner=self)
         for index in table.indexes:
             self._exec(schema.CreateIndex(index))
 
@@ -274,13 +269,7 @@ class DefaultImpl(with_metaclass(ImplMeta)):
         pass
 
     def _compat_autogen_column_reflect(self, inspector):
-        if util.sqla_08:
-            return self.autogen_column_reflect
-        else:
-            def adapt(table, column_info):
-                return self.autogen_column_reflect(
-                    inspector, table, column_info)
-            return adapt
+        return self.autogen_column_reflect
 
     def correct_for_autogen_foreignkeys(self, conn_fks, metadata_fks):
         pass
index a2a7dbccaa39165df71d4241474bf1464e37dc8e..d3998336fd550a211223fa0abceba92c193bc234 100644 (file)
@@ -20,10 +20,7 @@ from ..operations import schemaobj
 
 import logging
 
-if util.sqla_08:
-    from sqlalchemy.sql.expression import UnaryExpression
-else:
-    from sqlalchemy.sql.expression import _UnaryExpression as UnaryExpression
+from sqlalchemy.sql.expression import UnaryExpression
 
 if util.sqla_100:
     from sqlalchemy.dialects.postgresql import ExcludeConstraint
@@ -174,10 +171,7 @@ class PostgresqlImpl(DefaultImpl):
         for idx in list(metadata_indexes):
             if idx.name in conn_indexes_by_name:
                 continue
-            if util.sqla_08:
-                exprs = idx.expressions
-            else:
-                exprs = idx.columns
+            exprs = idx.expressions
             for expr in exprs:
                 while isinstance(expr, UnaryExpression):
                     expr = expr.element
index 5b562d623e4d8381b7f7b38deabd143198797f91..79ad533900f0769ef8da8d4830b3baa5867d8ff8 100644 (file)
@@ -4,8 +4,7 @@ from sqlalchemy import types as sqltypes
 from sqlalchemy import schema as sql_schema
 from sqlalchemy.util import OrderedDict
 from .. import util
-if util.sqla_08:
-    from sqlalchemy.events import SchemaEventTarget
+from sqlalchemy.events import SchemaEventTarget
 from ..util.sqla_compat import _columns_for_constraint, \
     _is_type_bound, _fk_is_self_referential, _remove_column_from_collection
 
@@ -14,9 +13,6 @@ class BatchOperationsImpl(object):
     def __init__(self, operations, table_name, schema, recreate,
                  copy_from, table_args, table_kwargs,
                  reflect_args, reflect_kwargs, naming_convention):
-        if not util.sqla_08:
-            raise NotImplementedError(
-                "batch mode requires SQLAlchemy 0.8 or greater.")
         self.operations = operations
         self.table_name = table_name
         self.schema = schema
index a01f5be286615118aaa6da701d3cc4672547b639..1014ace27bd4af418e9520960246498df729eb79 100644 (file)
@@ -46,9 +46,7 @@ class SchemaObjects(object):
         tname = "%s.%s" % (referent_schema, referent) if referent_schema \
                 else referent
 
-        if util.sqla_08:
-            # "match" kw unsupported in 0.7
-            dialect_kw['match'] = match
+        dialect_kw['match'] = match
 
         f = sa_schema.ForeignKeyConstraint(local_cols,
                                            ["%s.%s" % (tname, n)
index a5c7ee3962720e8f675c27d6de5626612c172dbc..141e82f7a8d7ca203b99d7e43728e71d5efea8cb 100644 (file)
@@ -305,11 +305,7 @@ def _prep_testing_database(options, file_config):
     from sqlalchemy import schema
     from alembic import util
 
-    if util.sqla_08:
-        from sqlalchemy import inspect
-    else:
-        from sqlalchemy.engine.reflection import Inspector
-        inspect = Inspector.from_engine
+    from sqlalchemy import inspect
 
     if options.dropfirst:
         for cfg in config.Config.all_configs():
index 32645ed8bfbb21edf4500aefb265664df978a5b9..400642f66ff66e90b0b26e4a79615165b8a71ac8 100644 (file)
@@ -20,8 +20,6 @@ class SuiteRequirements(Requirements):
     @property
     def unique_constraint_reflection(self):
         def doesnt_have_check_uq_constraints(config):
-            if not util.sqla_084:
-                return True
             from sqlalchemy import inspect
 
             # temporary
@@ -39,17 +37,11 @@ class SuiteRequirements(Requirements):
                 pass
             return False
 
-        return exclusions.skip_if(
-            lambda config: not util.sqla_084,
-            "SQLAlchemy 0.8.4 or greater required"
-        ) + exclusions.skip_if(doesnt_have_check_uq_constraints)
+        return exclusions.skip_if(doesnt_have_check_uq_constraints)
 
     @property
     def foreign_key_match(self):
-        return exclusions.fails_if(
-            lambda config: not util.sqla_08,
-            "MATCH for foreign keys added in SQLAlchemy 0.8.0"
-        )
+        return exclusions.open()
 
     @property
     def check_constraints_w_enforcement(self):
@@ -66,41 +58,6 @@ class SuiteRequirements(Requirements):
     def reflects_fk_options(self):
         return exclusions.closed()
 
-    @property
-    def fail_before_sqla_079(self):
-        return exclusions.fails_if(
-            lambda config: not util.sqla_079,
-            "SQLAlchemy 0.7.9 or greater required"
-        )
-
-    @property
-    def fail_before_sqla_080(self):
-        return exclusions.fails_if(
-            lambda config: not util.sqla_08,
-            "SQLAlchemy 0.8.0 or greater required"
-        )
-
-    @property
-    def fail_before_sqla_083(self):
-        return exclusions.fails_if(
-            lambda config: not util.sqla_083,
-            "SQLAlchemy 0.8.3 or greater required"
-        )
-
-    @property
-    def fail_before_sqla_084(self):
-        return exclusions.fails_if(
-            lambda config: not util.sqla_084,
-            "SQLAlchemy 0.8.4 or greater required"
-        )
-
-    @property
-    def fail_before_sqla_09(self):
-        return exclusions.fails_if(
-            lambda config: not util.sqla_09,
-            "SQLAlchemy 0.9.0 or greater required"
-        )
-
     @property
     def fail_before_sqla_100(self):
         return exclusions.fails_if(
@@ -129,21 +86,6 @@ class SuiteRequirements(Requirements):
             "SQLAlchemy 1.1.0 or greater required"
         )
 
-    @property
-    def sqlalchemy_08(self):
-
-        return exclusions.skip_if(
-            lambda config: not util.sqla_08,
-            "SQLAlchemy 0.8.0b2 or greater required"
-        )
-
-    @property
-    def sqlalchemy_09(self):
-        return exclusions.skip_if(
-            lambda config: not util.sqla_09,
-            "SQLAlchemy 0.9.0 or greater required"
-        )
-
     @property
     def sqlalchemy_092(self):
         return exclusions.skip_if(
@@ -158,6 +100,13 @@ class SuiteRequirements(Requirements):
             "SQLAlchemy 0.9.4 or greater required"
         )
 
+    @property
+    def sqlalchemy_099(self):
+        return exclusions.skip_if(
+            lambda config: not util.sqla_099,
+            "SQLAlchemy 0.9.9 or greater required"
+        )
+
     @property
     def sqlalchemy_100(self):
         return exclusions.skip_if(
index 8b5d8c78b97a02eaa948eee8c81363d8529d05a0..1e6c64561b9fc037cb29de6711926e7538e44822 100644 (file)
@@ -7,12 +7,11 @@ from .pyfiles import (  # noqa
     template_to_file, coerce_resource_to_filename,
     pyc_file_from_path, load_python_file, edit)
 from .sqla_compat import (  # noqa
-    sqla_07, sqla_079, sqla_08, sqla_083, sqla_084, sqla_09, sqla_092,
-    sqla_094, sqla_099, sqla_100, sqla_105, sqla_110, sqla_1010, sqla_1014,
-    sqla_1115)
+    sqla_09, sqla_092, sqla_094, sqla_099, sqla_100, sqla_105, sqla_110, sqla_1010,
+    sqla_1014, sqla_1115)
 from .exc import CommandError
 
 
-if not sqla_07:
+if not sqla_09:
     raise CommandError(
-        "SQLAlchemy 0.7.3 or greater is required. ")
+        "SQLAlchemy 0.9.0 or greater is required. ")
index 0bb36065feabfb391339be3dad643cdbd7543f80..b55cc3f975b7e881d5528354f33749f649ef34dd 100644 (file)
@@ -6,6 +6,7 @@ from sqlalchemy import schema, sql
 from sqlalchemy.sql.visitors import traverse
 from sqlalchemy.ext.compiler import compiles
 from sqlalchemy.sql.expression import _BindParamClause
+from sqlalchemy.sql.expression import _TextClause as TextClause
 from . import compat
 
 
@@ -16,11 +17,6 @@ def _safe_int(value):
         return value
 _vers = tuple(
     [_safe_int(x) for x in re.findall(r'(\d+|[abc]\d)', __version__)])
-sqla_07 = _vers > (0, 7, 2)
-sqla_079 = _vers >= (0, 7, 9)
-sqla_08 = _vers >= (0, 8, 0)
-sqla_083 = _vers >= (0, 8, 3)
-sqla_084 = _vers >= (0, 8, 4)
 sqla_09 = _vers >= (0, 9, 0)
 sqla_092 = _vers >= (0, 9, 2)
 sqla_094 = _vers >= (0, 9, 4)
@@ -33,16 +29,13 @@ sqla_110 = _vers >= (1, 1, 0)
 sqla_1014 = _vers >= (1, 0, 14)
 sqla_1115 = _vers >= (1, 1, 15)
 
-if sqla_08:
-    from sqlalchemy.sql.expression import TextClause
-else:
-    from sqlalchemy.sql.expression import _TextClause as TextClause
 
 if sqla_110:
     AUTOINCREMENT_DEFAULT = 'auto'
 else:
     AUTOINCREMENT_DEFAULT = True
 
+
 def _table_for_constraint(constraint):
     if isinstance(constraint, ForeignKeyConstraint):
         return constraint.parent
@@ -179,10 +172,7 @@ def _render_literal_bindparam(element, compiler, **kw):
 
 
 def _get_index_expressions(idx):
-    if sqla_08:
-        return list(idx.expressions)
-    else:
-        return list(idx.columns)
+    return list(idx.expressions)
 
 
 def _get_index_column_names(idx):
@@ -190,25 +180,22 @@ def _get_index_column_names(idx):
 
 
 def _get_index_final_name(dialect, idx):
-    if sqla_08:
-        # trying to keep the truncation rules totally localized on the
-        # SQLA side while also stepping around the quoting issue.   Ideally
-        # the _prepared_index_name() method on the SQLA side would have
-        # a quoting option or the truncation routine would be broken out.
-        #
-        # test for SQLA quoted_name construct, introduced in
-        # 0.9 or thereabouts.
-        # this doesn't work in 0.8 and the "quote" option on Index doesn't
-        # seem to work in 0.8 either.
-        if hasattr(idx.name, "quote"):
-            # might be quoted_name, might be truncated_name, keep it the
-            # same
-            quoted_name_cls = type(idx.name)
-            new_name = quoted_name_cls(str(idx.name), quote=False)
-            idx = schema.Index(name=new_name)
-        return dialect.ddl_compiler(dialect, None)._prepared_index_name(idx)
-    else:
-        return idx.name
+    # trying to keep the truncation rules totally localized on the
+    # SQLA side while also stepping around the quoting issue.   Ideally
+    # the _prepared_index_name() method on the SQLA side would have
+    # a quoting option or the truncation routine would be broken out.
+    #
+    # test for SQLA quoted_name construct, introduced in
+    # 0.9 or thereabouts.
+    # this doesn't work in 0.8 and the "quote" option on Index doesn't
+    # seem to work in 0.8 either.
+    if hasattr(idx.name, "quote"):
+        # might be quoted_name, might be truncated_name, keep it the
+        # same
+        quoted_name_cls = type(idx.name)
+        new_name = quoted_name_cls(str(idx.name), quote=False)
+        idx = schema.Index(name=new_name)
+    return dialect.ddl_compiler(dialect, None)._prepared_index_name(idx)
 
 
 def _is_mariadb(mysql_dialect):
index ea38cf2651c1993d9491b3e3082a689ee79d448f..574e5e65b93478864cea4add5268f57c355a5c3a 100644 (file)
@@ -38,8 +38,10 @@ Dependencies
 
 Alembic's install process will ensure that SQLAlchemy_
 is installed, in addition to other dependencies.  Alembic will work with
-SQLAlchemy as of version **0.7.3**, however more features are available with
-newer versions such as the 0.9 or 1.0 series.
+SQLAlchemy as of version **0.9.0**, however more features are available with
+newer versions such as the 1.1 or 1.2 series.
+
+.. versionchanged:: 1.0.0 Support for SQLAlchemy 0.8 and 0.7.9 was dropped.
 
 Alembic supports Python versions 2.7, 3.4 and above.
 
diff --git a/docs/build/unreleased/sqla_09_minimum.rst b/docs/build/unreleased/sqla_09_minimum.rst
new file mode 100644 (file)
index 0000000..53dd6f6
--- /dev/null
@@ -0,0 +1,5 @@
+.. change::
+    :tags: feature, general
+
+    With the 1.0 release, Alembic's minimum SQLAlchemy support version
+    moves to 0.9.0, previously 0.7.9.
index 3628916288d1ca75015cf0ac69b80a51675c0dbb..06621c8e4af816be634055d97b1e1f5e897726b2 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@ v.close()
 readme = os.path.join(os.path.dirname(__file__), 'README.rst')
 
 requires = [
-    'SQLAlchemy>=0.7.6',
+    'SQLAlchemy>=0.9.0',
     'Mako',
     'python-editor>=0.3',
     'python-dateutil'
index 0e5f076bf7b4d95623f31c31b2e96509ff0744e4..3dd66aea284a26116a9937fa853568a2d4b0b870 100644 (file)
@@ -476,7 +476,7 @@ class IncludeHooksTest(AutogenFixtureTest, TestBase):
 
 class AutogenerateFKOptionsTest(AutogenFixtureTest, TestBase):
     __backend__ = True
-    __requires__ = ('sqlalchemy_09', 'flexible_fk_cascades')
+    __requires__ = ('flexible_fk_cascades', )
 
     def _fk_opts_fixture(self, old_opts, new_opts):
         m1 = MetaData()
index 00793007a092e6a916d5fd0e8c646de85232002d..b588cbeb333e3ecb96ff7d978d54e425ecd1c609 100644 (file)
@@ -26,11 +26,9 @@ class NoUqReflection(object):
             raise NotImplementedError()
         eng.dialect.get_unique_constraints = unimpl
 
-    @config.requirements.fail_before_sqla_083
     def test_add_ix_on_table_create(self):
         return super(NoUqReflection, self).test_add_ix_on_table_create()
 
-    @config.requirements.fail_before_sqla_080
     def test_add_idx_non_col(self):
         return super(NoUqReflection, self).test_add_idx_non_col()
 
@@ -621,7 +619,6 @@ class AutogenerateUniqueIndexTest(AutogenFixtureTest, TestBase):
     # truncation rules either.    dropping these ancient versions
     # is long overdue.
 
-    @config.requirements.sqlalchemy_09
     def test_unchanged_case_sensitive_implicit_idx(self):
         m1 = MetaData()
         m2 = MetaData()
@@ -631,7 +628,6 @@ class AutogenerateUniqueIndexTest(AutogenFixtureTest, TestBase):
 
         eq_(diffs, [])
 
-    @config.requirements.sqlalchemy_09
     def test_unchanged_case_sensitive_explicit_idx(self):
         m1 = MetaData()
         m2 = MetaData()
@@ -1096,7 +1092,6 @@ class IncludeHooksTest(AutogenFixtureTest, TestBase):
 
 
 class TruncatedIdxTest(AutogenFixtureTest, TestBase):
-    __requires__ = ('sqlalchemy_09', )
 
     def setUp(self):
         self.bind = engines.testing_engine()
index a9bbf4d3a20d9c8c9634ec40ab2fca8a50f7c210..2bc8d825c66a9be86baa9ba2edd0d30de96565f0 100644 (file)
@@ -124,7 +124,6 @@ class AutogenRenderTest(TestBase):
                 "['active', 'code'], unique=False)"
             )
 
-    @config.requirements.fail_before_sqla_080
     def test_render_add_index_func(self):
         m = MetaData()
         t = Table(
@@ -141,7 +140,6 @@ class AutogenRenderTest(TestBase):
             "[sa.text(!U'lower(code)')], unique=False)"
         )
 
-    @config.requirements.fail_before_sqla_080
     def test_render_add_index_cast(self):
         m = MetaData()
         t = Table(
@@ -165,7 +163,6 @@ class AutogenRenderTest(TestBase):
                 "[sa.text(!U'CAST(code AS VARCHAR)')], unique=False)"
             )
 
-    @config.requirements.fail_before_sqla_080
     def test_render_add_index_desc(self):
         m = MetaData()
         t = Table(
@@ -413,8 +410,6 @@ class AutogenRenderTest(TestBase):
         t2 = Table('t2', m, Column('c_rem', Integer))
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], onupdate="CASCADE")
-        if not util.sqla_08:
-            t1.append_constraint(fk)
 
         # SQLA 0.9 generates a u'' here for remote cols while 0.8 does not,
         # so just whack out "'u" here from the generated
@@ -430,8 +425,6 @@ class AutogenRenderTest(TestBase):
         )
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], ondelete="CASCADE")
-        if not util.sqla_08:
-            t1.append_constraint(fk)
 
         op_obj = ops.AddConstraintOp.from_constraint(fk)
         eq_ignore_whitespace(
@@ -444,8 +437,6 @@ class AutogenRenderTest(TestBase):
         )
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], deferrable=True)
-        if not util.sqla_08:
-            t1.append_constraint(fk)
         op_obj = ops.AddConstraintOp.from_constraint(fk)
         eq_ignore_whitespace(
             re.sub(
@@ -457,8 +448,6 @@ class AutogenRenderTest(TestBase):
         )
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], initially="XYZ")
-        if not util.sqla_08:
-            t1.append_constraint(fk)
         op_obj = ops.AddConstraintOp.from_constraint(fk)
         eq_ignore_whitespace(
             re.sub(
@@ -472,8 +461,6 @@ class AutogenRenderTest(TestBase):
         fk = ForeignKeyConstraint(
             [t1.c.c], [t2.c.c_rem],
             initially="XYZ", ondelete="CASCADE", deferrable=True)
-        if not util.sqla_08:
-            t1.append_constraint(fk)
         op_obj = ops.AddConstraintOp.from_constraint(fk)
         eq_ignore_whitespace(
             re.sub(
@@ -729,7 +716,6 @@ class AutogenRenderTest(TestBase):
             "schema=%r)" % compat.ue('\u0411\u0435\u0437')
         )
 
-    @config.requirements.sqlalchemy_09
     def test_render_table_w_unsupported_constraint(self):
         from sqlalchemy.sql.schema import ColumnCollectionConstraint
 
@@ -1155,8 +1141,6 @@ class AutogenRenderTest(TestBase):
         t2 = Table('t2', m, Column('c_rem', Integer))
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], onupdate="CASCADE")
-        if not util.sqla_08:
-            t1.append_constraint(fk)
 
         # SQLA 0.9 generates a u'' here for remote cols while 0.8 does not,
         # so just whack out "'u" here from the generated
@@ -1170,8 +1154,6 @@ class AutogenRenderTest(TestBase):
         )
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], ondelete="CASCADE")
-        if not util.sqla_08:
-            t1.append_constraint(fk)
 
         eq_ignore_whitespace(
             re.sub(
@@ -1182,8 +1164,6 @@ class AutogenRenderTest(TestBase):
         )
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], deferrable=True)
-        if not util.sqla_08:
-            t1.append_constraint(fk)
         eq_ignore_whitespace(
             re.sub(
                 r"u'", "'",
@@ -1194,8 +1174,6 @@ class AutogenRenderTest(TestBase):
         )
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], initially="XYZ")
-        if not util.sqla_08:
-            t1.append_constraint(fk)
         eq_ignore_whitespace(
             re.sub(
                 r"u'", "'",
@@ -1208,8 +1186,6 @@ class AutogenRenderTest(TestBase):
         fk = ForeignKeyConstraint(
             [t1.c.c], [t2.c.c_rem],
             initially="XYZ", ondelete="CASCADE", deferrable=True)
-        if not util.sqla_08:
-            t1.append_constraint(fk)
         eq_ignore_whitespace(
             re.sub(
                 r"u'", "'",
@@ -1312,8 +1288,6 @@ class AutogenRenderTest(TestBase):
         t2 = Table('t2', m, Column('c_rem', Integer))
 
         fk = ForeignKeyConstraint([t1.c.c], [t2.c.c_rem], onupdate="CASCADE")
-        if not util.sqla_08:
-            t1.append_constraint(fk)
 
         eq_ignore_whitespace(
             re.sub(
@@ -1346,7 +1320,6 @@ class AutogenRenderTest(TestBase):
             "sa.CheckConstraint(!U'c > 5 AND c < 10')"
         )
 
-    @config.requirements.fail_before_sqla_080
     def test_render_check_constraint_literal_binds(self):
         c = column('c')
         eq_ignore_whitespace(
@@ -1395,7 +1368,6 @@ class AutogenRenderTest(TestBase):
             "existing_server_default='5')"
         )
 
-    @config.requirements.fail_before_sqla_079
     def test_render_enum(self):
         eq_ignore_whitespace(
             autogenerate.render._repr_type(
@@ -1410,10 +1382,7 @@ class AutogenRenderTest(TestBase):
             "sa.Enum('one', 'two', 'three')"
         )
 
-    @exclusions.fails_if(
-        lambda config: (util.sqla_09 and not util.sqla_099) or not util.sqla_079,
-        "Fails on SQLAlchemy <0.7.9, 0.9.0-0.9.8"
-    )
+    @config.requirements.sqlalchemy_099
     def test_render_non_native_enum(self):
         eq_ignore_whitespace(
             autogenerate.render._repr_type(
@@ -1508,7 +1477,6 @@ class AutogenRenderTest(TestBase):
             "user.MyType()"
         )
 
-    @config.requirements.sqlalchemy_09
     def test_repr_dialect_type(self):
         from sqlalchemy.dialects.mysql import VARCHAR
 
@@ -1539,7 +1507,6 @@ class AutogenRenderTest(TestBase):
             'nullable=False)'
         )
 
-    @config.requirements.fail_before_sqla_09
     def test_render_server_default_non_native_boolean(self):
         c = Column(
             'updated_at', Boolean(),
index 07a55363defe7b259d99cccdd63ef348c4e93b4a..7ea1bcc15081a2b4899ff04eca04e17ee19ab08c 100644 (file)
@@ -21,7 +21,6 @@ from sqlalchemy import exc
 
 
 class BatchApplyTest(TestBase):
-    __requires__ = ('sqlalchemy_08', )
 
     def setUp(self):
         self.op = Operations(mock.Mock(opts={}))
@@ -420,9 +419,6 @@ class BatchApplyTest(TestBase):
             ddl_contains='FOREIGN KEY(user_id_3, user_id_version) '
             'REFERENCES "user" (id, id_version)')
 
-    # _get_colspec() in 0.8 calls upon fk.column when schema is
-    # present.  not sure if we want to try to fix this
-    @config.requirements.fail_before_sqla_09
     def test_regen_multi_fk_schema(self):
         impl = self._multi_fk_fixture(schema='foo_schema')
         self._assert_impl(
@@ -558,7 +554,6 @@ class BatchApplyTest(TestBase):
 
 
 class BatchAPITest(TestBase):
-    __requires__ = ('sqlalchemy_08', )
 
     @contextmanager
     def _fixture(self, schema=None):
@@ -754,7 +749,6 @@ class BatchAPITest(TestBase):
 
 
 class CopyFromTest(TestBase):
-    __requires__ = ('sqlalchemy_08', )
 
     def _fixture(self):
         self.metadata = MetaData()
@@ -918,7 +912,6 @@ class CopyFromTest(TestBase):
 
 
 class BatchRoundTripTest(TestBase):
-    __requires__ = ('sqlalchemy_09', )
     __only_on__ = "sqlite"
 
     def setUp(self):
index 5db1d7e071f822c77023f0b8b23ced774f54d121..dc01b755a9f270c0e036b34346d6fad52efac28d 100644 (file)
@@ -67,7 +67,6 @@ class FOOBARTYPE(sqla_types.TypeEngine):
 
 
 class ExternalDialectRenderTest(TestBase):
-    __requires__ = ('sqlalchemy_09', )
 
     def setUp(self):
         ctx_opts = {
index b369cfc0f23570cb14ae366c59e364017f4913be..805c23b37820aae01f8409b1f25fab810dc30caf 100644 (file)
@@ -95,7 +95,6 @@ class OpTest(TestBase):
                         nullable=False)
         context.assert_('ALTER TABLE tests ALTER COLUMN col BIT NOT NULL')
 
-    @config.requirements.fail_before_sqla_084
     def test_drop_index(self):
         context = op_fixture('mssql')
         op.drop_index('my_idx', 'my_table')
@@ -109,7 +108,6 @@ class OpTest(TestBase):
             "exec('alter table t1 drop constraint ' + @const_name)")
         context.assert_contains("ALTER TABLE t1 DROP COLUMN c1")
 
-    @config.requirements.sqlalchemy_08
     def test_drop_column_w_default_in_batch(self):
         context = op_fixture('mssql')
         with op.batch_alter_table('t1', schema=None) as batch_op:
@@ -143,7 +141,6 @@ class OpTest(TestBase):
             "exec('alter table t1 drop constraint ' + @const_name)")
         context.assert_contains("ALTER TABLE t1 DROP COLUMN c1")
 
-    @config.requirements.sqlalchemy_08
     def test_drop_column_w_check_in_batch(self):
         context = op_fixture('mssql')
         with op.batch_alter_table('t1', schema=None) as batch_op:
@@ -174,7 +171,6 @@ class OpTest(TestBase):
             "exec('alter table t1 drop constraint ' + @const_name)")
         context.assert_contains("ALTER TABLE t1 DROP COLUMN c1")
 
-    @config.requirements.sqlalchemy_08
     def test_drop_column_w_fk_in_batch(self):
         context = op_fixture('mssql')
         with op.batch_alter_table('t1', schema=None) as batch_op:
index 68279bd6c64ac57955950116f702bce0c03f40dd..63e4a7481117d44c6b4126ffa52910732991a554 100644 (file)
@@ -40,7 +40,6 @@ class OpTest(TestBase):
             op.create_index, 'name', 'tname', [func.foo(column('x'))]
         )
 
-    @config.requirements.sqlalchemy_09
     def test_add_column_schema_hard_quoting(self):
         from sqlalchemy.sql.schema import quoted_name
         context = op_fixture("postgresql")
@@ -52,7 +51,6 @@ class OpTest(TestBase):
             'ALTER TABLE "some.schema".somename ADD COLUMN colname VARCHAR'
         )
 
-    @config.requirements.sqlalchemy_09
     def test_rename_table_schema_hard_quoting(self):
         from sqlalchemy.sql.schema import quoted_name
         context = op_fixture("postgresql")
@@ -64,7 +62,6 @@ class OpTest(TestBase):
             'ALTER TABLE "some.schema".t1 RENAME TO t2'
         )
 
-    @config.requirements.sqlalchemy_09
     def test_add_constraint_schema_hard_quoting(self):
         from sqlalchemy.sql.schema import quoted_name
         context = op_fixture("postgresql")
@@ -88,7 +85,6 @@ class OpTest(TestBase):
         context.assert_(
             'CREATE INDEX geocoded ON locations ("IShouldBeQuoted")')
 
-    @config.requirements.fail_before_sqla_080
     def test_create_index_expressions(self):
         context = op_fixture()
         op.create_index(
@@ -667,7 +663,6 @@ class OpTest(TestBase):
             "CREATE UNIQUE INDEX ik_test ON t1 (foo, bar)"
         )
 
-    @config.requirements.fail_before_sqla_09
     def test_create_index_quote_flag(self):
         context = op_fixture()
         op.create_index('ik_test', 't1', ['foo', 'bar'], quote=True)
@@ -845,7 +840,6 @@ class OpTest(TestBase):
         op.drop_constraint("f1", "t1", type_="foreignkey")
         context.assert_("ALTER TABLE t1 DROP FOREIGN KEY f1")
 
-    @config.requirements.fail_before_sqla_084
     def test_naming_changes_drop_idx(self):
         context = op_fixture('mssql')
         op.drop_index('ik_test', tablename='t1')
@@ -853,7 +847,6 @@ class OpTest(TestBase):
 
 
 class SQLModeOpTest(TestBase):
-    @config.requirements.sqlalchemy_09
     def test_auto_literals(self):
         context = op_fixture(as_sql=True, literal_binds=True)
         from sqlalchemy.sql import table, column
index cbf0f2f0ffc03ba4b2da3d2eebbbc14d50a496fc..23ec49ca3dbbadde12d6dedf6214abff508bf965 100644 (file)
@@ -47,7 +47,6 @@ class PostgresqlOpTest(TestBase):
         op.rename_table('t1', 't2', schema="foo")
         context.assert_("ALTER TABLE foo.t1 RENAME TO t2")
 
-    @config.requirements.fail_before_sqla_080
     def test_create_index_postgresql_expressions(self):
         context = op_fixture("postgresql")
         op.create_index(
@@ -196,7 +195,6 @@ def downgrade():
 
 """ % self.rid)
 
-    @config.requirements.sqlalchemy_09
     def test_offline_inline_enum_create(self):
         self._inline_enum_script()
         with capture_context_buffer() as buf:
@@ -213,7 +211,6 @@ def downgrade():
         # no drop since we didn't emit events
         assert "DROP TYPE pgenum" not in buf.getvalue()
 
-    @config.requirements.sqlalchemy_09
     def test_offline_distinct_enum_create(self):
         self._distinct_enum_script()
         with capture_context_buffer() as buf:
@@ -638,20 +635,12 @@ class PostgresqlAutogenRenderTest(TestBase):
 
         op_obj = ops.CreateIndexOp.from_index(idx)
 
-        if util.sqla_08:
-            eq_ignore_whitespace(
-                autogenerate.render_op_text(autogen_context, op_obj),
-                """op.create_index('foo_idx', 't', \
+        eq_ignore_whitespace(
+            autogenerate.render_op_text(autogen_context, op_obj),
+            """op.create_index('foo_idx', 't', \
 ['x', 'y'], unique=False, """
-                """postgresql_where=sa.text(!U"y = 'something'"))"""
-            )
-        else:
-            eq_ignore_whitespace(
-                autogenerate.render_op_text(autogen_context, op_obj),
-                """op.create_index('foo_idx', 't', ['x', 'y'], \
-unique=False, """
-                """postgresql_where=sa.text(!U't.y = %(y_1)s'))"""
-            )
+            """postgresql_where=sa.text(!U"y = 'something'"))"""
+        )
 
     def test_render_server_default_native_boolean(self):
         c = Column(
@@ -668,7 +657,6 @@ unique=False, """
             'nullable=False)'
         )
 
-    @config.requirements.sqlalchemy_09
     def test_postgresql_array_type(self):
 
         eq_ignore_whitespace(
@@ -744,7 +732,6 @@ unique=False, """
         assert 'from sqlalchemy.dialects import postgresql' in \
             self.autogen_context.imports
 
-    @config.requirements.sqlalchemy_09
     def test_array_type_user_defined_inner(self):
         def repr_type(typestring, object_, autogen_context):
             if typestring == 'type' and isinstance(object_, String):
@@ -874,7 +861,6 @@ unique=False, """
             "name='TExclX'))"
         )
 
-    @config.requirements.sqlalchemy_09
     def test_json_type(self):
         if config.requirements.sqlalchemy_110.enabled:
             eq_ignore_whitespace(
@@ -889,7 +875,6 @@ unique=False, """
                 "postgresql.JSON()"
             )
 
-    @config.requirements.sqlalchemy_09
     def test_jsonb_type(self):
         if config.requirements.sqlalchemy_110.enabled:
             eq_ignore_whitespace(