Method: projects.locations.clusters.export

Exports data from the cluster. Imperative only.

HTTP request

POST https://alloydb.googleapis.com/v1beta/{name=projects/*/locations/*/clusters/*}:export

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The resource name of the cluster.

Authorization requires the following IAM permission on the specified resource name:

  • alloydb.clusters.export

Request body

The request body contains data with the following structure:

JSON representation
{
  "database": string,

  // Union field destination can be only one of the following:
  "gcsDestination": {
    object (GcsDestination)
  }
  // End of list of possible types for union field destination.

  // Union field export_options can be only one of the following:
  "csvExportOptions": {
    object (CsvExportOptions)
  },
  "sqlExportOptions": {
    object (SqlExportOptions)
  }
  // End of list of possible types for union field export_options.
}
Fields
database

string

Required. Name of the database where the query will be executed. Note - Value provided should be the same as expected from SELECT current_database(); and NOT as a resource reference.

Union field destination. Oneof field to support other destinations in future. destination can be only one of the following:
gcsDestination

object (GcsDestination)

Required. Option to export data to cloud storage.

Union field export_options. Required field to specify export file type and options. export_options can be only one of the following:
csvExportOptions

object (CsvExportOptions)

Options for exporting data in CSV format. Required field to be set for CSV file type.

sqlExportOptions

object (SqlExportOptions)

Options for exporting data in SQL format. Required field to be set for SQL file type.

Response body

If successful, the response body contains an instance of Operation.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • alloydb.googleapis.com/alloydb.clusters.export

For more information, see the IAM documentation.

GcsDestination

Destination for Export. Export will be done to cloud storage.

JSON representation
{
  "uri": string
}
Fields
uri

string

Required. The path to the file in Google Cloud Storage where the export will be stored. The URI is in the form gs://bucketName/fileName. If the file already exists, the request succeeds, but the operation fails.

CsvExportOptions

Options for exporting data in CSV format. For now, we only support a query to get the data that needs to be exported.

JSON representation
{
  "selectQuery": string,
  "fieldDelimiter": string,
  "quoteCharacter": string,
  "escapeCharacter": string
}
Fields
selectQuery

string

Required. The selectQuery used to extract the data.

fieldDelimiter

string

Optional. Specifies the character that separates columns within each row (line) of the file. The default is comma. The value of this argument has to be a character in Hex ASCII Code.

quoteCharacter

string

Optional. Specifies the quoting character to be used when a data value is quoted. The default is double-quote. The value of this argument has to be a character in Hex ASCII Code.

escapeCharacter

string

Optional. Specifies the character that should appear before a data character that needs to be escaped. The default is the same as quote character. The value of this argument has to be a character in Hex ASCII Code.

SqlExportOptions

Options for exporting data in SQL format.

JSON representation
{
  "tables": [
    string
  ],
  "schemaOnly": boolean,
  "cleanTargetObjects": boolean,
  "ifExistTargetObjects": boolean
}
Fields
tables[]

string

Optional. Tables to export from.

schemaOnly

boolean

Optional. If true, only export the schema.

cleanTargetObjects

boolean

Optional. If true, output commands to DROP all the dumped database objects prior to outputting the commands for creating them.

ifExistTargetObjects

boolean

Optional. If true, use DROP ... IF EXISTS commands to check for the object's existence before dropping it in cleanTargetObjects mode.