]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
set info_cache class
authorRandall Smith <randall@tnr.cc>
Wed, 11 Feb 2009 06:29:39 +0000 (06:29 +0000)
committerRandall Smith <randall@tnr.cc>
Wed, 11 Feb 2009 06:29:39 +0000 (06:29 +0000)
lib/sqlalchemy/dialects/postgres/base.py

index b4cf4350584f017bc02c404e5afea06ef82a13a0..a27af65ddd5b9da2aeda072f164311cc0728959f 100644 (file)
@@ -432,6 +432,7 @@ class PGDialect(default.DefaultDialect):
     type_compiler = PGTypeCompiler
     preparer = PGIdentifierPreparer
     defaultrunner = PGDefaultRunner
+    info_cache = PGInfoCache
 
 
     def do_begin_twophase(self, connection, xid):
@@ -613,9 +614,9 @@ class PGDialect(default.DefaultDialect):
         else:
             current_schema = self.get_default_schema_name(connection)
         if info_cache:
-            view = info_cache.getView(viewname, current_schema)
-            if view.get('definition'):
-                return view['definition']
+            view_cache = info_cache.getView(viewname, current_schema)
+            if view_cache and 'definition' in view_cache:
+                return view_cache['definition']
         s = """
         SELECT definition FROM pg_views
         WHERE schemaname = :schemaname