]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- [feature] The column_reflect event now
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 Apr 2012 16:01:04 +0000 (12:01 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 Apr 2012 16:01:04 +0000 (12:01 -0400)
accepts the Inspector object as the first
argument, preceding "table".   Code which
uses the 0.7 version of this very new
event will need modification to add the
"inspector" object as the first argument.
[ticket:2418]

CHANGES
lib/sqlalchemy/engine/reflection.py
lib/sqlalchemy/events.py
test/engine/test_reflection.py

diff --git a/CHANGES b/CHANGES
index f8bf29317e8737bdc0e8f0d5792b71db9c143204..23f17335dbef900593b2c338417fe851e0520755 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -128,6 +128,14 @@ CHANGES
     acquired using the new inspect() service,
     part of [ticket:2208]
 
+  - [feature] The column_reflect event now
+    accepts the Inspector object as the first
+    argument, preceding "table".   Code which
+    uses the 0.7 version of this very new 
+    event will need modification to add the 
+    "inspector" object as the first argument.  
+    [ticket:2418]
+
   - [bug] Removed warning when Index is created
     with no columns; while this might not be what 
     the user intended, it is a valid use case 
index b2a5a02eff9877e4864b496acadf2f1b5817de16..4ad3595c3b06bfc813acbd5b7079d5fdb85261ba 100644 (file)
@@ -374,7 +374,7 @@ class Inspector(object):
         found_table = False
         for col_d in self.get_columns(table_name, schema, **tblkw):
             found_table = True
-            table.dispatch.column_reflect(table, col_d)
+            table.dispatch.column_reflect(self, table, col_d)
 
             name = col_d['name']
             if include_columns and name not in include_columns:
index 18888be0395a99ca3848c46b5c34d43a1b5cfc0a..99af804f61e2525dfae51d41269fcc94a4a05b39 100644 (file)
@@ -166,7 +166,7 @@ class DDLEvents(event.Events):
         
         """
 
-    def column_reflect(self, table, column_info):
+    def column_reflect(self, inspector, table, column_info):
         """Called for each unit of 'column info' retrieved when
         a :class:`.Table` is being reflected.   
         
@@ -188,7 +188,7 @@ class DDLEvents(event.Events):
             from sqlalchemy.schema import Table
             from sqlalchemy import event
 
-            def listen_for_reflect(table, column_info):
+            def listen_for_reflect(inspector, table, column_info):
                 "receive a column_reflect event"
                 # ...
                 
@@ -200,7 +200,7 @@ class DDLEvents(event.Events):
         ...or with a specific :class:`.Table` instance using
         the ``listeners`` argument::
         
-            def listen_for_reflect(table, column_info):
+            def listen_for_reflect(inspector, table, column_info):
                 "receive a column_reflect event"
                 # ...
                 
index e59849d98f77af184679f2d22d2a0df5d82e9b30..371a4c1b4b62e4bc5108764ebdce9f4e382bdc6a 100644 (file)
@@ -1645,7 +1645,7 @@ class ColumnEventsTest(fixtures.TestBase):
         from sqlalchemy.schema import Table
 
         m = MetaData(testing.db)
-        def column_reflect(table, column_info):
+        def column_reflect(insp, table, column_info):
             if column_info['name'] == col:
                 column_info.update(update)