CloudSQLExecuteQueryOperator

Google

Performs DML or DDL query on an existing Cloud Sql instance. It optionally uses cloud-sql-proxy to establish secure connection with the database.

View on GitHub

Last Updated: Mar. 3, 2023

Access Instructions

Install the Google provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

sqlRequiredSQL query or list of queries to run (should be DML or DDL query - this operator does not return any data from the database, so it is useless to pass it DQL queries. Note that it is responsibility of the author of the queries to make sure that the queries are idempotent. For example you can use CREATE TABLE IF NOT EXISTS to create a table.
parameters(optional) the parameters to render the SQL query with.
autocommitif True, each command is automatically committed. (default value: False)
gcp_conn_idThe connection ID used to connect to Google Cloud for cloud-sql-proxy authentication.
gcp_cloudsql_conn_idThe connection ID used to connect to Google Cloud SQL its schema should be gcpcloudsql://. See CloudSQLDatabaseHook for details on how to define gcpcloudsql:// connection.
sql_proxy_binary_path(optional) Path to the cloud-sql-proxy binary. is not specified or the binary is not present, it is automatically downloaded.

Documentation

Performs DML or DDL query on an existing Cloud Sql instance. It optionally uses cloud-sql-proxy to establish secure connection with the database.

See also

For more information on how to use this operator, take a look at the guide: CloudSQLExecuteQueryOperator

Was this page helpful?