- NAME
-
- gcloud alpha spanner databases import - import data from various source files to Cloud Spanner
- SYNOPSIS
-
-
gcloud alpha spanner databases import
--database
=DATABASE
--instance
=INSTANCE
--source-format
=SOURCE_FORMAT
--source-uri
=SOURCE_URI
[--csv-field-delimiter
=CSV_FIELD_DELIMITER
] [--csv-line-delimiter
=CSV_LINE_DELIMITER
] [--database-dialect
=DATABASE_DIALECT
] [--schema-uri
=SCHEMA_URI
] [--table-name
=TABLE_NAME
] [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
-
(ALPHA)
Import data from various source files to Cloud Spanner. - EXAMPLES
-
To import data from a source file to Cloud Spanner:
gcloud alpha spanner databases import --instance=instanceA --database=databaseA --table-name=tableA --source-uri=gs://bucket/data.csv --source-format=csv --schema_uri=gs://bucket/schema.csv
gcloud alpha spanner databases import --instance=instanceA --database=databaseA --source-uri=gs://bucket/dump.sql --source-format=mysqldump
- REQUIRED FLAGS
-
--database
=DATABASE
- Cloud Spanner database ID.
--instance
=INSTANCE
- Cloud Spanner instance ID.
--source-format
=SOURCE_FORMAT
- Format of the file with data to import.Supported formats: csv or myssqldump or pgdump
--source-uri
=SOURCE_URI
- URI of the file with data to import
- OPTIONAL FLAGS
-
--csv-field-delimiter
=CSV_FIELD_DELIMITER
- Field delimiter for CSV files.
--csv-line-delimiter
=CSV_LINE_DELIMITER
- Line delimiter for CSV files.
--database-dialect
=DATABASE_DIALECT
-
Dialect for the spanner database.
DATABASE_DIALECT
must be one of:POSTGRESQL
,GOOGLE_STANDARD_SQL
. --schema-uri
=SCHEMA_URI
- URI of the file with schema of the data to import
--table-name
=TABLE_NAME
- Cloud Spanner table name
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file
,--account
,--billing-project
,--configuration
,--flags-file
,--flatten
,--format
,--help
,--impersonate-service-account
,--log-http
,--project
,--quiet
,--trace-token
,--user-output-enabled
,--verbosity
.Run
$ gcloud help
for details. - NOTES
- This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist.
gcloud alpha spanner databases import
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-03 UTC.