-
Notifications
You must be signed in to change notification settings - Fork 123
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: support CREATE DATABASE in Connection API #1845
Conversation
Adds support for the CREATE DATABASE statement in the Connection API. The statement can only be used with a SingleUseTransaction (i.e. auto commit mode). It is not supported in DDL batches. The database that is created will have the same dialect as the current database that the user is connected to. Fixes #1884
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.
LGTM with a query, please take a look
Iterable<String> statements) | ||
throws SpannerException { | ||
throw new UnsupportedOperationException("Unimplemented"); | ||
} |
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.
We seem to be throwing SpannerException
elsewhere with createDatabase
in the interface. Why is it an UnsupportedOperationException("Unimplemented");
for this one?
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.
This is only to make this a non-breaking change. We add this when we add a new method to a public interface. This prevents compile errors for downstream users that might implement this interface in a test, as the method has a default implementation. See for example this example from the DatabaseClient
where we did the same thing:
java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClient.java
Line 36 in 049635d
throw new UnsupportedOperationException("method should be overwritten"); |
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.
LGTM
Adds support for the CREATE DATABASE statement in the Connection API.
The statement can only be used with a
SingleUseTransaction
(i.e. autocommit mode). It is not supported in DDL batches. The database that is
created will have the same dialect as the current database that the user
is connected to.
Fixes #1844
Towards b/229420558