How to import packages in the DAG folder when using git-sync sidecar? #818
Answered
by
ketozhang
ketozhang
asked this question in
Questions & Answers
-
When using git-sync sidecar for DAG the repository is dumped into Let's say you have this repository and you want to do # In /opt/airflow/dags/
repo/
dags/
__init__.py
mydag.py
foo/
__init__.py
bar.py This will error due to a few things missing...
The last point is quite undesirable. When I'm in my repository it works as |
Beta Was this translation helpful? Give feedback.
Answered by
ketozhang
Feb 21, 2024
Replies: 1 comment
-
You're going to have to add airflow:
extraEnv:
- name: "PYTHONPATH"
value: "/opt/airflow/dags/repo/" |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ketozhang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're going to have to add
/opt/airflow/dags/repo/
to Python'ssys.path
. You can use the env varPYTHONPATH
.