questdb / questdb-connect

SQLAchemy and Apache Superset extensions for QuestDB
Apache License 2.0
12 stars 3 forks source link

Passthrough Time Grain option #7

Open chris-nolan opened 8 months ago

chris-nolan commented 8 months ago

I've noticed a few superset integration are now providing, what I believe to be, a passthrough option for time grain e.g. https://github.com/apache/superset/blob/8c6bd4ef047b1914b7e3023d6b559b4bdae13b65/superset/db_engine_specs/clickhouse.py#L58

Would it be possible to provide this for QuestDB. We have data at 0.2s intervals that we don't particularly want to aggregate.

marregui commented 8 months ago

these are the time grain expressions in questdb-connect:

 _time_grain_expressions = {
        None: "{col}",
        "PT1S": "DATE_TRUNC('second', {col})",
        "PT1M": "DATE_TRUNC('minute', {col})",
        "PT1H": "DATE_TRUNC('hour', {col})",
        "P1D": "DATE_TRUNC('day', {col})",
        "P1W": "DATE_TRUNC('week', {col})",
        "P1M": "DATE_TRUNC('month', {col})",
        "P1Y": "DATE_TRUNC('year', {col})",
        "P3M": "DATE_TRUNC('quarter', {col})",
    }

are we missing something?

I can extend the above list if you provide:

thank you!