Apache Airflow giving broken DAG and can’t seem to retrieve information from my dbt-dag.py
Error Code:
Broken DAG: [/usr/local/airflow/dags/dbt-dag.py]
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/cosmos/operators/base.py", line 361, in __init__
self.full_refresh = full_refresh
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/airflow/models/baseoperator.py", line 1198, in __setattr__
if key in self.__init_kwargs:
^^^^^^^^^^^^^^^^^^
AttributeError: 'DbtRunLocalOperator' object has no attribute '_BaseOperator__init_kwargs'. Did you mean: '_BaseOperator__instantiated'?
Code for dbt-dag.py
import os
from datetime import datetime
from cosmos import DbtDag, ProfileConfig, ProjectConfig, ExecutionConfig
from cosmos.profiles import SnowflakeUserPasswordProfileMapping
profile_config = ProfileConfig(
profile_name='default',
target_name='dev',
profile_mapping=SnowflakeUserPasswordProfileMapping(
conn_id='snowflake_conn',
profile_args={'database':'dbt_db','schema':'dbt_schema'},
)
)
dbt_snowflake_dag = DbtDag(
project_config=ProjectConfig('/usr/local/airflow/dags/dbt/data_pipeline',),
operator_args={'install_deps':True},
profile_config=profile_config,
execution_config=ExecutionConfig(dbt_executable_path=f"{os.environ['AIRFLOW_HOME']}/dbt_venv/bin/dbt",),
schedule_interval="@daily",
start_date=datetime(2023, 9, 10),
catchup=False,
dag_id="dbt_dag",
I have followed some youtube tutorial and tried to follow along but can’t seem to make it work and it seem like it is working for others.