Explorar el Código

HUE-8758 [connector] Avoid key error when saving query without connector

Romain hace 5 años
padre
commit
7f44c7fcec
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      desktop/libs/notebook/src/notebook/api.py

+ 2 - 1
desktop/libs/notebook/src/notebook/api.py

@@ -462,7 +462,8 @@ def get_logs(request):
 def _save_notebook(notebook, user):
   if notebook['snippets'][0].get('connector') and notebook['snippets'][0]['connector'].get('dialect'):  # TODO Connector unification
     notebook_type = 'query-%(dialect)s' % notebook['snippets'][0]['connector']
-    notebook['snippets'][0]['executor']['executables'] = []
+    if notebook['snippets'][0] and notebook['snippets'][0].get('executor'):
+      notebook['snippets'][0]['executor']['executables'] = []
   else:
     notebook_type = notebook.get('type', 'notebook')