I am having issue connecting the airflow to snowflake. I think that the airflow admin GUI has changed a bit. But the main issue, is I am not sure how what is what when it comes account
in the connection info.
Should I include the org name? I mean based on the image how should i combine ALB33048
, KKTQCVP
and CLBB7689
?
2. Should I separate it with ‘.’ or ‘-‘?
airflow connection GUI
my snowflake account info
from airflow import DAG
from airflow.providers.snowflake.operators.snowflake import SnowflakeOperator
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
from datetime import datetime
# Define your default arguments
default_args = {
'owner': 'airflow',
'start_date': datetime(2024, 1, 1),
'retries': 1,
}
dag = DAG(
'example_snowflake_dag',
default_args=default_args,
schedule='* * * * *', # Every Monday at 12 PM
)
# Define the Snowflake SQL command
snowflake_sql = """
select top 10* from Information_schema.tables
"""
snowflake_task = SQLExecuteQueryOperator(
task_id='query_snowflake',
sql=snowflake_sql,
conn_id='snowflake_conn_id',
hook_params={
"account": "KKTQCVP.CLB87689",
"warehouse": "COMPUTE_WH",
"database": "<MY_DATABASE>",
"region": "us-west",
"login": "<MY_USERNAME>",
"password": "<MY_PASSWORD>",
"role": "ACCOUNTADMIN",
'schema': '<MY_SCHEMA>',
},
dag=dag,
)
I tried the posted methods but they are not working.
Sorush Omidvar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.