|
@@ -16,6 +16,7 @@
|
|
|
# limitations under the License.
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
import logging
|
|
import logging
|
|
|
|
|
+import json
|
|
|
|
|
|
|
|
from django.http import QueryDict, HttpResponse
|
|
from django.http import QueryDict, HttpResponse
|
|
|
from rest_framework.decorators import api_view
|
|
from rest_framework.decorators import api_view
|
|
@@ -93,6 +94,15 @@ def execute(request, dialect=None):
|
|
|
'snippet': '{"id":%(interpreter_id)s,"type":"%(interpreter)s","result":{},"statement":"%(statement)s","properties":{}}' % params
|
|
'snippet': '{"id":%(interpreter_id)s,"type":"%(interpreter)s","result":{},"statement":"%(statement)s","properties":{}}' % params
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ # Optional database param for specific query statements like "show tables;"
|
|
|
|
|
+ if django_request.POST.get('database'):
|
|
|
|
|
+ database = django_request.POST.get('database')
|
|
|
|
|
+ snippet = json.loads(data['snippet'])
|
|
|
|
|
+ snippet['database'] = database
|
|
|
|
|
+
|
|
|
|
|
+ data['snippet'] = json.dumps(snippet)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
django_request.POST = QueryDict(mutable=True)
|
|
django_request.POST = QueryDict(mutable=True)
|
|
|
django_request.POST.update(data)
|
|
django_request.POST.update(data)
|
|
|
|
|
|