mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
Merge pull request #2428 from toru-takahashi/master
Improve a query failure message for Treasure Data Runner
This commit is contained in:
commit
7465c74392
@ -8,6 +8,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
import tdclient
|
||||
from tdclient import errors
|
||||
enabled = True
|
||||
|
||||
except ImportError:
|
||||
@ -102,7 +103,7 @@ class TreasureData(BaseQueryRunner):
|
||||
db=self.configuration.get('db'))
|
||||
|
||||
cursor = connection.cursor()
|
||||
|
||||
try:
|
||||
cursor.execute(query)
|
||||
columns_data = [(row[0], cursor.show_job()['hive_result_schema'][i][1]) for i,row in enumerate(cursor.description)]
|
||||
|
||||
@ -117,7 +118,9 @@ class TreasureData(BaseQueryRunner):
|
||||
data = {'columns': columns, 'rows': rows}
|
||||
json_data = json.dumps(data, cls=JSONEncoder)
|
||||
error = None
|
||||
|
||||
except errors.InternalError as e:
|
||||
json_data = None
|
||||
error = "%s: %s" % (e.message, cursor.show_job().get('debug', {}).get('stderr', 'No stderr message in the response')
|
||||
return json_data, error
|
||||
|
||||
register(TreasureData)
|
||||
|
Loading…
Reference in New Issue
Block a user