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: add dialect for spanner using pg adapter #900

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matdurand
Copy link

Adding support for Google Spanner but only when using their PGAdapter, which uses postgres drivers to talk to Spanner.

@@ -0,0 +1,9 @@
//go:build !no_spannerpg
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about this file, since Spanner PG would use the regular Postgres PGX driver, so should we just use "no_postgres" for both postgres and spanner?

@@ -97,6 +98,7 @@ Examples:
goose vertica "vertica://user:password@localhost:5433/dbname?connection_load_balance=1" status
goose ydb "grpcs://localhost:2135/local?go_query_mode=scripting&go_fake_tx=scripting&go_query_bind=declare,numeric" status
goose starrocks "user:password@/dbname?parseTime=true&interpolateParams=true" status
goose spannerpg "user=postgres dbname=postgres sslmode=disable" status
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assume the PGAdapter is running locally on the default postgres port.

@@ -0,0 +1,44 @@
package dialectquery
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spanner via PGAdapter only has partial support for current_schema, and we can only query it directly via select current_schema but not in a where clause. For this reason, I removed the Exists to use the fallback method like the mssql dialect does.

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

Successfully merging this pull request may close these issues.

1 participant