BigQuery - Found unparsable section
SallyBlichG opened this issue · comments
SallyBlichG commented
Search before asking
- I searched the issues and found no similar issues.
What Happened
I ran the sqlfluff tool over an SQL file, using the BigQuery dialect, and encountered the following exception
== [dir/dir2/file.sql] FAIL
L: 9 | P: 3 | PRS | Line 9, Position 3: Found unparsable section: 'execute
| immediate(select format(var_2...'
WARNING: Parsing errors found and dialect is set to 'bigquery'. Have you configured your dialect correctly?
Expected Behaviour
The query is fine, so it shouldn't have failed
Observed Behaviour
Failure, with the exception above.
How to reproduce
sqlfluff lint $file --dialect bigquery --ignore templating,linting
The file:
declare var_1 string;
declare var_2 string;
set var_1 = 'insert into project.data_set.table select "%s" as var_1, count(*) as column_1 from (select column_3 from %s.column_2 group by var_3 having count(var_3) > 1)';
create or replace table project.data_set.table(var_1 string, column_1 int64)
options (expiration_timestamp=timestamp_add(current_timestamp(), interval 3 hour));
for m in (select var_1 from project.data_set.table) do
set var_1 = m[0];
execute immediate(select format(var_2, var_1, var_1));
end for;
Dialect
bigquery
Version
Sqlfluff version: sqlfluff 2.3.5
Python version: Python 3.10.12
Configuration
No configuration
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