Add spanner support as an SQL output #122
Open
+1,258
−172
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds Google Cloud Spanner (https://cloud.google.com/spanner?hl=en) support for sql_raw and sql_insert.
Since spanner conforms to the standards sql library this is mostly just an import. Quoting in spanner sql is slightly different than normal sql (it doesn't like double quotes) so some conditional logic had to be added, particularly in the integration tests.
The integration tests are done in the same fashion as all the other ones, with a docker container that runs the spanner emulator (dockerfile + startup script included here)
Bigger change
One bigger thing is that I've removed all the references to db.close(). In the spanner emulator this causes the emulator to actually shut down the connectionand not be able to be reused.
Reading the go docs, it seems like we really shouldn't be doing this anyways (https://pkg.go.dev/database/sql#Open) but I'm open to being wrong about this. We'd likely need to restart the spanner emulator docker container for each test.
My interpretation is that if we shouldn't be manually running close anyways then its simpler just to not run close