Browse Source

[sqlalchemy] Hadle when /autocomplete API used to check if table exists

Romain Rigaux 4 years ago
parent
commit
ceb26e639e
1 changed files with 5 additions and 1 deletions
  1. 5 1
      desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

+ 5 - 1
desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

@@ -598,7 +598,11 @@ class Assist(object):
 
   def get_keys(self, database, table):
     meta = MetaData()
-    metaTable = Table(table, meta, schema=database, autoload=True, autoload_with=self.engine)
+    try:
+      metaTable = Table(table, meta, schema=database, autoload=True, autoload_with=self.engine)
+    except ProgrammingError:
+      LOG.debug("Table %s.%s could not be found and this is probably expected" % (database, table))
+      return {}
 
     return {
       'foreign_keys': [{