Incubator-superset: can't use mysql DATE_FORMAT function

Created on 7 Dec 2017  路  5Comments  路  Source: apache/incubator-superset

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

Expected results

image

Actual results

image

Steps to reproduce

select DATE_FORMAT(now(), '%h%i%s');

other

It looks like confusion with python syntax

inactive

All 5 comments

double %, i usually do this.
but u should only use one in datasource...

@tanjxyz thanks,when i use double % , it's work.

how to fix
if i query like is

select indb_time, TotalFiles, BlocksTotal 
from hdfs_info_logs 
where statis_date>=20171101 
and DATE_FORMAT(indb_time, '%%H%%i%%S') = '000000';

and use Visualize , it will auto add double % in my query
image

I tried to fix this in the past and it was more tricky than expected. It has to do with the fact that different drivers behave differently in this case, and even the same driver can behave differently based on how it's called. We should iron this out in the future, in the meantime double your %%...

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

Was this page helpful?
0 / 5 - 0 ratings