raphaelauv commented on issue #54983:
URL: https://github.com/apache/airflow/issues/54983#issuecomment-5293697715
this is a working example of using snowflake OIDC with
SQLExecuteQueryOperator
apache-airflow==3.3.1
apache-airflow-providers-snowflake==6.16.0
snowflake user :
```sql
CREATE USER AIRFLOW_WIF_USER
TYPE = SERVICE
WORKLOAD_IDENTITY = (
TYPE = AWS
ARN = 'arn:aws:iam::XXXXXXXXXXX:role/airflow-snowflake-wif'
)
DEFAULT_ROLE = AAAAAAAAAAA
DEFAULT_WAREHOUSE = YYYYYYYY
COMMENT = 'Airflow WIF Service Account via EKS';
GRANT ROLE AAAAAAAAAAA TO USER AIRFLOW_WIF_USER;
```
airflow connection for snowflake/sql operator:
```json
{
"account": "mbXXXXX",
"warehouse": "YYYYYYYY",
"database": "MMMMMMMMMM",
"role": "AAAAAAAAAAA",
"workload_identity_provider": "AWS",
"schema": "PUBLIC",
"authenticator": "WORKLOAD_IDENTITY",
"region": "eu-west-3.aws"
}
```
```python
from airflow.providers.common.sql.operators.sql import
SQLExecuteQueryOperator
from airflow.sdk import DAG, CronDataIntervalTimetable, timezone
with DAG(
dag_id="test_dag",
schedule=CronDataIntervalTimetable("0 0 1 * *", "Europe/Paris"),
start_date=timezone.parse("2026-07-05T00:00:00", "Europe/Paris"),
catchup=False,
):
SQLExecuteQueryOperator(
task_id="test_query",
conn_id="snowflake_wif_conn",
sql="SELECT CURRENT_USER(), CURRENT_ROLE(), CURRENT_WAREHOUSE();",
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]