[solved] Saved queries throw error after redash update. New queries are ok


#1

Hi community. Hoping you can help.
I upgraded redash instance using the script and now saved queries fail to run.

During upgrade I ran into another separate issue and resolved it as pointed out here: [SOLVED] Problems during upgrade from 2.0.1 to 3.00.

But this issue continues.

Description of issue:
All my queries that are saved (published or not) fail to run and throw an error. However copy pasting the same sql code into a new query returns the results as expected just like before the upgrade.

STR:

  1. Open a saved querry
  2. Click execute
  3. Read error “Error running query: No data was returned.”
  4. Copy the SQL
  5. Click New Querry
  6. Paste and execute
  7. Read results = all Ok.

So any ideas what is causing the issue that saved queries will not run and throw an error?

I have tried rebooting the whole machine and it is still the same. I am not sure if there are more detailed logs stored somewhere that might give a hint.

Thanks for the help.

Edit:spelling


#2

This is indeed strange. Check the logs for any errors when you run the query.


#3

I looked at the server logs and all I see if a different call structure. Perhaps the jobs end point breaks? Or did you refer to another log?

#This call results in an error
[2018-01-23 13:59:29,351][PID:1902][INFO][metrics] method=GET path=/api/jobs/0e7ece50-foobar… endpoint=job status=200 content_type=application/json content_length=122 duration=12.05 query_count=2 query_duration=4.75

#This call displays results as expected.
[2018-01-23 13:59:29,401][PID:1899][INFO][metrics] method=GET path=/api/query_results/812 endpoint=query_result status=200 content_type=application/json content_length=2065 duration=42.12 query_count=7 query_duration=8.94


#4

Hmm just found something interesting. It is not related to that end point at all.

It appears that any call will fail if there is any commented out text after the SQL statement.

Example:
This call returns the result as expected
Body:
{“data_source_id”:2,“query”:“select * from region_lookup”,“max_age”:0,“query_id”:36}

This call returns the error:
Body:
{“data_source_id”:2,“query”:“select * from region_lookup;\n/* foo bar */”,“max_age”:0,“query_id”:36}

It seems the ending of the SQL with the “;” will result in a broken querry if anything comes after it. This does not apply to other front end SQL services like phpmyadmin when testing but it is likely they strip out my comments at runtime before passing it to the engine.

Now I know the issue I can go back and fix my queries but I am wondering if it was intended in the update. As it was not an issue in the older version of redash.