Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudspannerecosystem/spanner-dump
Command line tool for exporting a Cloud Spanner database in text format
https://github.com/cloudspannerecosystem/spanner-dump
Last synced: 3 months ago
JSON representation
Command line tool for exporting a Cloud Spanner database in text format
- Host: GitHub
- URL: https://github.com/cloudspannerecosystem/spanner-dump
- Owner: cloudspannerecosystem
- License: apache-2.0
- Created: 2020-04-08T03:34:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-07T01:53:40.000Z (5 months ago)
- Last Synced: 2024-07-15T19:56:44.990Z (4 months ago)
- Language: Go
- Homepage:
- Size: 175 KB
- Stars: 39
- Watchers: 6
- Forks: 13
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-spanner - spanner-dump - A command-line tool to export Cloud Spanner databases in text format. (Tools / ORM)
README
spanner-dump [![run-tests](https://github.com/cloudspannerecosystem/spanner-dump/actions/workflows/run-tests.yaml/badge.svg)](https://github.com/cloudspannerecosystem/spanner-dump/actions/workflows/run-tests.yaml)
===spanner-dump is a command line tool for exporting a Cloud Spanner database in text format.
Exported databases can be imported to Cloud Spanner with [spanner-cli](https://github.com/cloudspannerecosystem/spanner-cli).
```sh
# Export
$ spanner-dump -p ${PROJECT} -i ${INSTANCE} -d ${DATABASE} > data.sql# Import
$ spanner-cli -p ${PROJECT} -i ${INSTANCE} -d ${DATABASE} < data.sql
```Please feel free to report issues and send pull requests, but note that this application is not officially supported as part of the Cloud Spanner product.
## Use cases
This tool can be used for the following use cases.
- Export a database schema and/or data in text format for testing purposes
- Export a database running on [Cloud Spanner Emulator](https://cloud.google.com/spanner/docs/emulator)For production databases, you should use an [officially-provided export](https://cloud.google.com/spanner/docs/export),
which should be stable and much faster.## Limitations
- This tool does not ensure consistency between database schema (DDL) and data. So you should avoid making changes to the schema while you are running this tool.
- This tool does not consider data order constrained by [Foreign Keys](https://cloud.google.com/spanner/docs/foreign-keys/overview).## Install
```
go install github.com/cloudspannerecosystem/spanner-dump@latest
```## Usage
```
Usage:
spanner-dump [OPTIONS]Application Options:
-p, --project= (required) GCP Project ID. [$SPANNER_PROJECT_ID]
-i, --instance= (required) Cloud Spanner Instance ID. [$SPANNER_INSTANCE_ID]
-d, --database= (required) Cloud Spanner Database ID. [$SPANNER_DATABASE_ID]
--tables= comma-separated table names, e.g. "table1,table2"
--no-ddl No DDL information.
--no-data Do not dump data.
--timestamp= Timestamp for database snapshot in the RFC 3339 format.
--bulk-size= Bulk size for values in a single INSERT statement.Help Options:
-h, --help Show this help message
```This tool uses [Application Default Credentials](https://cloud.google.com/docs/authentication/production)
to connect to Cloud Spanner. Please make sure to get credentials via `gcloud auth application-default login`
before using this tool.Also, you need to have a [roles/spanner.databaseReader](https://cloud.google.com/spanner/docs/iam#roles)
IAM role to use this tool.## Disclaimer
This tool is still ALPHA quality. Do not use this tool for production databases.