Closed rakyll closed 4 years ago
Yes, you can.
spanner-dump already supports SPANNER_EMULATOR_HOST
as an environment variable. So you can move data from Spanner service to emulator.
# export data from Spanner service
spanner-dump -p ${PROJECT} -i ${INSTANCE} -d ${DATABASE} > dump.sql
# import data to emulator
SPANNER_EMULATOR_HOST=localhost:9010 spanner-cli -p ${PROJECT} -i ${INSTANCE} -d ${DATABASE} < dump.sql
Note that second example uses spanner-cli for importing data.
Great, thanks! Maybe it'd be great to mention it in the README.
Will do! Thanks!
I'd like to use the spanner-dump to migrate my schema and data from my production database to the emulator? I'd be great to be able to set the SPANNER_EMULATOR_HOST and be able to import to the emulator.