Import modules from Airflow
Question:
Need help importing modules from dags.
I have a dag, next to which in the same folder is my python script.
For some reason airflow does not see this file and it shows import error.
Below you can see that status_dict.by is next to my dag.
I partially solved the problem by creating a commons package and importing my python scripts.
To create a common I use the following code:
from setuptools import setup, find_packages
setup(name='commons', version='0.0.6', author='Alexander Brezhnev', author_email='[email protected]',
packages=find_packages())
Can someone tell me how to use scripts in the dag that are in the same folder with the current dag?
I’m trying to import a python script from a dag, but I’m getting an import error.
Answers:
Did you try to add __init__.py
file in your SQL folder? I remember that I faced a similar error a few years ago with an Airflow docker image and managed to fix it that way.
Need help importing modules from dags.
I have a dag, next to which in the same folder is my python script.
For some reason airflow does not see this file and it shows import error.
Below you can see that status_dict.by is next to my dag.
I partially solved the problem by creating a commons package and importing my python scripts.
To create a common I use the following code:
from setuptools import setup, find_packages
setup(name='commons', version='0.0.6', author='Alexander Brezhnev', author_email='[email protected]',
packages=find_packages())
Can someone tell me how to use scripts in the dag that are in the same folder with the current dag?
I’m trying to import a python script from a dag, but I’m getting an import error.
Did you try to add __init__.py
file in your SQL folder? I remember that I faced a similar error a few years ago with an Airflow docker image and managed to fix it that way.