Skip to content
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

Closed
wants to merge 7 commits into from

Conversation

gshank
Copy link
Contributor

@gshank gshank commented Jun 21, 2023

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

@gshank gshank requested review from a team as code owners June 21, 2023 23:02
@gshank gshank requested review from emmyoop and aranke and removed request for a team June 21, 2023 23:02
@cla-bot cla-bot bot added the cla:yes label Jun 21, 2023
Copy link
Member

@aranke aranke left a 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

with_stmt = word
break

joined_ctes = ", ".join(c.sql for c in ctes)
Copy link
Member

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?

words_found = re.findall(r"\w+|[^\w\s]", sql, re.UNICODE)

with_stmt = None
for word in words_found:
Copy link
Member

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():
Copy link
Member

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.?

@gshank
Copy link
Contributor Author

gshank commented Jun 29, 2023

Creating a different pull request since we pivoted to supporting sqlparse.

@gshank gshank closed this Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2644] [Feature] Remove dependency on sqlparse
2 participants