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

feat(db_api): support executing several DDLs separated by semicolon #277

merged 3 commits into from Mar 18, 2021


Copy link

@IlyaFaer IlyaFaer commented Mar 16, 2021

With this change users will be able to put several DDLs into one execute() call, like:

cursor.execute("CREATE TABLE ...;CREATE INDEX...")

@IlyaFaer IlyaFaer added api: spanner type: feature request labels Mar 16, 2021
@google-cla google-cla bot added the cla: yes label Mar 16, 2021
@IlyaFaer IlyaFaer requested a review from larkee Mar 16, 2021
@IlyaFaer IlyaFaer marked this pull request as ready for review Mar 16, 2021
@IlyaFaer IlyaFaer requested a review from as a code owner Mar 16, 2021
Copy link
Member Author

@IlyaFaer IlyaFaer commented Mar 16, 2021

@larkee, these are changes needed for SQLAlchemy dialect, first of all to make it possible to drop indexes and constraints before dropping the table. And, after all, I think it's not a bad feature.

Copy link

@larkee larkee commented Mar 16, 2021

Please add or update a unit test with an example of a DDL statement with semicolons.

Copy link

@larkee larkee commented Mar 17, 2021

Would it be reasonable to also allow for each statement to start on a new line? See here for an example of what I mean.

Copy link
Member Author

@IlyaFaer IlyaFaer commented Mar 17, 2021

@larkee, it's already working with new lines. I've added a line with \n symbol into the test to be sure.

str.strip() erases \n symbols as well (though it's something not mentioned in Python docs directly). Here is a short example:


larkee approved these changes Mar 18, 2021
@larkee larkee merged commit 801ddc8 into googleapis:master Mar 18, 2021
8 checks passed
@IlyaFaer IlyaFaer deleted the several_ddls branch Mar 18, 2021
gcf-merge-on-green bot pushed a commit that referenced this issue Mar 25, 2021
🤖 I have created a release \*beep\* \*boop\*
## [3.3.0]( (2021-03-25)

### Features

* add encryption_info to Database ([#284]( ([2fd0352](
* add support for CMEK ([#105]( ([e990ff7](
* add support for custom timeout and retry parameters in execute_update method in transactions ([#251]( ([8abaebd](
* added retry and timeout params to partition read in database and snapshot class ([#278]( ([1a7c9d2](
* **db_api:** support executing several DDLs separated by semicolon ([#277]( ([801ddc8](

### Bug Fixes

* avoid consuming pending null values when merging ([#286]( ([c6cba9f](
* **db_api:** allow file path for credentials ([#221]( ([1de0284](
* **db_api:** ensure DDL statements are being executed ([#290]( ([baa02ee](
* **db_api:** revert Mutations API usage ([#285]( ([e5d4901](

### Documentation

* fix docstring types and typos ([#259]( ([1b0ce1d](
* fix snapshot usage ([#291]( ([eee2181](

This PR was generated with [Release Please]( See [documentation](
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
api: spanner cla: yes type: feature request
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants