- NAME
-
- gcloud beta spanner databases create - create a Cloud Spanner database
- SYNOPSIS
-
-
gcloud beta spanner databases create
(DATABASE
:--instance
=INSTANCE
) [--async
] [--database-dialect
=DATABASE_DIALECT
] [--ddl
=DDL
] [--ddl-file
=DDL_FILE
] [--proto-descriptors-file
=PROTO_DESCRIPTORS_FILE
] [--kms-key
=KMS_KEY
:--kms-keyring
=KMS_KEYRING
--kms-location
=KMS_LOCATION
--kms-project
=KMS_PROJECT
] [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
-
(BETA)
Create a Cloud Spanner database. - EXAMPLES
-
To create an empty Cloud Spanner database, run:
gcloud beta spanner databases create testdb --instance=my-instance-id
To create a Cloud Spanner database with populated schema, run:
gcloud beta spanner databases create testdb --instance=my-instance-id --ddl='CREATE TABLE mytable (a INT64, b INT64) PRIMARY KEY(a)'
To create a Cloud Spanner database with the PostgreSQL dialect, run:
gcloud beta spanner databases create testdb --instance=my-instance-id --database-dialect=POSTGRESQL
- POSITIONAL ARGUMENTS
-
-
Database resource - The Cloud Spanner database to create. The arguments in this
group can be used to specify the attributes of this resource. (NOTE) Some
attributes are not given arguments in this group but can be set in other ways.
To set the
project
attribute:-
provide the argument
database
on the command line with a fully specified name; -
provide the argument
--project
on the command line; -
set the property
core/project
.
This must be specified.
DATABASE
-
ID of the database or fully qualified identifier for the database.
To set the
database
attribute:-
provide the argument
database
on the command line.
This positional argument must be specified if any of the other arguments in this group are specified.
-
provide the argument
--instance
=INSTANCE
-
The Cloud Spanner instance for the database.
To set the
instance
attribute:-
provide the argument
database
on the command line with a fully specified name; -
provide the argument
--instance
on the command line; -
set the property
spanner/instance
.
-
provide the argument
-
provide the argument
-
Database resource - The Cloud Spanner database to create. The arguments in this
group can be used to specify the attributes of this resource. (NOTE) Some
attributes are not given arguments in this group but can be set in other ways.
- FLAGS
-
--async
- Return immediately, without waiting for the operation in progress to complete.
--database-dialect
=DATABASE_DIALECT
-
The SQL dialect of the Cloud Spanner Database. GOOGLE_STANDARD_SQL is the
default.
DATABASE_DIALECT
must be one of:POSTGRESQL
,GOOGLE_STANDARD_SQL
. --ddl
=DDL
- Semi-colon separated DDL (data definition language) statements to run inside the newly created database. If there is an error in any statement, the database is not created. This option is not supported for the PostgreSQL dialect. Full DDL specification is at https://cloud.google.com/spanner/docs/data-definition-language
--ddl-file
=DDL_FILE
- Path of a file that contains semi-colon separated DDL (data definition language) statements to run inside the newly created database. If there is an error in any statement, the database is not created. This option is not supported for the PostgreSQL dialect. Full DDL specification is at https://cloud.google.com/spanner/docs/data-definition-language. If --ddl_file is set, --ddl is ignored. One line comments starting with -- are ignored.
--proto-descriptors-file
=PROTO_DESCRIPTORS_FILE
-
Path of a file that contains a protobuf-serialized
google.protobuf.FileDescriptorSet message. To generate it, install and run
protoc
with --include_imports and --descriptor_set_out. -
KMS key name group
At most one of these can be specified:
-
Key resource - Cloud KMS key to be used to create the Cloud Spanner database.
The arguments in this group can be used to specify the attributes of this
resource.
--kms-key
=KMS_KEY
-
ID of the key or fully qualified identifier for the key.
To set the
kms-key
attribute:-
provide the argument
--kms-key
on the command line.
This flag argument must be specified if any of the other arguments in this group are specified.
-
provide the argument
--kms-keyring
=KMS_KEYRING
-
KMS keyring id of the key.
To set the
kms-keyring
attribute:-
provide the argument
--kms-key
on the command line with a fully specified name; -
provide the argument
--kms-keyring
on the command line.
-
provide the argument
--kms-location
=KMS_LOCATION
-
Cloud location for the key.
To set the
kms-location
attribute:-
provide the argument
--kms-key
on the command line with a fully specified name; -
provide the argument
--kms-location
on the command line.
-
provide the argument
--kms-project
=KMS_PROJECT
-
Cloud project id for the key.
To set the
kms-project
attribute:-
provide the argument
--kms-key
on the command line with a fully specified name; -
provide the argument
--kms-project
on the command line.
-
provide the argument
-
Key resource - Cloud KMS key to be used to create the Cloud Spanner database.
The arguments in this group can be used to specify the attributes of this
resource.
- 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 spanner databases create
gcloud alpha spanner databases create
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 2024-06-11 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-06-11 UTC."}