actionSQL

export_data

Exports data from a Cloud SQL instance to a Cloud Storage bucket

Activity as code

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

Typeaction
Modulechaosgcp.sql.actions
Nameexport_data
Returnmapping

Usage

JSON

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

YAML

name: export-data
provider:
  arguments:
    instance_id: ""
    storage_uri: ""
  func: export_data
  module: chaosgcp.sql.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
instance_idstringYesInstance IDCloud SQL instance identifier
storage_uristringYesStorage URICloud Storage URI to the SQL/CSV dump
databasestringYesDatabasesName of the databases to export
project_idstringnullNoProject IDGoogle Cloud Project identifier
file_typestring“sql”NoDump TypeDump file type: sql, csv
tablestringnullNoTableName of the table to export
columnslistnullNoColumnsWhich columns to export
wait_until_completebooleantrueNoWait Until CompleteWait until operation has completed

Data is exported as a SQL dump or CSV file.

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

Signature

def export_data(instance_id: str,
                storage_uri: str,
                project_id: str = None,
                file_type: str = 'sql',
                databases: List[str] = None,
                tables: List[str] = None,
                export_schema_only: bool = False,
                wait_until_complete: bool = True,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass