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
Same issue appears to happen with all version. I tried both compile latest from source and also the one installed from pip official package 2.3.5.
Create the above script
run sqlfluff format
observe the crash (logs below)
wrap the Class column with square brackets [Class]
run format again and see that now it works
Crash logs:
> sqlfluff format .\src\migration\6_alter_load_user_data_procedure.sql
==== finding fixable violations ====
WARNING Fixes for LT01 not applied, as it would result in an unparsable file. Please report this as a bug with a minimal query which demonstrates this warning.
WARNING Fixes for LT02 not applied, as it would result in an unparsable file. Please report this as a bug with a minimal query which demonstrates this warning.
WARNING Unable to lint src\migration\6_alter_load_user_data_procedure.sql due to an internal error. Please report this as an issue with your query's contents and stacktrace below!
To hide this warning, add the failing file to .sqlfluffignore
Traceback (most recent call last):
File "***\lib\site-packages\sqlfluff\core\linter\runner.py", line 109, in run
yield partial()
File "***\lib\site-packages\sqlfluff\core\linter\linter.py", line 686, in lint_rendered
encoding=rendered.encoding,
File "***\lib\site-packages\sqlfluff\core\linter\linter.py", line 608, in lint_parsed
formatter=formatter,
File "***\lib\site-packages\sqlfluff\core\linter\linter.py", line 459, in lint_fix_parsed
config=config,
File "***\lib\site-packages\sqlfluff\core\rules\base.py", line 560, in crawl
self._adjust_anchors_for_fixes(context, elem)
File "***\lib\site-packages\sqlfluff\core\rules\base.py", line 750, in _adjust_anchors_for_fixes
fix.anchor,
File "***\lib\site-packages\sqlfluff\core\rules\base.py", line 782, in _choose_anchor_segment
assert path, f"No path found from {root_segment} to {segment}!"
AssertionError: No path found from <FileSegment: ([L: 1, P: 1])> to <WordSegment: ([L: 7, P:114]) 'strSerial'>!
Dialect
tsql
Version
2.3.5 and latest from main branch.
Configuration
default
Are you willing to work on and submit a PR to address the issue?
Search before asking
What Happened
sqlfluff crashes when formatting tsql code that contains keyworded columns.
See related ticket: #3852
Expected Behaviour
Should format properly.
Observed Behaviour
If I add square brackets around the keyworded columns, such as Class, then it formats the below script properly:
How to reproduce
Crash logs:
Dialect
tsql
Version
2.3.5 and latest from main branch.
Configuration
default
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: