instances

Execute SQL statements.

post/v1/projects/{project}/instances/{instance}/executeSql

Request

  • Base URL: https://sqladmin.googleapis.com
  • URL: https://sqladmin.googleapis.com/v1/projects/{project}/instances/{instance}/executeSql
  • Auth: one of:
    • OAuth 2 (implicit, authorization URL https://accounts.google.com/o/oauth2/auth, scopes: https://www.googleapis.com/auth/cloud-platform) and OAuth 2 (authorization code, authorization URL https://accounts.google.com/o/oauth2/auth, token URL https://accounts.google.com/o/oauth2/token, scopes: https://www.googleapis.com/auth/cloud-platform)
    • OAuth 2 (implicit, authorization URL https://accounts.google.com/o/oauth2/auth, scopes: https://www.googleapis.com/auth/sqlservice.admin) and OAuth 2 (authorization code, authorization URL https://accounts.google.com/o/oauth2/auth, token URL https://accounts.google.com/o/oauth2/token, scopes: https://www.googleapis.com/auth/sqlservice.admin)

Path parameters

projectstring required

Required. Project ID of the project that contains the instance.

instancestring required

Required. Database instance ID. This does not include the project ID.

Query parameters

locationstring

Optional. Region of the Cloud SQL instance.

Request body

applicationstring

Optional. Specifies the name of the application that is making the request. This field is used for telemetry. Only alphanumeric characters, dashes, and underscores are allowed. The maximum length is 32 characters.

autoIamAuthnboolean

Optional. When set to true, the API caller identity associated with the request is used for database authentication. The API caller must be an IAM user in the database.

databasestring

Optional. Name of the database on which the statement will be executed. For Postgres and SQL Server it's required, for MySQL it's optional.

partialResultMode'PARTIAL_RESULT_MODE_UNSPECIFIED' | 'FAIL_PARTIAL_RESULT' | 'ALLOW_PARTIAL_RESULT'

Optional. Controls how the API should respond when the SQL execution result is incomplete due to the size limit or another error. The default mode is to throw an error.

passwordSecretVersionstring

Optional. The resource name of the Secret Manager secret holding the password for the user to log into the database. The secret should be created using the regional endpoint (for API) or from the Regional Secrets page (for UI), and stored in the same region as the Cloud SQL instance. The expected resource name format is projects/{project}/locations/{location}/secrets/{secret}/versions/{secret_version}. Used together with the user field. The secret resource name will not be stored.

rowLimitstring int64

Optional. The maximum number of rows returned per SQL statement.

sqlStatementstring

Required. SQL statements to run on the database. It can be a single statement or a sequence of statements separated by semicolons.

userstring

Optional. The name of an existing database user to connect to the database. When auto_iam_authn is set to true, this field is ignored and the API caller's IAM user is used.

Response

Successful response

Changes

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/sqlservice.admin was removed from the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/sqlservice.admin was removed from the endpoint's security scheme Oauth2c

    • breaking

      removed the request body

    • breaking

      removed the media type */* for the response with the status

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/sqlservice.admin was removed from the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/sqlservice.admin was removed from the endpoint's security scheme Oauth2c