question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extra % added in SQL Lab during visualisation

See original GitHub issue

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven’t found one similar

Superset version

{“GIT_SHA”: “”, “version”: “0.18.5”}

Expected results

A list grouped by time (hourly) and type (24 columns, with 2 type, breakdown to display them

Actual results

It works well when I edit my query, then when I visualize, the result is not right. Only 2 column instead of 24

Steps to reproduce

Here is my SQL query:

SELECT count(*) as ‘total_activities’, type, hour(datetime) as hourly FROM activity GROUP BY type, DATE_FORMAT(datetime, "%%H:00:00") ORDER BY datetime` ASC;


The visualised query looks like :

SELECT hourly AS hourly, type AS type, sum(total_activities) AS sum__total_activities FROM (SELECT count(*) as ‘total_activities’, type, hour(datetime) as hourly FROM activity GROUP BY type, DATE_FORMAT(datetime, “%%%%H:00:00”) ORDER BY datetime ASC) AS expr_qry GROUP BY hourly, type ORDER BY sum__total_activities DESC LIMIT 50000

As you see, it adds 2 extra “%%” in the DATE_FORMAT, so the result for hourly will return only “0” instead of the 12 or 24 hours (depending of the format needed)

I copy paste this query and delete the 2 extra ‘%’, it seems to work as expected.

Is this normal ? Or did I miss something ? Maybe better way to display ma data by hour for a 24 hour grouped with type of activity ?

Thanks

Edit: I tried to trick it like having online one ‘%’ as “%H” mais I got the error : {“status”: “failed”, “query_id”: 46, “error_essage”: “unsupported format character ‘H’ (0x48) at index 250”}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vschoenercommented, Aug 1, 2017

I found a way to get the right format.

  • I let the double %% to have the right result in the preview.
  • Then after validation I edit the datasource to remove the extra ‘%’.

Now the query looks as expected, but I need to check if its the right now.

0reactions
mistercrunchcommented, Apr 23, 2018

Notice: this issue has been closed because it has been inactive for 264 days. Feel free to comment and request for this issue to be reopened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extra % added in SQL Lab during visualisation #3209 - GitHub
Extra % added in SQL Lab during visualisation #3209 ... It works well when I edit my query, then when I visualize, the...
Read more >
SQL Lab — apache-superset latest documentation
Some databases support EXPLAIN queries that allow users to estimate the cost of queries before executing this. Currently, Presto is supported in SQL...
Read more >
Frequently Asked Questions - Apache Superset
Frequently Asked Questions​ · Can I join / query multiple tables at one time? · How BIG can my datasource be? · How...
Read more >
visualize raw output of SQL Lab query in superset
I would like to visualize this "raw" output simply as a timeseries line chart. However, when I click the visualize button, the only...
Read more >
Superset: Scaling Data Access and Visual Insights at Airbnb
Additionally, with the Create Table As (CTAS) feature, SQL Lab allows users to store query results in a newly created table. With this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found