villebro commented on issue #5886: Superset ignore case-sensitivity of time 
column names with Postgresql
URL: 
https://github.com/apache/incubator-superset/issues/5886#issuecomment-423807808
 
 
   TL;DR: I was talking more about how the query is generated in Superet, not 
what is valid SQL syntax. I believe that in this instance putting quotes around 
`{col}` for Postgres is probably the simplest solution, but I would not apply 
the same to all other engine types.
   
   Long answer: I was referring to how Superset generates SQL queries. 
Currently most other parts of the query are generated using SQL Alchemy 
constructs that automatically detect the need for quotes. For example, 
selecting a column `ColumnName` with an alias `col_alias` is in fact roughly 
defined as 
   `column('ColumnName').label('col_alias')`, which is then compiled into 
`SELECT "ColumnName" AS col_alias`. If either require quoting, `ColumnName` in 
this example, SQL Alchemy automatically puts quotes around it.
   
   The problem here is that time grain expressions don't contain a reference to 
a SQL Alchemy column object, but are static strings inside a `literal_column` 
object, which makes it impossible for SQL Alchemy to apply conditional quoting. 
See below where this happens:
   
   
https://github.com/apache/incubator-superset/blob/master/superset/connectors/sqla/models.py#L139-L143
   
   I believe that Postgres is pickier than other engines in this case, i.e. 
most other engines probably wouldn't require quotes around the column name in 
the time grain expression. Therefore I would not force quotes into the time 
grain expressions of other engines at this time.

----------------------------------------------------------------
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