-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlfmt breaks up depends_on statements across multiple lines, causing an error in parsing #628
Comments
I can't reproduce this, with or without ~/open/sqlfmt main ≡ 3.11 ❯ sqlfmt - 10:17:25
-- depends_on: {{ref('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }}
-- depends_on:
-- {{ref('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }}
1 file formatted.
0 files left unchanged.
- formatted.
~/open/sqlfmt main ≡ 3.11 ❯ sqlfmt --no-jinjafmt -
-- depends_on: {{ref('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }}
-- depends_on:
-- {{ref('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }}
1 file formatted.
0 files left unchanged.
- formatted. (where the whole jinja tag gets moved to the second line, but that should be perfectly valid for dbt) |
This is so bizarre, don't know why we're getting such different results! |
@tconbeer so sorry, I made a copy-paste error, try formatting this:
|
yeah ok that did it. thanks for the report. |
Happy to help with a PR if you can point me to where I can work on it! |
Thanks. It's this method: Lines 146 to 163 in e9205a9
Probably best to check the contents of the comment for a jinja tag ( |
…sing an error in parsing tconbeer#628
closed by #642 |
Describe the bug
sqlfmt breaks up depends_on statements across multiple lines, causing an error in parsing.
To Reproduce
Take a sufficiently long
depends_on
statement from the top a sql file in a dbt project, for instance:sqlfmt will break it across multiple lines, like so:
dbt is unable to correctly parse this:
bad operand type for unary -: 'BigQueryRelation'
Expected behavior
sqlfmt should leave
depends_on
statements on a single line so they correctly parse, no matter what the length.Additional context
sqlfmt, version 0.23.2
The text was updated successfully, but these errors were encountered: