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 Source

Last Updated: Dec. 8, 2020

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

sqlstr or list[str]SQL 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.
parametersdict or iterable(optional) the parameters to render the SQL query with.
autocommitboolif True, each command is automatically committed. (default value: False)
gcp_conn_idstrThe connection ID used to connect to Google Cloud for cloud-sql-proxy authentication.
gcp_cloudsql_conn_idstrThe connection ID used to connect to Google Cloud SQL its schema should be gcpcloudsql://. See :class:`~airflow.providers.google.cloud.hooks.cloud_sql.CloudSQLDatabaseHook` for details on how to define gcpcloudsql:// connection.No role entry for "class" in module "docutils.parsers.rst.languages.en". Trying "class" as canonical role name.Unknown interpreted text role "class".

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?