Exposed icon indicating copy to clipboard operation
Exposed copied to clipboard

Cloud native database compatibility

Open corporatepiyush opened this issue 7 years ago • 9 comments

Is it compatible with Google Cloud Spanner and CockroachDB ?

corporatepiyush avatar Oct 21 '17 15:10 corporatepiyush

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.

Tapac avatar Oct 23 '17 12:10 Tapac

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

dmcg avatar Apr 15 '21 08:04 dmcg

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.

Jerbell avatar Oct 05 '21 04:10 Jerbell

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

matheusfrancisco avatar Apr 03 '22 17:04 matheusfrancisco

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

Tapac avatar Apr 10 '22 11:04 Tapac

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!

lfgcampos avatar May 12 '22 16:05 lfgcampos

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

marcosb avatar Mar 02 '23 04:03 marcosb

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

marcosb avatar Mar 02 '23 04:03 marcosb

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                                                               

alex-shinn avatar Jun 22 '23 00:06 alex-shinn