john-bodley commented on a change in pull request #9854:
URL: 
https://github.com/apache/incubator-superset/pull/9854#discussion_r428236021



##########
File path: superset/connectors/sqla/models.py
##########
@@ -167,15 +167,26 @@ def is_temporal(self) -> bool:
             self.type, utils.DbColumnType.TEMPORAL
         )
 
-    def get_sqla_col(self, label: Optional[str] = None) -> Column:
-        label = label or self.column_name
+    def get_sqla_col(

Review comment:
       I've played with this in the past by forcing 
`render_label_as_label=None` when calling the `super()`. For your scenario it 
seems like it may need to differ based on the context, i.e., within the `WHERE` 
clause. 
   
   For example we needed to ensure that the `ORDER BY` didn't contain the 
alias/label, 
   
   ```python
   from sqlalchemy.engine import Engine
   from sqlalchemy.sql import literal_column, select
   
   
   def test_identifier_preparer(engine: Engine) -> None:
       col = literal_column("SUM(x)").label("total")
       stmt = select([col])
       assert str(stmt) == "SELECT SUM(x) AS total"
       assert str(stmt.compile(engine)) == 'SELECT SUM(x) AS "total"'
   
   
   def test_visit_label(engine: Engine) -> None:
       col = literal_column("SUM(x)").label("total")
       stmt = select([col]).order_by(col)
       assert str(stmt).endswith("ORDER BY total")
       assert str(stmt.compile(engine)).endswith("ORDER BY SUM(x)")
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to