Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time grains broken in sqlite #4830

Closed
2 of 3 tasks
xrmx opened this issue Apr 15, 2018 · 2 comments
Closed
2 of 3 tasks

time grains broken in sqlite #4830

xrmx opened this issue Apr 15, 2018 · 2 comments

Comments

@xrmx
Copy link
Contributor

xrmx commented Apr 15, 2018

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

master from ~1 month ago 97afcd5

Expected results

hour, week and month time grains work fine

Actual results

The result is that hour time grains display an empty chart, while week and month fallback to the day as time grain.

Problem is that sqlite time grains use strftime and thus the % that gets escaped breaking the query:

SELECT DATETIME(STRFTIME('%%Y-%%m-%%dT%%H:00:00', ts)) AS __timestamp,
       SUM(prezzo) AS sum__prezzo
FROM prova12
WHERE ts >= '2017-09-15 00:00:00.000000'
  AND ts <= '2018-04-15 12:14:41.000000'
GROUP BY DATETIME(STRFTIME('%%Y-%%m-%%dT%%H:00:00', ts))
ORDER BY sum__prezzo DESC
LIMIT 50000
OFFSET 0;

Steps to reproduce

On a Time series line chart querying a sqlite database use hour, week or month as time grain.

@xrmx
Copy link
Contributor Author

xrmx commented Apr 23, 2018

Poking a bit with the code this looks added in get_timestamp_expression() by the literal_column call https://github.com/apache/incubator-superset/blob/master/superset/connectors/sqla/models.py#L135

@xrmx
Copy link
Contributor Author

xrmx commented Apr 29, 2018

Fixed in 3f48c00. Thanks!

@xrmx xrmx closed this as completed Apr 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant