changeset 509:85495d4d6c73

raise NotImplemented for graceful failure
author catherine.devlin@gmail.com
date Thu, 23 Sep 2010 12:52:56 -0400
parents 6f6e43ed656c
children c8de86e7cd06
files sqlpython/connections.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/connections.py	Thu Sep 23 09:42:28 2010 -0400
+++ b/sqlpython/connections.py	Thu Sep 23 12:52:56 2010 -0400
@@ -239,8 +239,10 @@
     gerald_types = {'TABLE': gerald.oracle_schema.Table,
                     'VIEW': gerald.oracle_schema.View}
     def object_metadata(self, owner, object_type, name):
-        return self.gerald_types[object_type](name, self.connection.cursor(), owner)
-                      
+        if object_type in self.gerald_types:
+            return self.gerald_types[object_type](name, self.connection.cursor(), owner)
+        else:
+            raise NotImplementedError, '%s not implemented for this RDBMS' % object_type
 
 parser = optparse.OptionParser()
 parser.add_option('--postgres', action='store_true', help='Connect to postgreSQL: `connect --postgres [DBNAME [USERNAME]]`')