victornoel commented on issue #5886: Superset ignore case-sensitivity of time 
column names with Postgresql
URL: 
https://github.com/apache/incubator-superset/issues/5886#issuecomment-421967890
 
 
   @villebro here it is:
   ```sql
   SELECT DATE_TRUNC('day', invoiceDate) AT TIME ZONE 'UTC' AS __timestamp, 
COUNT(*) AS count FROM public."InvoiceLine" WHERE "invoiceDate" >= '2018-09-10 
00:00:00' AND "invoiceDate" <= '2018-09-17 00:00:00' GROUP BY DATE_TRUNC('day', 
invoiceDate) AT TIME ZONE 'UTC' ORDER BY count DESC LIMIT 10000
   ```
   
   For the record, I applied this diff to "fix" the problem with a hack but I 
don't think it is generic at all:
   ```diff
   diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
   index 176fbed0..a2ea8cac 100644
   --- a/superset/db_engine_specs.py
   +++ b/superset/db_engine_specs.py
   @@ -397,15 +397,15 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
        engine = ''
    
        time_grain_functions = {
   -        None: '{col}',
   -        'PT1S': "DATE_TRUNC('second', {col}) AT TIME ZONE 'UTC'",
   -        'PT1M': "DATE_TRUNC('minute', {col}) AT TIME ZONE 'UTC'",
   -        'PT1H': "DATE_TRUNC('hour', {col}) AT TIME ZONE 'UTC'",
   -        'P1D': "DATE_TRUNC('day', {col}) AT TIME ZONE 'UTC'",
   -        'P1W': "DATE_TRUNC('week', {col}) AT TIME ZONE 'UTC'",
   -        'P1M': "DATE_TRUNC('month', {col}) AT TIME ZONE 'UTC'",
   -        'P0.25Y': "DATE_TRUNC('quarter', {col}) AT TIME ZONE 'UTC'",
   -        'P1Y': "DATE_TRUNC('year', {col}) AT TIME ZONE 'UTC'",
   +        None: '"{col}"',
   +        'PT1S': "DATE_TRUNC('second', \"{col}\") AT TIME ZONE 'UTC'",
   +        'PT1M': "DATE_TRUNC('minute', \"{col}\") AT TIME ZONE 'UTC'",
   +        'PT1H': "DATE_TRUNC('hour', \"{col}\") AT TIME ZONE 'UTC'",
   +        'P1D': "DATE_TRUNC('day', \"{col}\") AT TIME ZONE 'UTC'",
   +        'P1W': "DATE_TRUNC('week', \"{col}\") AT TIME ZONE 'UTC'",
   +        'P1M': "DATE_TRUNC('month', \"{col}\") AT TIME ZONE 'UTC'",
   +        'P0.25Y': "DATE_TRUNC('quarter', \"{col}\") AT TIME ZONE 'UTC'",
   +        'P1Y': "DATE_TRUNC('year', \"{col}\") AT TIME ZONE 'UTC'",
        }
    
        @classmethod
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to