Method: projects.locations.clusters.import

Imports data to the cluster. Imperative only.

HTTP request

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

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.import

Request body

The request body contains data with the following structure:

JSON representation
{
  "gcsUri": string,
  "database": string,
  "user": string,

  // Union field import_options can be only one of the following:
  "sqlImportOptions": {
    object (SqlImportOptions)
  },
  "csvImportOptions": {
    object (CsvImportOptions)
  }
  // End of list of possible types for union field import_options.
}
Fields
gcsUri

string

Required. The path to the file in Google Cloud Storage where the source file for import will be stored. The URI is in the form gs://bucketName/fileName.

database

string

Optional. Name of the database to which the import will be done. For import from SQL file, this is required only if the file does not specify a database. Note - Value provided should be the same as expected from SELECT current_database(); and NOT as a resource reference.

user

string

Optional. Database user to be used for importing the data. Note - Value provided should be the same as expected from SELECT current_user; and NOT as a resource reference.

Union field import_options. oneof field to support various import formats like SQL and CSV. import_options can be only one of the following:
sqlImportOptions

object (SqlImportOptions)

Options for importing data in SQL format.

csvImportOptions

object (CsvImportOptions)

Options for importing data in CSV format.

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.import

For more information, see the IAM documentation.

SqlImportOptions

This type has no fields.

Options for importing data in SQL format.

CsvImportOptions

Options for importing data in CSV format.

JSON representation
{
  "table": string,
  "columns": [
    string
  ],
  "fieldDelimiter": string,
  "quoteCharacter": string,
  "escapeCharacter": string
}
Fields
table

string

Required. The database table to import CSV file into.

columns[]

string

Optional. The columns to which CSV data is imported. If not specified, all columns of the database table are loaded with CSV 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 same as quote character. The value of this argument has to be a character in Hex ASCII Code.