actionSQL

import_data

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage

Activity as code

Below are the details and signature of the activity Python module.

Typeaction
Modulechaosgcp.sql.actions
Nameimport_data
Returnmapping

Usage

JSON

{
  "name": "import-data",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.actions",
    "func": "import_data",
    "arguments": {
      "instance_id": "",
      "storage_uri": "",
      "database": ""
    }
  }
}

YAML

name: import-data
provider:
  arguments:
    database: ""
    instance_id: ""
    storage_uri: ""
  func: import_data
  module: chaosgcp.sql.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
instance_idstringYesInstance IDCloud SQL instance identifier
storage_uristringYesStorage URICloud Storage URI of the SQL/CSV dump
databasestringYesDatabaseName of the database to import into
project_idstringnullNoProject IDGoogle Cloud Project identifier
file_typestring“sql”NoData FileDump file type: sql, csv
import_userstringnullNoImport UserName of the user to import with
tablestringnullNoTableName of the table to import
columnslistnullNoColumnsWhich columns to import
wait_until_completebooleantrueNoWait Until CompleteWait until operation has completed

Data is imported as a SQL dump or CSV file.

See https://cloud.google.com/sql/docs/postgres/admin-api/v1beta4/instances/import

Signature

def import_data(instance_id: str,
                storage_uri: str,
                database: str,
                project_id: str = None,
                file_type: str = 'sql',
                import_user: str = None,
                table: str = None,
                columns: List[str] = None,
                wait_until_complete: bool = True,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass