cloudspannerecosystem / spanner-dump

Command line tool for exporting a Cloud Spanner database in text format
Apache License 2.0
39 stars 13 forks source link

How about docker image? #21

Open drakulis opened 1 year ago

drakulis commented 1 year ago

Hi,

I'm wondering if you can provide docker image were spanner-dump is already installed?

I'm not go-lang developer. I'm trying to install it using instructions from readme file but it doesn't seem work for me. All I get is an error/warning during installation and spanner doesn't seem to be installed.

obraz

I have also installed newer Go (1.20) and used following command:

go install github.com/cloudspannerecosystem/spanner-dump@latest

This time installation ended up successfully but spanner-dump command is still unavailable 😞 obraz

yfuruyama commented 1 year ago

go install installs the command in $GOPATH/bin directory. So to use the installed command, you need to set a PATH for $GOPATH/bin directory.

Here is the example:

$ go env GOPATH
/some/directory/go

$ export PATH=$PATH:/some/directory/go/bin
drakulis commented 1 year ago

@yfuruyama Thank you very much! It works now. I mean I can execute command.

Could you guide me how to dump spanner data from emulator? It seems spanner-dump tries to dump "real" spanner data. I do not see any parameter where i can set up spanner url. I've tried to set it up via

gcloud config set api_endpoint_overrides/spanner http://spanner:9020/

but is still doesn't work.

Maybe I'm mixing something... I'm pretty new to Spanner.

yfuruyama commented 1 year ago

No problem at all. If you need to use Spanner Emulator, please try to set SPANNER_EMULATOR_HOST environment variable before running spanner-dump command. Reference: https://cloud.google.com/spanner/docs/emulator#client-libraries

Sorry for not documenting well, but spanner-cli has a relevant document, so please take a look at this as well: https://github.com/cloudspannerecosystem/spanner-cli#using-with-the-cloud-spanner-emulator

drakulis commented 1 year ago

It works!!! Thank you very much for your support!