Skip to content

Commit

Permalink
Various merge fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jezdez committed Dec 19, 2018
1 parent 5584b7b commit e621b1e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion redash/handlers/query_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get(self, query_id=None, filetype='json'):
for r in results:
aggregate_result['data']['rows'].extend(r['data']['rows'])

data = json.dumps({'query_result': aggregate_result}, cls=utils.JSONEncoder)
data = json_dumps({'query_result': aggregate_result})
headers = {'Content-Type': "application/json"}
return make_response(data, 200, headers)

Expand Down
4 changes: 2 additions & 2 deletions redash/query_runner/db2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging

from redash.query_runner import *
from redash.utils import JSONEncoder
from redash.utils import json_dumps

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -129,7 +129,7 @@ def run_query(self, query, user):

data = {'columns': columns, 'rows': rows}
error = None
json_data = json.dumps(data, cls=JSONEncoder)
json_data = json_dumps(data)
else:
error = 'Query completed but it returned no data.'
json_data = None
Expand Down
5 changes: 2 additions & 3 deletions redash/query_runner/kylin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os
import json
import logging
import requests
from requests.auth import HTTPBasicAuth

from redash import settings
from redash.query_runner import *
from redash.utils import JSONEncoder
from redash.utils import json_dumps

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -102,7 +101,7 @@ def run_query(self, query, user):
columns = self.get_columns(data['columnMetas'])
rows = self.get_rows(columns, data['results'])

return json.dumps({'columns': columns, 'rows': rows}), None
return json_dumps({'columns': columns, 'rows': rows}), None

def get_schema(self, get_stats=False):
url = self.configuration['url']
Expand Down
4 changes: 2 additions & 2 deletions redash/query_runner/rockset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
import os
from redash.query_runner import *
from redash.utils import JSONEncoder
from redash.utils import json_dumps
import json


Expand Down Expand Up @@ -96,7 +96,7 @@ def run_query(self, query, user):
columns = []
for k in rows[0]:
columns.append({'name': k, 'friendly_name': k, 'type': _get_type(rows[0][k])})
data = json.dumps({'columns': columns, 'rows': rows}, cls=JSONEncoder)
data = json_dumps({'columns': columns, 'rows': rows})
return data, None


Expand Down
4 changes: 3 additions & 1 deletion redash/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from flask_login import current_user

from redash import models
from redash.handlers.query_results import run_query_sync
from redash.permissions import has_access, view_only
from redash.utils import json_loads

Expand All @@ -30,6 +29,9 @@ def public_widget(widget):
# make sure the widget's query has a latest_query_data_id that is
# not null so public dashboards work
if q.latest_query_data_id is None:
# this import is inline since it triggers a circular
# import otherwise
from redash.handlers.query_results import run_query_sync
run_query_sync(q.data_source, {}, q.query_text)

query_data = q.latest_query_data.to_dict()
Expand Down

0 comments on commit e621b1e

Please sign in to comment.