问题
I am not able to import statement as-
from airflow.contrib.operators.gcp_sql_operator import CloudSqlQueryOperator
I want to import this in my DAG file which will be run in cloud composer airflow whose version is 1.10.0 and not 1.9.0.Here just to check, I tried to import gcs_to_gcs as-
from airflow.contrib.operators.gcs_to_gcs import GoogleCloudStorageToGoogleCloudStorageOperator
I am able to import this but not gcp_sql_operator.
回答1:
The CloudSqlQueryOperator
operator is released since Airflow 1.10.2, which is currently not supported in Composer versions. The support for 1.10.2 should be available soon in Composer, before that you may want to manually copy gcp_sql_operator.py
and its dependencies to the Composer dags
folder following the instruction here.
来源:https://stackoverflow.com/questions/55585503/no-module-named-gcp-sql-operator-in-cloud-composer