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

fix(db_api): use sqlparse to split DDL statements #372

Merged
merged 2 commits into from Jun 22, 2021

Conversation

IlyaFaer
Copy link
Member

@IlyaFaer IlyaFaer commented Jun 17, 2021

Instead of simple str.split(";") method use more smart sqlparse package to split DDL statements executed in a form:

cursor.execute("""
    ddl_statement1;
    ddl_statement2;
    ddl_statement3;
""")

@IlyaFaer IlyaFaer added api: spanner type: bug labels Jun 17, 2021
@google-cla google-cla bot added the cla: yes label Jun 17, 2021
@IlyaFaer
Copy link
Member Author

@IlyaFaer IlyaFaer commented Jun 17, 2021

According to what I see in the sqlparse source code and documentation, it should work okay with GoogleSQL. Plus to the test case I've tried several types of DDL statements (interleaved tables, alters, indexes - cases, which seems complex to me). All was splitted correсtly.

@IlyaFaer IlyaFaer marked this pull request as ready for review Jun 17, 2021
@IlyaFaer IlyaFaer requested a review from as a code owner Jun 17, 2021
@IlyaFaer IlyaFaer requested a review from larkee Jun 17, 2021
larkee
larkee approved these changes Jun 18, 2021
@larkee larkee added the kokoro:force-run label Jun 21, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run label Jun 21, 2021
@larkee larkee added automerge kokoro:force-run labels Jun 22, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run label Jun 22, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit ed9e124 into googleapis:master Jun 22, 2021
10 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge label Jun 22, 2021
@IlyaFaer IlyaFaer deleted the split_ddls branch Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner cla: yes type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants