]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- deregister Table from MetaData when autoload fails; [ticket:289]
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 28 Aug 2006 16:55:22 +0000 (16:55 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 28 Aug 2006 16:55:22 +0000 (16:55 +0000)
CHANGES
lib/sqlalchemy/schema.py

diff --git a/CHANGES b/CHANGES
index 9ae530ace4014cb7a478a264dd1cbf3c0aac762c..dd70988986879985d3ae74dd0611d5383ca98731 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -51,6 +51,7 @@ returns datetimes with tzinfo's if available, which can create confusion
 against datetimes that dont).
 - fix to using query.count() with distinct, **kwargs with SelectResults
 count() [ticket:287]
+- deregister Table from MetaData when autoload fails; [ticket:289]
 
 0.2.7
 - quoting facilities set up so that database-specific quoting can be
index bb9e534c7b948b13a92cd610524767e48651df93..f4e89ef245be98491ebf929ba164780ec8572ab0 100644 (file)
@@ -91,10 +91,14 @@ class TableSingleton(type):
             # we do it after the table is in the singleton dictionary to support
             # circular foreign keys
             if autoload:
-                if autoload_with:
-                    autoload_with.reflecttable(table)
-                else:
-                    metadata.engine.reflecttable(table)
+                try:
+                    if autoload_with:
+                        autoload_with.reflecttable(table)
+                    else:
+                        metadata.engine.reflecttable(table)
+                except exceptions.NoSuchTableError:
+                    table.deregister()
+                    raise
             # initialize all the column, etc. objects.  done after
             # reflection to allow user-overrides
             table._init_items(*args)