Skip to content

Commit

Permalink
[notebook] fix notebook saving type
Browse files Browse the repository at this point in the history
 * [notebook] use notebook type instead of the first snippet's type
  • Loading branch information
sumtumn committed Aug 10, 2023
1 parent 4bc91b5 commit abd4ce6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions desktop/libs/notebook/src/notebook/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,9 @@ 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']
if notebook['snippets'][0] and notebook['snippets'][0].get('executor'):
notebook['snippets'][0]['executor']['executables'] = []
else:
notebook_type = notebook.get('type', 'notebook')
notebook_type = notebook.get('type', 'notebook')

save_as = False

Expand Down
4 changes: 2 additions & 2 deletions desktop/libs/notebook/src/notebook/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_save_notebook_with_connector_off(self):

assert_equal(0, data['status'], data)
doc = Document2.objects.get(pk=data['id'])
assert_equal('query-mysql', doc.type)
assert_equal('query-hive', doc.type)


def test_save_notebook_with_connector_on(self):
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_save_notebook_with_connector_on(self):

assert_equal(0, data['status'], data)
doc = Document2.objects.get(pk=data['id'])
assert_equal('query-mysql', doc.type)
assert_equal('query-hive', doc.type)


def test_historify(self):
Expand Down

0 comments on commit abd4ce6

Please sign in to comment.