I am trying to run the following command
gcloud beta sql instances create my_replica \
--master-instance-name=db-master01 \
--master-username=replication_user \
--master-password='replication_password' \
--master-dump-file-path=gs://path/to/dump.sql.gz \
--database-flags default_time_zone='-05:00' \
sql_mode='STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION' \
--region=us-central \
--tier=db-g1-small
But I get the following error:
ERROR: (gcloud.beta.sql.instances.create) unrecognized arguments: sql_mode=STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION
To search the help text of gcloud commands, run:
gcloud help -- SEARCH_TERMS
Am I typing something incorrectly? Is this not supported?
UPDATE: From Stefan's response I updated my command to fix the syntax. The new error I get is the following:
Here is my command:
gcloud beta sql instances create $replica_name \
--master-instance-name=db-master01 \
--master-username=replication_user \
--master-password='replication_password' \
--master-dump-file-path=gs://path/to/dump.sql.gz \
--database-flags default_time_zone='-05:00',sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' \
--region=us-central \
--tier=db-g1-small
and here is the error:
ERROR: (gcloud.beta.sql.instances.create) argument --database-flags: Bad syntax for dict arg: [NO_ZERO_IN_DATE]. Please see `gcloud topic flags-file` or `gcloud topic escaping` for information on providing list or dictionary flag values with special characters.
Usage: gcloud beta sql instances create INSTANCE [optional flags]
optional flags may be --activation-policy | --assign-ip | --async |
--authorized-gae-apps | --authorized-networks |
--availability-type | --backup | --backup-start-time |
--client-certificate-path | --client-key-path | --cpu |
--database-flags | --database-version |
--enable-bin-log | --failover-replica-name |
--follow-gae-app | --gce-zone | --help | --labels |
--maintenance-release-channel |
--maintenance-window-day | --maintenance-window-hour |
--master-ca-certificate-path |
--master-dump-file-path | --master-instance-name |
--master-password | --master-username | --memory |
--network | --pricing-plan |
--prompt-for-master-password | --region |
--replica-type | --replication | --require-ssl |
--root-password | --source-ip-address | --source-port |
--storage-auto-increase |
--storage-auto-increase-limit | --storage-size |
--storage-type | --tier | --zone
For detailed information on this command and its flags, run:
gcloud beta sql instances create --help
I don't understand why NO_ZERO_IN_DATE
is a problem. Is it complaining because I'm passing it more than one value for the flag?