'Snowflake connection to airflow
I have created a a dag which call to the snowflake wharehouse and call query on it. CODE FOR THE DAG:-
import logging
from datetime import datetime, timedelta
import airflow
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.contrib.hooks.snowflake_hook import SnowflakeHook
from airflow.contrib.operators.snowflake_operator import SnowflakeOperator
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
args = {"owner": "Airflow", "start_date": datetime(2021,3,22,17,15)}
dag = DAG(
dag_id="snowflake_testing", default_args=args, schedule_interval=None
)
query1 = [
"""SHOW DATABASES ;""",
]
with dag:
query1_exec = SnowflakeOperator(`enter code here`
task_id="snowfalke_task1",
sql=query1,
snowflake_conn_id="Snowflake_Test",
)
And i have created the snowflake connection
but there no response from the snowflake there are session recorded in the snowflake account page.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|