Rett_oo
Rett_oo

Reputation: 153

How to connect airflow with database by unsing Astronomer

Please tell me how I can connect Apache Airflow (I run it via “astro” on the local computer) and my database (PostgreSQL), which is also installed on my local computer?

Traceback

psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
    Is the server running on that host and accepting TCP/IP connections?

By the way, how can I enable connection testing in the admin-connection panel? (I tried to write test_connection = Enabled in the airflow.cfg file inside the docker container, but it does not work, even after rebooting the container)

I tried adding "host.docker.localhost" to the connection, but it didn't help.

Upvotes: 2

Views: 411

Answers (1)

AshKatchEm
AshKatchEm

Reputation: 17

I'm not sure about the first part of your question but regarding enabling connection testing in the Airflow UI, I was able to enable it by configuring the airflow instance from the .env file

In the .env file enter:

   AIRFLOW__CORE__TEST_CONNECTION="Enabled"

Save it and then enter in a terminal:

astro dev start --env .env

or

astro dev restart --env .env

Upvotes: 1

Related Questions