Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Astronomer Astronomer cosmos SnowflakeEncryptedPrivateKeyEnvProfileMapping

From Leeroopedia
Revision as of 14:30, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Astronomer_Astronomer_cosmos_SnowflakeEncryptedPrivateKeyEnvProfileMapping.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Profile_Mapping, Snowflake
Last Updated 2026-02-07 17:00 GMT

Overview

Concrete tool for mapping Airflow snowflake connections to dbt snowflake profiles provided by astronomer-cosmos.

Description

The SnowflakeEncryptedPrivateKeyEnvProfileMapping maps an Airflow snowflake connection to a dbt snowflake profile. It translates connection parameters (host, login, password, schema, port, extras) into the YAML structure that dbt expects in `profiles.yml`. This variant passes an encrypted private key via an environment variable.

Usage

Use this profile mapping when configuring Cosmos to run dbt commands against a Snowflake backend. Assign it to `ProfileConfig(profile_mapping=...)` when the target Airflow connection uses the `snowflake` connection type and authentication is performed with an encrypted private key supplied through an environment variable.

Code Reference

Source Location

Signature

class SnowflakeEncryptedPrivateKeyEnvProfileMapping(SnowflakeBaseProfileMapping):
    airflow_connection_type: str = "snowflake"
    dbt_profile_type: str = "snowflake"

Import

from cosmos.profiles.snowflake import SnowflakeEncryptedPrivateKeyEnvProfileMapping

I/O Contract

Inputs

Name Type Required Description
conn_id str Yes Airflow connection ID for Snowflake

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.snowflake import SnowflakeEncryptedPrivateKeyEnvProfileMapping

profile_config = ProfileConfig(
    profile_name="default",
    target_name="dev",
    profile_mapping=SnowflakeEncryptedPrivateKeyEnvProfileMapping(conn_id="snowflake_default"),
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment