The Apache Airflow Postgres Provider offers a comprehensive set of operators, hooks, and sensors for seamless interaction with PostgreSQL databases within Airflow DAGs. It enables tasks such as executing SQL queries, transferring data, and managing database connections. The current version is 6.6.2, and it follows a frequent release cadence to support new Airflow features and address issues.
pip install apache-airflow-providers-postgresVerified import paths — ran on the pinned version, not inferred.
This example DAG defines two tasks using the `PostgresOperator`. The first task creates a 'pet' table if it doesn't already exist, and the second task populates it with sample data. Ensure you have an Airflow connection named 'postgres_default' configured in the Airflow UI, pointing to your PostgreSQL instance.
Upgrade your Apache Airflow instance to version 2.11.0 or later, or use an older provider version compatible with your Airflow installation.
Update any usage of `schema` in `PostgresHook` or related classes to use `database` instead.
Update any code that parses or expects the `postgres://` prefix from `get_uri()` to handle `postgresql://`.
Migrate from `runtime_parameters` to using `hook_params={'options': {'your_param': 'value'}}` for passing runtime configuration.Ensure your Airflow environment is running on Python 3.10 or higher. Check the `requires_python` field for precise version compatibility.