Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to import the PostgresOperator from the airflow package:

from airflow.providers.postgres.operators.postgres import PostgresOperator

But I'm getting the following error: Cannot find reference 'postgres' in imported module airflow.providers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
634 views
Welcome To Ask or Share your Answers For Others

1 Answer

The solution was to run the following in the terminal, using the project's virtualenv: pip install 'apache-airflow[postgres]'.

Please notice that it won't work if you don't wrap the name of the package between single-quotes.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...