villebro commented on a change in pull request #16822:
URL: https://github.com/apache/superset/pull/16822#discussion_r716508526
##########
File path: superset/db_engine_specs/base.py
##########
@@ -952,9 +952,11 @@ def select_star( # pylint:
disable=too-many-arguments,too-many-locals
if (show_cols or latest_partition) and not cols:
cols = database.get_columns(table_name, schema)
- if show_cols:
- fields = cls._get_fields(cols)
quote = engine.dialect.identifier_preparer.quote
+ if show_cols:
+ # Explicitly quote all column names, as BigQuery doesn't quote
column
+ # names that are also identifiers (eg, "limit") by default.
+ fields = [text(quote(col["name"])) for col in cols]
Review comment:
I would expect the BQ dialect to automatically quote reserved keywords.
I tried this quickly on sqlite:
```
create table bad_colnames("limit" varchar(10), "offset" varchar(10), regular
varchar(10));
```
here's what it rendered:
```sql
SELECT "limit",
"offset",
regular
FROM main.bad_colnames
LIMIT 100
OFFSET 0
```
So I'd rather we submit a PR on the BQ connector to make sure reserved
keywords are quoted correctly.
--
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]