Commits

Mike Bayer  committed 4f83d45

- deregister Table from MetaData when autoload fails; [ticket:289]

  • Participants
  • Parent commits 98beeb2

Comments (0)

Files changed (2)

 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

File lib/sqlalchemy/schema.py

             # 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)