JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.37k stars 694 forks source link

Cloud native database compatibility #181

Open corporatepiyush opened 7 years ago

corporatepiyush commented 7 years ago

Is it compatible with Google Cloud Spanner and CockroachDB ?

Tapac commented 7 years ago

No. Noone asked for that, so there are no such dialects in Exposed. I mark this issue as a feature request, but can't give you any estimates.

dmcg commented 3 years ago

We are running against Cockroach using PostgreSQL drivers and things are fine. You may need to write code to automagically retry, as Cockroach bails out of many more transactions than Postgres

Jerbell commented 3 years ago

I'm trying to run our Postgres app against Cockroach. Not much success at the moment. Currently having problems with altering columns, altering columns with an index ~and collation~. EDIT: Collation not precisly an exposed issue.

matheusfrancisco commented 2 years ago

Is there any progress in adding google cloud spanner support? I would like to help if it is possible.

Tapac commented 2 years ago

@matheusfrancisco feel free to publish a PR with the GC Spanner support. Please use https://github.com/GoogleCloudPlatform/cloud-spanner-emulator for tests.

lfgcampos commented 2 years ago

Is there any progress in adding google cloud spanner support? I would like to help if it is possible.

Hi @matheusfrancisco, any news on this? I am also interested in exposed and Google cloud spanner support and could potentially help if there is an on going effort, if needed!

marcosb commented 1 year ago

+1 - would be great to see VendorDialect for com.google.cloud.spanner.jdbc.JdbcDriver

marcosb commented 1 year ago

FWIW, Database.registerJdbcDriver("jdbc:cloudspanner", "com.google.cloud.spanner.jdbc.JdbcDriver", PostgreSQLDialect.dialectName) probably gets something which is mostly functional for Cloud Spanner in the interim

alex-shinn commented 1 year ago

Attempting that workaround gives:

com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory$JdbcSqlFeatureNotSupportedException: Only isolation level TRANSACTION_SERIALIZABLE is supported

We can specify the transaction level but then get

Caused by: com.google.cloud.spanner.SpannerException: INVALID_ARGUMENT: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Unsupported concurrency mode in query using INFORMATION_SCHEMA. - Statement: 'SELECT TABLE_CATALOG AS "TABLE_CAT", ...

Googling suggests setting auto-commit mode will help, but then my final attempt:

fun <T> dbTransaction(statement: Transaction.() -> T): T {
    return transaction(transactionIsolation = Connection.TRANSACTION_SERIALIZABLE, repetitionAttempts = 1, db = db) {
        connection.autoCommit = true
        statement()
    }
}

fails with

01:27:41.195 [main] WARN Exposed - Transaction rollback failed: database in auto-commit mode. See previous log line for statement                                                                                                   
java.sql.SQLException: database in auto-commit mode