0

Apache Superset has some kind of quirk, where any temporal query is sent with datetimes, even when the respective columns are mere dates.

To work around it, I wanted to add some preprocessing to any passing query, so that datetimes are swapped by dates if the respective columns require it.

Any insight I gained about writing the dialect came by comparing ready-made code, which is often repeatable, as other writers seem to encounter the same problem. I haven't so far found anything tangible to shed light on this particular issue.

Has someone perhaps managed to overcome a similar obstacle, and can point me to the relevant SQLalchemy construct / function that I should implement or add to to allow this preprocessing?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Jay
  • 2,535
  • 3
  • 32
  • 44
  • 1
    You might be interested in the [SQL level bind/result processing of types](http://docs.sqlalchemy.org/en/latest/core/custom_types.html#applying-sql-level-bind-result-processing), or the equivalent [Python side processing](http://docs.sqlalchemy.org/en/latest/core/custom_types.html#replacing-the-bind-result-processing-of-existing-types). This'd require custom types, though. – Ilja Everilä Sep 04 '17 at 06:11
  • Thanks. I think I should be using a connection event like before_curso_execute, but not sure whre to plug it in the dialect. http://docs.sqlalchemy.org/en/latest/core/events.html#sql-execution-and-connection-events – Jay Sep 16 '17 at 08:41

0 Answers0