|
@@ -331,14 +331,14 @@ def config_validator(user, interpreters=None):
|
|
|
res.append(('Editor', _('Could not authenticate with user %s to validate interpreters') % user))
|
|
res.append(('Editor', _('Could not authenticate with user %s to validate interpreters') % user))
|
|
|
|
|
|
|
|
if interpreters is None:
|
|
if interpreters is None:
|
|
|
- connectors = get_ordered_interpreters(user=user)
|
|
|
|
|
|
|
+ interpreters = get_ordered_interpreters(user=user)
|
|
|
|
|
|
|
|
for interpreter in interpreters:
|
|
for interpreter in interpreters:
|
|
|
if interpreter.get('is_sql'):
|
|
if interpreter.get('is_sql'):
|
|
|
connector_id = interpreter['type']
|
|
connector_id = interpreter['type']
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
- response = _excute_test_query(client, connector_id)
|
|
|
|
|
|
|
+ response = _excute_test_query(client, connector_id, interpreter=interpreter)
|
|
|
data = json.loads(response.content)
|
|
data = json.loads(response.content)
|
|
|
|
|
|
|
|
if data['status'] != 0:
|
|
if data['status'] != 0:
|
|
@@ -360,7 +360,7 @@ def config_validator(user, interpreters=None):
|
|
|
return res
|
|
return res
|
|
|
|
|
|
|
|
|
|
|
|
|
-def _excute_test_query(client, connector_id):
|
|
|
|
|
|
|
+def _excute_test_query(client, connector_id, interpreter=None):
|
|
|
'''
|
|
'''
|
|
|
Helper utils until the API gets simplified.
|
|
Helper utils until the API gets simplified.
|
|
|
'''
|
|
'''
|
|
@@ -368,8 +368,8 @@ def _excute_test_query(client, connector_id):
|
|
|
{
|
|
{
|
|
|
"selectedSnippet": "hive",
|
|
"selectedSnippet": "hive",
|
|
|
"showHistory": false,
|
|
"showHistory": false,
|
|
|
- "description": "Test Hive Query",
|
|
|
|
|
- "name": "Test Hive Query",
|
|
|
|
|
|
|
+ "description": "Test Query",
|
|
|
|
|
+ "name": "Test Query",
|
|
|
"sessions": [
|
|
"sessions": [
|
|
|
{
|
|
{
|
|
|
"type": "hive",
|
|
"type": "hive",
|
|
@@ -383,13 +383,15 @@ def _excute_test_query(client, connector_id):
|
|
|
"uuid": "d9efdee1-ef25-4d43-b8f9-1a170f69a05a"
|
|
"uuid": "d9efdee1-ef25-4d43-b8f9-1a170f69a05a"
|
|
|
}
|
|
}
|
|
|
""" % {
|
|
""" % {
|
|
|
- 'connector_id': connector_id
|
|
|
|
|
|
|
+ 'connector_id': connector_id,
|
|
|
}
|
|
}
|
|
|
|
|
+ snippet = json.loads(notebook_json)['snippets'][0]
|
|
|
|
|
+ snippet['interpreter'] = interpreter
|
|
|
|
|
|
|
|
return client.post(
|
|
return client.post(
|
|
|
reverse('notebook:api_sample_data', kwargs={'database': 'default', 'table': 'default'}), {
|
|
reverse('notebook:api_sample_data', kwargs={'database': 'default', 'table': 'default'}), {
|
|
|
'notebook': notebook_json,
|
|
'notebook': notebook_json,
|
|
|
- 'snippet': json.dumps(json.loads(notebook_json)['snippets'][0]),
|
|
|
|
|
|
|
+ 'snippet': json.dumps(snippet),
|
|
|
'is_async': json.dumps(True),
|
|
'is_async': json.dumps(True),
|
|
|
'operation': json.dumps('hello')
|
|
'operation': json.dumps('hello')
|
|
|
})
|
|
})
|