Query Using SHA1

Hello! I have query and i’am using SHA1 but it returns me empty

Example:
SELECT SHA1(to_utf8(cast('foo' as varchar))), 'foo' as ident

If i remove SHA1 in my query, returns for me ‘foo’

I using Redash V8

Please help me! Thanks

Hi there, what kind of data source is this? If you check the network inspector in your browser after you execute the query you should be able to see the network response that includes the query result (it will use the api/results endpoint). Do you see any data in that response?

It’s important to know if the data is coming from Athena but the web application can’t display it. Or if it’s not even making it to the browser.

Hi jesse, i did the verification in Network and i haven’t the api/results. I tried in Google Chrome and Mozilla but the results its same.

At Athens SHA1 returns to me :confused:

Thanks for follow up.

Good!

Please check that final network request (at the bottom of the list) in your screenshot. The one you highlighted is the initial request when the query was enqueued but had not yet executed.

See how there are “duplicate” requests after it? That’s the web application checking once-per-second for a result to the query. The final request will actually contain the query result, which is what we want to see.

Alright! the final requets, response is:

Thanks!

Thank you, that’s very helpful. Notice how the status code on this final request is 4 (four). According to the api documentation this means that the query execution job failed. So the root issue here is with the backend of Redash, not the web application.

Next we can see what exactly went wrong with the back-end. You do this by monitoring the log output from docker-compose while attempting to execute the query.

  1. On the server that runs Redash from the /opt/redash directory (or wherever your installation keeps the docker-compose.yml file, run docker-compose logs -f --tail 100. Log messages will begin scrolling across your screen periodically.
  2. In the web application, click the Execute button on this query.
  3. You will see an error from Python in the logs from step 1.

Jesse, follow the error:

[2021-12-09 20:02:16,537][PID:1][INFO][MainProcess] Received task: redash.tasks.execute_query[421383cf-630f-43a4-b8a1-ca371ad01117]  

[2021-12-09 20:02:16,540][PID:100][INFO][ForkPoolWorker-89] task_name=redash.tasks.execute_query task_id=421383cf-630f-43a4-b8a1-ca371ad01117 task=execute_query state=load_ds ds_id=1

[2021-12-09 20:02:16,552][PID:100][INFO][ForkPoolWorker-89] task_name=redash.tasks.execute_query task_id=421383cf-630f-43a4-b8a1-ca371ad01117 task=execute_query state=executing_query query_hash=93d13f559c660078a1646eed2eda8abb type=athena ds_id=1  task_id=421383cf-630f-43a4-b8a1-ca371ad01117 queue=queries query_id=adhoc username=****@****.com

[2021-12-09 20:02:17,935][PID:100][INFO][ForkPoolWorker-89] task_name=redash.tasks.execute_query task_id=421383cf-630f-43a4-b8a1-ca371ad01117 task=execute_query query_hash=93d13f559c660078a1646eed2eda8abb data_length=None error=[]

[2021-12-09 20:02:17,937][PID:100][ERROR][ForkPoolWorker-89] Task redash.tasks.execute_query[421383cf-630f-43a4-b8a1-ca371ad01117] raised unexpected: QueryExecutionError('',)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/celery/app/trace.py", line 385, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/app/redash/worker.py", line 84, in __call__
    return TaskBase.__call__(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/celery/app/trace.py", line 648, in __protected_call__
    return self.run(*args, **kwargs)
  File "/app/redash/tasks/queries.py", line 436, in execute_query
    scheduled_query).run()
  File "/app/redash/tasks/queries.py", line 382, in run
    raise result
QueryExecutionError

Is there more to that error? It seems to be cut off.

That its all :confused:

I run: `docker logs --tail 100 CONTAINER_ID(redash_adhoc_worker_1)’

In this print have two tries run query