1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-08 10:35:03 +00:00
gcloud-help/gcloud/beta/sql/import/csv
2022-03-01 04:29:52 +00:00

89 lines
3.5 KiB
Text

NAME
gcloud beta sql import csv - imports data into a Cloud SQL instance from a
CSV file
SYNOPSIS
gcloud beta sql import csv INSTANCE URI --database=DATABASE, -d DATABASE
--table=TABLE [--async] [--columns=COLUMNS,[COLUMNS,...]]
[--escape=ESCAPE] [--fields-terminated-by=FIELDS_TERMINATED_BY]
[--lines-terminated-by=LINES_TERMINATED_BY] [--quote=QUOTE]
[--user=USER] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) Imports data into a Cloud SQL instance from a plain text file in a
Google Cloud Storage bucket with one line per row and comma-separated
fields.
POSITIONAL ARGUMENTS
INSTANCE
Cloud SQL instance ID.
URI
Path to the CSV file in Google Cloud Storage from which the import is
made. The URI is in the form gs://bucketName/fileName. Compressed gzip
files (.gz) are also supported.
REQUIRED FLAGS
--database=DATABASE, -d DATABASE
The database (for example, guestbook) to which the import is made.
--table=TABLE
The database table to import csv file into.
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to
complete.
--columns=COLUMNS,[COLUMNS,...]
The columns to import from csv file. These correspond to actual
database columns to import. If not set, all columns from csv file are
imported to corresponding database columns.
--escape=ESCAPE
Specifies the character that should appear before a data character that
needs to be escaped. The value of this argument has to be a character
in Hex ASCII Code. For example, "22" represents double quotes. This
flag is only available for MySQL and Postgres. If this flag is not
provided, double quotes character will be used as the default value.
--fields-terminated-by=FIELDS_TERMINATED_BY
Specifies the character that splits column values. The value of this
argument has to be a character in Hex ASCII Code. For example, "2C"
represents a comma. This flag is only available for MySQL and Postgres.
If this flag is not provided, a comma character will be used as the
default value.
--lines-terminated-by=LINES_TERMINATED_BY
Specifies the character that split line records. The value of this
argument has to be a character in Hex ASCII Code. For example, "0A"
represents a new line. This flag is only available for MySQL. If this
flag is not provided, a new line character will be used as the default
value.
--quote=QUOTE
Specifies the character that encloses values from columns that have
string data type. The value of this argument has to be a character in
Hex ASCII Code. For example, "22" represents double quotes. This flag
is only available for MySQL and Postgres. If this flag is not provided,
double quotes character will be used as the default value.
--user=USER
PostgreSQL user for this import operation.
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 beta and might change without notice. These
variants are also available:
$ gcloud sql import csv
$ gcloud alpha sql import csv