Explorar el Código

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

ayush.goyal hace 5 años
padre
commit
08a0dad0cc
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  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 = {