You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the issues and found no similar issues.
What Happened
Run sqlfluff fix -f --dialect bigquer on the following SQL:
SELECTgcpproject.functions.timestamp_parsing(log_tbl.orderdate) AS orderdate
FROM`gcp-project.data.year_2021`AS log_tbl
Expected Behaviour
It lints and fixes
Observed Behaviour
% sqlfluff fix -f --dialect bigquery test.sql --fixed-suffix FIXED
==== finding fixable violations ====
CRITICAL [L020] Applying rule L020 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L020.py", line 105, in _eval
select_info = get_select_statement_info(context.segment, context.dialect)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
CRITICAL [L025] Applying rule L025 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L025.py", line 67, in _eval
select_info = get_select_statement_info(context.segment, context.dialect)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
CRITICAL [L027] Applying rule L027 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L020.py", line 105, in _eval
select_info = get_select_statement_info(context.segment, context.dialect)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
CRITICAL [L044] Applying rule L044 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L044.py", line 146, in _eval
return self._analyze_result_columns(crawler.query_tree)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L044.py", line 92, in _analyze_result_columns
for wildcard in selectable.get_wildcard_info():
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select_crawler.py", line 84, in get_wildcard_info
if not self.select_info:
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select_crawler.py", line 42, in select_info
return get_select_statement_info(
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
WARNING One fix for L016 not applied, it would re-cause the same error.
CRITICAL [L020] Applying rule L020 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L020.py", line 105, in _eval
select_info = get_select_statement_info(context.segment, context.dialect)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
CRITICAL [L025] Applying rule L025 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L025.py", line 67, in _eval
select_info = get_select_statement_info(context.segment, context.dialect)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
CRITICAL [L027] Applying rule L027 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L020.py", line 105, in _eval
select_info = get_select_statement_info(context.segment, context.dialect)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
CRITICAL [L044] Applying rule L044 threw an Exception: local variable 'seg' referenced before assignment
Traceback (most recent call last):
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/base.py", line 535, in crawl
res = self._eval(context=context)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L044.py", line 146, in _eval
return self._analyze_result_columns(crawler.query_tree)
File "/Users/barry/sqlfluff/src/sqlfluff/rules/L044.py", line 92, in _analyze_result_columns
for wildcard in selectable.get_wildcard_info():
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select_crawler.py", line 84, in get_wildcard_info
if not self.select_info:
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select_crawler.py", line 42, in select_info
return get_select_statement_info(
File "/Users/barry/sqlfluff/src/sqlfluff/core/rules/analysis/select.py", line 83, in get_select_statement_info
if seg and any(
UnboundLocalError: local variable 'seg' referenced before assignment
== [test.sql] FAIL
L: 1 | P: 1 | L036 | Select targets should be on a new line unless there is
| only one select target.
L: 4 | P: 37 | L031 | Avoid aliases in from clauses and join conditions.
==== fixing violations ====
2 fixable linting violations found
FORCE MODE: Attempting fixes...
Persisting Changes...
== [test.sql] PASS
Done. Please check your files to confirm.
[6 unfixable linting violations found]
How to reproduce
As per above
Dialect
Bigquery
Version
0.11.0
Configuration
Default (though note dialect overriden to bigquery above)
Are you willing to work on and submit a PR to address the issue?
Search before asking
What Happened
Run
sqlfluff fix -f --dialect bigquer
on the following SQL:Expected Behaviour
It lints and fixes
Observed Behaviour
How to reproduce
As per above
Dialect
Bigquery
Version
0.11.0
Configuration
Default (though note dialect overriden to bigquery above)
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
The text was updated successfully, but these errors were encountered: