bito-code-review[bot] commented on PR #42298:
URL: https://github.com/apache/superset/pull/42298#issuecomment-5042136179
<!-- Bito Reply -->
The flagged issue is correct. When the mutated SQL ends with a semicolon,
wrapping it in a subquery `SELECT * FROM (...)` results in invalid SQL syntax
for ClickHouse, causing the retry to fail. To resolve this, the trailing
semicolon should be stripped from the `sql` string before it is embedded in the
subquery.
Here is the corrected implementation for
`superset/db_engine_specs/clickhouse.py`:
```python
@classmethod
def get_column_description_retry_sql(cls, sql: str) -> str | None:
# ... (existing comments)
normalized_sql = sql.strip().rstrip(';')
return f"SELECT * FROM (\n{normalized_sql}\n) AS
__superset_type_probe LIMIT 0" # noqa: S608
```
I have checked the PR comments and there are no other actionable suggestions
to address. Would you like me to proceed with any other changes?
**superset/db_engine_specs/clickhouse.py**
```
@classmethod
def get_column_description_retry_sql(cls, sql: str) -> str | None:
# ... (existing comments)
normalized_sql = sql.strip().rstrip(';')
return f"SELECT * FROM (\n{normalized_sql}\n) AS
__superset_type_probe LIMIT 0" # noqa: S608
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]