Add support for Cloud Spanner Emulator #48
Labels
api: spanner
Issues related to the googleapis/ruby-spanner-activerecord API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
I would like to use Cloud Spanner Emulator to develop this gem and to develop Rails application using gem. Although, there are limitations and differences, the emulator does not cost money 💸 and the separated environments are suited for local development.
https://cloud.google.com/spanner/docs/emulator
Then, I've found out that the current implementation of this library does not support emulator.
This is because
Google::Cloud.spanner
is used instead ofGoogle::Cloud::Spanner.new
. The former method pass the limited portion of parameters to the latter.ruby-spanner-activerecord/lib/activerecord_spanner_adapter/connection.rb
Lines 28 to 36 in 86909be
If we directly call
Google::Cloud::Spanner.new(config)
, we can pass theemulator_host
parameter in config, which enable developers to use Cloud Spanner Emulator.https://github.com/googleapis/google-cloud-ruby/blob/06c73b3b4b09e5f4dded27b61662fe110fea57bb/google-cloud-spanner/lib/google/cloud/spanner.rb#L91-L101
Although, this breaks
config[:project]
,config[:credentials]
compatibility, I think keeping consistency withGoogle::Cloud::Spanner.new
reduces maintenance cost.Of course, If required, I can write backward-compatible code.
If the above strategy is O.K., I am willing to work on this issue.
The text was updated successfully, but these errors were encountered: