Преглед изворни кода

HUE-9561 [SQLAlchemy] Default selected DB does not seem to be used

ayush.goyal пре 5 година
родитељ
комит
08a0dad0cc
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

+ 3 - 0
desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

@@ -227,6 +227,9 @@ class SqlAlchemyApi(Api):
         self.interpreter.get('dialect_properties') and self.interpreter['dialect_properties']['trim_statement_semicolon']:
       statement = statement.strip().rstrip(';')
 
+    if snippet.get('database'):
+      connection.execute('USE ' + snippet['database'])
+
     result = connection.execute(statement)
 
     cache = {