-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Do not use sqlparse to construct ephemeral ctes #7919
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, few optimizations may be possible
core/dbt/compilation.py
Outdated
with_stmt = word | ||
break | ||
|
||
joined_ctes = ", ".join(c.sql for c in ctes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we break these out across multiple lines?
core/dbt/compilation.py
Outdated
words_found = re.findall(r"\w+|[^\w\s]", sql, re.UNICODE) | ||
|
||
with_stmt = None | ||
for word in words_found: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this loop by checking with
in the regex itself?
return string | ||
|
||
|
||
def test_inject_ctes_0(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we give the test functions more descriptive names than 1, 2, etc.?
Creating a different pull request since we pivoted to supporting sqlparse. |
resolves #7791
Description
Since we have been having issues with sqlparse as a dependency and only used it minimally in one place, replace that usage by constructing ephemeral ctes in another way.
Checklist
changie new
to create a changelog entry