]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- compat for sqla 0.7
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 20 Sep 2014 22:33:00 +0000 (18:33 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 20 Sep 2014 22:33:00 +0000 (18:33 -0400)
alembic/autogenerate/compare.py
alembic/ddl/impl.py

index 1f9cf77e9e6b759cec97adb167d0b79cd45c79f5..dbc7b9f3034751d93757fb26c90f36ec80c9ec52 100644 (file)
@@ -69,7 +69,8 @@ def _compare_tables(conn_table_names, metadata_table_names,
             event.listen(
                 t,
                 "column_reflect",
-                autogen_context['context'].impl.autogen_column_reflect)
+                autogen_context['context'].impl.
+                _compat_autogen_column_reflect(inspector))
             inspector.reflecttable(t, None)
         if _run_filters(t, tname, "table", True, None, object_filters):
             diffs.append(("remove_table", t))
@@ -87,7 +88,8 @@ def _compare_tables(conn_table_names, metadata_table_names,
             event.listen(
                 t,
                 "column_reflect",
-                autogen_context['context'].impl.autogen_column_reflect)
+                autogen_context['context'].impl.
+                _compat_autogen_column_reflect(inspector))
             inspector.reflecttable(t, None)
         conn_column_info[(s, tname)] = t
 
index 9f75acc615e95cb1a9b7c082d4844d019ca8807d..3e4f6e24edaf93d981e45617b2020498099d143c 100644 (file)
@@ -231,6 +231,15 @@ class DefaultImpl(with_metaclass(ImplMeta)):
                                         metadata_indexes):
         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
+
     def autogen_column_reflect(self, inspector, table, column_info):
         """A hook that is attached to the 'column_reflect' event for when
         a Table is reflected from the database during the autogenerate