File: //snap/google-cloud-cli/396/help/man/man1/gcloud_alpha_sql_instances_execute-sql.1
.TH "GCLOUD_ALPHA_SQL_INSTANCES_EXECUTE\-SQL" 1
.SH "NAME"
.HP
gcloud alpha sql instances execute\-sql \- executes a statement on a Cloud SQL instance
.SH "SYNOPSIS"
.HP
\f5gcloud alpha sql instances execute\-sql\fR \fIINSTANCE\fR \fB\-\-sql\fR=\fISQL\fR [\fB\-\-database\fR=\fIDATABASE\fR,\ \fB\-d\fR\ \fIDATABASE\fR] [\fB\-\-partial_result_mode\fR=\fIPARTIAL_RESULT_MODE\fR] [\fB\-\-row_limit\fR=\fIROW_LIMIT\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(ALPHA)\fR Executes a statement on a Cloud SQL instance. It will use the
credentials of the specified Google Cloud account to connect to the instance, so
an IAM user with the same name must exist in the instance. It doesn't support
DQL or DML statements yet. WARNING: The requests and responses might transit
through intermediate locations between your client and the location of the
target instance.
.SH "EXAMPLES"
To execute a statement on a Cloud SQL instance, run:
.RS 2m
$ gcloud alpha sql instances execute\-sql instance\-foo \e
\-\-sql="ALTER TABLE employees RENAME TO personnel;" \e
\-\-database=db1
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fIINSTANCE\fR
Cloud SQL instance ID.
.RE
.sp
.SH "REQUIRED FLAGS"
.RS 2m
.TP 2m
\fB\-\-sql\fR=\fISQL\fR
SQL statement(s) to execute. It supports multiple statements as well. When it
starts with the character '@', the rest should be a filepath to read the SQL
statement(s) from.
.RE
.sp
.SH "OPTIONAL FLAGS"
.RS 2m
.TP 2m
\fB\-\-database\fR=\fIDATABASE\fR, \fB\-d\fR \fIDATABASE\fR
Database on which the statement is executed.
.TP 2m
\fB\-\-partial_result_mode\fR=\fIPARTIAL_RESULT_MODE\fR
Controls how the API should respond when the SQL execution result is incomplete
due to size limit or other reasons. The default mode is to throw an error
instead of returning the partial result. \fIPARTIAL_RESULT_MODE\fR must be one
of:
.RS 2m
.TP 2m
\fBALLOW_PARTIAL_RESULT\fR
Return the partial result and mark the field partial_result to true if the
complete result can't be returned. Don't throw an error.
.TP 2m
\fBFAIL_PARTIAL_RESULT\fR
Throw an error if the complete result can't be returned. Don't return the
partial result.
.TP 2m
\fBPARTIAL_RESULT_MODE_UNSPECIFIED\fR
Unspecified mode, effectively the same as \f5FAIL_PARTIAL_RESULT\fR.
.RE
.sp
.TP 2m
\fB\-\-row_limit\fR=\fIROW_LIMIT\fR
Maximum number of rows to return. The default is unlimited.
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "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. This variant is also available:
.RS 2m
$ gcloud beta sql instances execute\-sql
.RE