dbt-coves data-sync snowflake --source <dataset_name>Syncs Airflow's metadata tables (see data-sync overview for the default table list and incremental/full-load strategy) into a Snowflake database, using the dlt sql_database source and a Snowflake dlt destination.
--source
# Required. Name of the destination dataset (schema) in Snowflake the tables are loaded into.--tables
# Optional, comma separated. Extra tables to sync in addition to the default Airflow table set.Snowflake destination credentials are read from environment variables (not CLI flags), following the DATA_SYNC_SNOWFLAKE_* naming convention:
DATA_SYNC_SNOWFLAKE_DATABASE
DATA_SYNC_SNOWFLAKE_WAREHOUSE
DATA_SYNC_SNOWFLAKE_ROLE
DATA_SYNC_SNOWFLAKE_USER
DATA_SYNC_SNOWFLAKE_ACCOUNTPlus one of:
DATA_SYNC_SNOWFLAKE_PRIVATE_KEY # and optionally DATA_SYNC_SNOWFLAKE_PRIVATE_KEY_PASSWORD
# or
DATA_SYNC_SNOWFLAKE_PASSWORDIf neither DATA_SYNC_SNOWFLAKE_PRIVATE_KEY nor DATA_SYNC_SNOWFLAKE_PASSWORD is set, the command fails before attempting to load. Key-pair auth takes priority when both are present.
- These env vars are copied internally into
dlt's expectedDESTINATION__SNOWFLAKE__CREDENTIALS__*variables (database, warehouse, role, username, host, and password/private key) - you never need to set theDESTINATION__*ones yourself, only theDATA_SYNC_SNOWFLAKE_*ones above. - Datacoves environment: when this command runs via Datacoves'
DatacovesDataSyncOperatorSnowflakeAirflow operator, all of theDATA_SYNC_SNOWFLAKE_*variables above (plusDATA_SYNC_SOURCE_CONNECTION_STRING) are populated automatically for that task run - either from the named Airflow Connection (connection_id) or from the environment's ownDATACOVES__<SERVICE_CONNECTION_NAME>__*variables, depending on how the operator is configured. You only need to export them by hand when invokingdbt-coves data-sync snowflakeoutside of that operator. --sourcedoubles as thedltpipeline'sdataset_name, i.e. the schema that gets created/used in the destination database.
export DATA_SYNC_SOURCE_CONNECTION_STRING="postgresql://airflow:pass@airflow-db:5432/airflow"
export DATA_SYNC_SNOWFLAKE_DATABASE=ANALYTICS
export DATA_SYNC_SNOWFLAKE_WAREHOUSE=LOADING
export DATA_SYNC_SNOWFLAKE_ROLE=LOADER
export DATA_SYNC_SNOWFLAKE_USER=DLT_LOADER
export DATA_SYNC_SNOWFLAKE_ACCOUNT=my_account
export DATA_SYNC_SNOWFLAKE_PASSWORD=********
dbt-coves data-sync snowflake --source airflow_metadata --tables xcom,trigger