Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

Commit 3a7029d

Browse files
authored
DCV-3505 use key-pair authentication in Airflow (#64)
* DCV-3505 use key-pair authentication in Airflow * Change SC docs to show RSA Keys
1 parent 96314d0 commit 3a7029d

7 files changed

+43
-0
lines changed

docs/_sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [Airflow - Accessing the Airflow API](/how-tos/airflow/use-airflow-api.md)
2121
- [Airflow - Sync Internal Airflow database](/how-tos/airflow/sync-database.md)
2222
- [Airflow - Trigger a DAG using Datasets](how-tos/airflow/api-triggered-dag.md)
23+
- [Airflow - Use Key-Pair Authentication](how-tos/airflow/use-key-pair-authentication.md)
2324
- [DAGs - Add Dag Documentation](/how-tos/airflow/create-dag-level-docs.md)
2425
- [DAGs - Calling External Python Scripts](/how-tos/airflow/external-python-dag.md)
2526
- [DAGs - Dynamically Set Schedule](/how-tos/airflow/dynamically-set-schedule.md)
173 KB
Loading
197 KB
Loading
183 KB
Loading
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Using Key-Pair Authentication in Airflow
2+
3+
> [!NOTE] This documentation will presume you have knowledge of Datacoves' [Service Connections](/how-tos/datacoves/how_to_service_connections.md) and how to configure them.
4+
5+
Using RSA Keys is only supported through Airflow Connections, not Environment Variables. Make sure your Datacoves Service Connection is using this `delivery mode`.
6+
7+
![alt text](assets/delivery_mode_airflow_connection.png)
8+
9+
Also, make sure to select `Authentication mechanism: RSA Key-pair` and [assign the generated key to your Snowflake user](https://docs.snowflake.com/en/user-guide/key-pair-auth#assign-the-public-key-to-a-snowflake-user).
10+
11+
![authentication_mechanism_copy](assets/authentication_mechanism_copy.png)
12+
13+
Once you have properly configured your Service Connection, your Airflow instance will restart. This process may take up to 10 minutes.
14+
15+
To confirm the above worked correctly, you can access your Airflow `Admin -> Connections` menu, and make sure your Service Connection is now an Airflow Connection.
16+
17+
![airflow_admin_connections](assets/airflow_admin_connections.png)
18+
19+
## Usage
20+
21+
Thanks to our new [`dbt` Airflow Decorator](/reference/airflow/datacoves-decorators.md), you can run dbt against your warehouse using the Airflow Connection you just created, by simply passing the Service Connection name to our decorator's `connection_id` parameter.
22+
23+
24+
25+
```python
26+
@dag(
27+
[...]
28+
)
29+
def dbt_dag():
30+
31+
@task.datacoves_dbt(
32+
connection_id="main_key_pair" # your service connection name
33+
)
34+
def run_dbt():
35+
return "dbt debug" # return any dbt command
36+
37+
run_dbt()
38+
39+
dbt_dag()
40+
```
198 KB
Loading

docs/how-tos/datacoves/how_to_service_connections.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ A Service Connection consists of the following fields:
2424

2525
![Service Connection Connection Details](./assets/serviceconnection_editnew_details.png)
2626

27+
> [!NOTE] Snowflake is [deprecating single-factor password sign-ins](https://docs.snowflake.com/en/user-guide/security-mfa-rollout). For this reason, we encourage users to always use `RSA Key-pair` authentication mechanism for Service Connections.
28+
2729
## Getting Started Next Steps
2830
In the following step, you will update your repository by incorporating the necessary folders and files for Airflow. Specifically, you will add the `orchestrate/dags` directories along with `automate/dbt/profiles.yml`.
2931

0 commit comments

Comments
 (0)