소스 검색

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

Romain 5 년 전
부모
커밋
7f44c7fcec
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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')