Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import Airflow's PostgresOperator

Tags:

python

airflow

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.

like image 691
Leandro Avatar asked Apr 16 '26 05:04

Leandro


1 Answers

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.

like image 141
Leandro Avatar answered Apr 18 '26 17:04

Leandro