L029: 「key」is recognized as keyword word in the BigQuery dialect when it shouldn't be
See original GitHub issueSearch before asking
- I searched the issues and found no similar issues.
What Happened
I try this command to sample.sql.
$ sqlfluff lint --dialect bigquery sample.sql
↓ sample.sql
SELECT
a AS key,
b
FROM
my_table;
「key」is in bigquery_unreserved_keywords but SQLFluff lint result is fail.
== [sample.sql] FAIL
L: 2 | P: 10 | L029 | Keywords should not be used as identifiers.
All Finished 📜 🎉!
Expected Behaviour
「key」does not fail in SQLFluff lint because set in bigquery_unreserved_keywords
Observed Behaviour
SQLFluff lint is failed.
$ sqlfluff lint --dialect bigquery sample.sql
== [sample.sql] FAIL
L: 2 | P: 10 | L029 | Keywords should not be used as identifiers.
All Finished 📜 🎉!
↓ sample.sql
SELECT
a AS key,
b
FROM
my_table;
How to reproduce
SQLFluff version 1.2.1 and try Observed Behavior command, create file.
Dialect
BigQuery
Version
$ sqlfluff --version
sqlfluff, version 1.2.1
Configuration
Don’t configure .sqlfluff and .sqlfluffignore.
Are you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Rules Reference — SQLFluff 1.4.5 documentation
Keywords should not be used as identifiers. Although unreserved keywords can be used as identifiers, and reserved words can be used as quoted...
Read more >Lexical structure and syntax | BigQuery - Google Cloud
Keywords are a group of tokens that have special meaning in the Google Standard SQL language, and have the following characteristics: Keywords cannot...
Read more >sqlfluff/CHANGELOG.md at main - GitHub
A modular SQL linter and auto-formatter with support for multiple dialects and templated code. - sqlfluff/CHANGELOG.md at main · sqlfluff/sqlfluff.
Read more >sqlfluff Changelog - pyup.io
Enable parsing of CLONE keyword in bigquery dialect [3984](https://github.com/sqlfluff/sqlfluff/pull/3984) [realLyans](https://github.com/realLyans)
Read more >L029: 「key」is recognized as keyword word in the BigQuery ...
$ sqlfluff lint --dialect bigquery sample.sql == [sample.sql] FAIL L: 2 | P: 10 | L029 | Keywords should not be used as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not sure it is correct since I’m not sure
key
is an unreserved word in BigQuery. So yes feel free to submit a fix PR.Reopening this. the fix was made in #3714 so that BigQuery should now no longer need to have
KEY
listed as an unreserved word. However, that same PR did not actually removeKEY
as an unreserved word:https://github.com/sqlfluff/sqlfluff/blob/f687e82b1d0073e41b4fb7feb59b47c2cf6c817a/src/sqlfluff/dialects/dialect_bigquery_keywords.py#L174
Meaning the initial query still flags as a linting error when it shouldn’t.
@sabrikaragonen or @keyem4251 do you want to do that final step so we can close this?