|
|
@ -1,11 +1,10 @@ |
|
|
|
import json |
|
|
|
import uuid |
|
|
|
from django.http import JsonResponse |
|
|
|
from django.core import serializers |
|
|
|
from django.utils import timezone |
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
from MySQLdb import _mysql |
|
|
|
from django.core import serializers |
|
|
|
from vislib.models import SourceDataBase |
|
|
|
from django.utils import timezone |
|
|
|
from common.utils.aes import pc |
|
|
|
# Create your views here. |
|
|
|
|
|
|
@ -16,6 +15,7 @@ def default_datetime(): |
|
|
|
|
|
|
|
@csrf_exempt |
|
|
|
def execSql(request): |
|
|
|
try: |
|
|
|
body_unicode = request.body.decode('utf-8') |
|
|
|
body = json.loads(body_unicode) |
|
|
|
sql = body['sql'] |
|
|
@ -48,6 +48,7 @@ def execSql(request): |
|
|
|
column = (key.split('.'))[1] |
|
|
|
else: |
|
|
|
column = key |
|
|
|
print(row[key], key) |
|
|
|
if isinstance(row[key], bytes): |
|
|
|
json_data[index][column] = row[key].decode('UTF-8') |
|
|
|
else: |
|
|
@ -57,4 +58,11 @@ def execSql(request): |
|
|
|
'message': 'success', |
|
|
|
'data': json_data |
|
|
|
} |
|
|
|
except Exception as e: |
|
|
|
print(e) |
|
|
|
response = { |
|
|
|
'code': 10000, |
|
|
|
'message': 'fail', |
|
|
|
'data': e |
|
|
|
} |
|
|
|
return JsonResponse(response) |
|
|
|