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

Support DDL #88

Closed
meltsufin opened this issue May 31, 2019 · 6 comments
Closed

Support DDL #88

meltsufin opened this issue May 31, 2019 · 6 comments
Assignees

Comments

@meltsufin
Copy link
Member

meltsufin commented May 31, 2019

In Cloud Spanner, DDL statements are processed through a different API than SQL and DML.
See: spanner_database_admin.proto

@ChengyuanZhao
Copy link
Member

Is the goal to use the same Statement type to run DDL ?

I'm not sure the r2dbc spec had that in mind: https://github.com/r2dbc/r2dbc-spi/blob/master/r2dbc-spec/src/main/asciidoc/statements.adoc

Furthermore, their tests specifically use an external thing to run the DDL : https://github.com/r2dbc/r2dbc-spi/blob/master/r2dbc-spi-test/src/main/java/io/r2dbc/spi/test/Example.java

I don't think they expected to use DDL inside R2DBC. Besides, while DML and SQL may happen arbitrary number of times in normal usage I think DML (creating deleting tables) is inherently an offline task right?

@elefeint
Copy link
Contributor

elefeint commented Jun 3, 2019

Hmm, perhaps that's right. In SPI tests, the DDL operations are done outside of the reactive logic by getting hold of a separate JDBC template.

@mp911de Mark -- could you confirm whether R2DBC was meant to support DDL?

@mp911de
Copy link

mp911de commented Jun 3, 2019

R2DBC's Connection.createStatement(…) should be able to run any kind of queries, similar to how JDBC's Statement.execute() may run any kind of statements. Typically, DDL does not produce any rows nor result counts, therefore map(…) and getRowsUpdated() terminate empty for that kind of statements.

We're using JdbcTemplate in the SPi tests because it does not require the synchronization dance of reactive APIs.

@elefeint
Copy link
Contributor

elefeint commented Jun 3, 2019

Good to know, thank you!

Cloud Spanner is a bit unusual in that it does not provide a single API to run any generic query through, so we'll have to do query detection in the driver. I've filed #92 to track doing so for DML, and this issue will track the DDL side.

@mp911de
Copy link

mp911de commented Jun 3, 2019

I'd suggest sticking with what your JDBC driver does in most cases. R2DBC is in a lot of ways similar to what JDBC does.

@ChengyuanZhao
Copy link
Member

closing, this was done in #106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants