1

I am using python 3.9.1 and have 0.3.6 sqlfluff. I do lint some files successfully and fix them however I am trying to lint 757 rows of sql file and it is giving me this error:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/sqlfluff", line 8, in <module>
    sys.exit(cli())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlfluff/cli/commands.py", line 172, in lint
    result = lnt.lint_paths(paths, verbosity=verbose, ignore_non_existent_files=False)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlfluff/linter.py", line 911, in lint_paths
    result.add(self.lint_path(path, verbosity=verbosity, fix=fix,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlfluff/linter.py", line 896, in lint_path
    self.lint_string(target_file.read(), fname=fname,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlfluff/linter.py", line 748, in lint_string
    lerrs, _, _, _ = crawler.crawl(parsed, dialect=config.get('dialect_obj'))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlfluff/rules/base.py", line 268, in crawl
    dvs, raw_stack, child_fixes, memory = self.crawl(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlfluff/rules/base.py", line 233, in crawl
    res = self._eval(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlfluff/rules/std.py", line 53, in _eval
    if raw_stack[idx].type == 'whitespace':
IndexError: tuple index out of range

github issue

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
Mincho
  • 214
  • 3
  • 10
  • How is this related to the _language_? – jarlh Jan 04 '21 at 15:35
  • sqlfluff is an sql linter. I am unable to put a tag of sqlfluff... – Mincho Jan 04 '21 at 15:36
  • The tag says "_Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data,_ [...] _Answers to questions tagged with SQL should use ISO/IEC standard SQL._". – jarlh Jan 04 '21 at 15:40
  • I do have sql code written as mentioned, 757 rows of it with jinja templates macros etc. I don't think sql tag is out of line here – Mincho Jan 04 '21 at 15:49
  • Then show us the SQL code and tell us what problem you have with it. [mcve] – jarlh Jan 04 '21 at 19:04
  • Would you kindly create a tag for sqlfluff and I can change that sql tag to sqlfluff since I am lacking 1425 rep. points to define a new tag if it is such a problem? – Mincho Jan 04 '21 at 21:47

0 Answers0