summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-04-24 12:01:04 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-04-24 12:01:04 -0400
commit998c66fa8b1997453c793da5faa7d4cc436739b2 (patch)
tree78303f321f4d97304c24c105ea57658d15abaac8
parent2086728eb5c9d25d7e604fc0fc468d5ce5464122 (diff)
downloadsqlalchemy-998c66fa8b1997453c793da5faa7d4cc436739b2.tar.gz
- [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]
-rw-r--r--CHANGES8
-rw-r--r--lib/sqlalchemy/engine/reflection.py2
-rw-r--r--lib/sqlalchemy/events.py6
-rw-r--r--test/engine/test_reflection.py2
4 files changed, 13 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index f8bf29317..23f17335d 100644
--- 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
diff --git a/lib/sqlalchemy/engine/reflection.py b/lib/sqlalchemy/engine/reflection.py
index b2a5a02ef..4ad3595c3 100644
--- a/lib/sqlalchemy/engine/reflection.py
+++ b/lib/sqlalchemy/engine/reflection.py
@@ -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:
diff --git a/lib/sqlalchemy/events.py b/lib/sqlalchemy/events.py
index 18888be03..99af804f6 100644
--- a/lib/sqlalchemy/events.py
+++ b/lib/sqlalchemy/events.py
@@ -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"
# ...
diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py
index e59849d98..371a4c1b4 100644
--- a/test/engine/test_reflection.py
+++ b/test/engine/test_reflection.py
@@ -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)