Explorar o código

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

Romain %!s(int64=5) %!d(string=hai) anos
pai
achega
7f44c7fcec
Modificáronse 1 ficheiros con 2 adicións e 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')