airflowairflow-cli

How To Set `Database` Field In Airflow Connection When Using `Airflow Connections import`


Description

I'm running into the following error when attempting to run airflow connections import

The object have illegal keys: database. The dictionary can only contain the following keys: {'login', 'password', 'schema', 'description', 'conn_type', 'port', 'conn_id', 'host', 'extra_dejs
on', 'extra', 'uri'}

even though on the Airflow server I can see a field called Database.

Additionally, my connection is defaulting to the Amazon Chime Webhook type. I'm trying to find out what's happening in this case.

Connections File

{
    "landing_db": {
        "host": "data-pipeline-db",
        "database": "test-db",
        "description": "",
        "port": "5432",
        "login": "test",
        "password": "test",
        "conn_type": "postgresql"},
    "time_series": {
        "host": "data-pipeline-db",
        "description": "",
        "database": "test-db",
        "port": "5432",
        "login": "test",
        "password": "test",
        "conn_type": "postgresql"
    }
}

Solution

  • Answer

    In my case the core issue is that database should be schema and my connection time should just be postgres. I figured this out by exporting the base example connections.

    {
        "landing_db": {
            "host": "data-pipeline-db",
            "schema": "test-db",
            "description": "",
            "port": "5432",
            "login": "data-pipeline",
            "password": "test",
            "conn_type": "postgres"},
        "time_series": {
            "host": "data-pipeline-db",
            "description": "",
            "schema": "test-db",
            "port": "5432",
            "login": "data-pipeline",
            "password": "test",
            "conn_type": "postgres"
        }
    }