Unexpected exception: tuple index out of range (L019)
See original GitHub issueExpected Behaviour
Including configuration
[sqlfluff:rules:L019]
comma_style = leading
does not lead to critical exception.
Observed Behaviour
Running sqlfluff lint models/dwh/best_model.sql
with the config below causes exception.
(venv) ➜ ✗ sqlfluff lint models/dwh/best_model.sql
CRITICAL [L019] Applying rule L019 threw an Exception: tuple index out of range
Traceback (most recent call last):
File "/Users/justinwagg/Documents/data/venv/lib/python3.8/site-packages/sqlfluff/core/rules/base.py", line 282, in crawl
res = self._eval(
File "/Users/justinwagg/Documents/data/venv/lib/python3.8/site-packages/sqlfluff/core/rules/std.py", line 2218, in _eval
last_seg = self._last_code_seg(raw_stack)
File "/Users/justinwagg/Documents/data/venv/lib/python3.8/site-packages/sqlfluff/core/rules/std.py", line 2133, in _last_code_seg
if raw_stack[idx].is_code or raw_stack[idx].is_type("newline"):
IndexError: tuple index out of range
CRITICAL [L019] Applying rule L019 threw an Exception: tuple index out of range
Traceback (most recent call last):
File "/Users/justinwagg/Documents/data/venv/lib/python3.8/site-packages/sqlfluff/core/rules/base.py", line 282, in crawl
res = self._eval(
File "/Users/justinwagg/Documents/data/venv/lib/python3.8/site-packages/sqlfluff/core/rules/std.py", line 2218, in _eval
last_seg = self._last_code_seg(raw_stack)
File "/Users/justinwagg/Documents/data/venv/lib/python3.8/site-packages/sqlfluff/core/rules/std.py", line 2133, in _last_code_seg
if raw_stack[idx].is_code or raw_stack[idx].is_type("newline"):
IndexError: tuple index out of range
== [models/dwh/best_model.sql] FAIL
L: 1 | P: 1 | L019 | Unexpected exception: tuple index out of range; Could
| you open an issue at
| https://github.com/sqlfluff/sqlfluff/issues ? You can
| ignore this exception for now, by adding '--noqa: L019'
| at the end of line 1
L: 2 | P: 1 | L019 | Unexpected exception: tuple index out of range; Could
| you open an issue at
| https://github.com/sqlfluff/sqlfluff/issues ? You can
| ignore this exception for now, by adding '--noqa: L019'
| at the end of line 2
L: 4 | P: 1 | L003 | Indent expected and not found compared to line #3
L: 5 | P: 1 | L003 | Indent expected and not found compared to line #3
Removing
[sqlfluff:rules:L019]
comma_style = leading
fixes the issue.
Steps to Reproduce
Model:
-- models/dwh/best_model.sql
{{
config(
materialized='incremental',
unique_key='field_1'
)
}}
select field_1
,field_2
,field_3
from my_great_table
(venv) ➜ ✗ sqlfluff lint models/dwh/best_model.sql
Version
Include the output of sqlfluff --version
along with your Python version
(venv) ➜ ✗ python -V
Python 3.8.0
(venv) ➜ ✗ sqlfluff --version
sqlfluff, version 0.4.0a3
Configuration
[sqlfluff]
templater = dbt
dialect = bigquery
exclude_rules = L036,L009,L008
[sqlfluff:indentation]
indented_joins = False
[sqlfluff:rules:L019]
comma_style = leading
[sqlfluff:rules:L003]
lint_templated_tokens = False
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
IndexError: tuple index out of range in Python | bobbyhadz
The Python IndexError: tuple index out of range occurs when we try to access an index that doesn't exist in a tuple.
Read more >IndexError: tuple index out of range ----- Python - Stack Overflow
28. I was getting this message because I was passing an array to a function that was expecting a variadic sequence of arguments...
Read more >Python IndexError: tuple index out of range Solution
When you try to access an item in a tuple that does not exist, Python returns an error that says “tuple index out...
Read more >[Solved]: Python IndexError: tuple index out of range
When user try access an item in a tuple that is out of range the Python returns an error that says “IndexError: tuple...
Read more >IndexError: Python tuple index out of range - ArrowHiTech
In this guide, we explain what Tuple index out of range error means, why it is raised and The effective solution for this...
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
OK cool. The part that’s failing in your stack trace has been totally changed in 0.4.0 - can you try it with 0.4.0a3?
Oh LOL
Thanks a bunch!!!