Implementation:Astronomer Astronomer cosmos ClickhouseUserPasswordProfileMapping
| Knowledge Sources | |
|---|---|
| Domains | Profile_Mapping, ClickHouse |
| Last Updated | 2026-02-07 17:00 GMT |
Overview
Concrete tool for mapping Airflow generic connections to dbt clickhouse profiles provided by astronomer-cosmos.
Description
The ClickhouseUserPasswordProfileMapping maps an Airflow generic connection to a dbt clickhouse profile. It translates connection parameters (host, login, password, schema, port, extras) into the YAML structure that dbt expects in `profiles.yml`. This is a community-contributed adapter (`is_community=True`). It uses the `generic` Airflow connection type because there is no built-in ClickHouse provider connection type, extracting host, port, user, password, and schema from the connection fields.
Usage
Use this profile mapping when configuring Cosmos to run dbt commands against a ClickHouse backend. Assign it to `ProfileConfig(profile_mapping=...)` when the target Airflow connection uses the `generic` connection type configured for ClickHouse.
Code Reference
Source Location
- Repository: Astronomer_Astronomer_cosmos
- File: cosmos/profiles/clickhouse/user_pass.py
Signature
class ClickhouseUserPasswordProfileMapping(BaseProfileMapping):
airflow_connection_type: str = "generic"
dbt_profile_type: str = "clickhouse"
is_community: bool = True
Import
from cosmos.profiles.clickhouse import ClickhouseUserPasswordProfileMapping
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| conn_id | str | Yes | Airflow connection ID for ClickHouse (generic type) |
Outputs
| Name | Type | Description |
|---|---|---|
| profile | dict | dbt profile YAML dictionary |
| env_vars | dict | Environment variables for secret fields |
Usage Examples
from cosmos.config import ProfileConfig
from cosmos.profiles.clickhouse import ClickhouseUserPasswordProfileMapping
profile_config = ProfileConfig(
profile_name="default",
target_name="dev",
profile_mapping=ClickhouseUserPasswordProfileMapping(conn_id="clickhouse_default"),
)