Airflow Dynamic DAGs: The powerful way with Jinja and YAML

Airflow Dynamic DAGs: The powerful way with Jinja and YAML
👍 Smash the like button to become an Airflow Super Hero!
❤️ Subscribe to my channel to become a master of Airflow
🏆 BECOME A PRO: www.udemy.com/course/the-comp...
🚨 My Patreon: / marclamberti
Airflow dynamic DAGs can save you a ton of time. As you know, Apache Airflow is written in Python, and DAGs are created via Python scripts. That makes it very flexible and powerful (even complex sometimes). By leveraging Python, you can create DAGs dynamically based on variables, connections, a typical pattern, etc. This very nice way of generating DAGs comes at the price of higher complexity and subtle tricky things that you must know.
Ready?
Lets go!

Пікірлер: 26

  • @MarcLamberti
    @MarcLamberti Жыл бұрын

    Hey folk 👋 Here is the updated video with the sound fixed: Dynamic DAGs in Apache Airflow for beginners kzread.info/dash/bejne/aJl817GdaZnbnrQ.html Enjoy ❤

  • @litan1106
    @litan11062 жыл бұрын

    thank you for the great tutorial again. I love the airflow series.

  • @egehanyorulmaz4965
    @egehanyorulmaz49652 жыл бұрын

    I believe, this method is much more reliable if you are going to generate multiple dags with different schedule intervals. I was using dynamic dag generation with globals()[dag_id]=dag, but if you are working with APIs or clients, scheduler & worker don't work as expected. Also in the documentation, isolated DAG files are suggested, therefore Airflow community must be using your methods as well. Generator.py can be scheduled to generate the files using cron job, and it will be good to go :) Thank you for the content you have shared and informed Airflow users. It was extremely helpful for me :)

  • @timerelaxingsound
    @timerelaxingsound2 жыл бұрын

    awesome! that's what i was looking for)

  • @ricardorodriguez4180
    @ricardorodriguez41802 жыл бұрын

    Awesome content, thank you.

  • @rajhindocha9728
    @rajhindocha9728 Жыл бұрын

    Hi Marc, thank you very much for sharing great information! one quick question though, this could have also done by using normal replace method as well where it will replace the values it receives from yaml in dag template and generate new dag for each yaml config files. Any specific advantage of using jinja2 templates instead?

  • @rajdeepsinghborana2409
    @rajdeepsinghborana24092 жыл бұрын

    Informative ❤️

  • @tehmoonrulz
    @tehmoonrulz Жыл бұрын

    Hi Marc, can you please elaborate on the risks of using config with a loop and globals? I would agree that having one file per DAG is more ideal but you also linearly increase your codebase for each config so that con needs to outweigh the risks/downsides of the loop/global approach

  • @claudee8736
    @claudee8736 Жыл бұрын

    Hi! Thanks for your video. Very helpful. Just a comment, you're recording your voice through just one channel, and music in the other, which makes it a bit quieter than normal.

  • @user-lw4io9cg4p
    @user-lw4io9cg4p8 ай бұрын

    This is informative but I think the piece that I always struggle with is whats the best way to keep the load on the scheduler down if I need to pull data to build the dag based on whats in a database.

  • @skviknesh
    @skviknesh6 ай бұрын

    Lovely!

  • @shiroyashazoro
    @shiroyashazoro2 жыл бұрын

    Hey. Can I access the airflow instance which is deployed on astronomer using kubernetes?? I mainly want meta data to access

  • @97Arshan
    @97Arshan2 жыл бұрын

    Hi Marc, first of all, thanks a lot for teaching us airflow! I also got your course on Udemy but I had a question, there you ask us to use virtual box but I didn't and I used your KZread video to setup airflow using docker in 5 minutes. That shouldn't be a problem for the rest of the course, right? Edit: fixed tracing to teaching

  • @MarcLamberti

    @MarcLamberti

    2 жыл бұрын

    Not at all and I'm actually thinking of removing this VM

  • @97Arshan

    @97Arshan

    2 жыл бұрын

    @@MarcLamberti that's great, thank you very much!

  • @Fizzility
    @Fizzility2 жыл бұрын

    Hi Mark, I am new to airflow and I was hoping you’d be able to help provide me guidance on this: I want to create a job that retrieves 1.api key based on params (ie params=api id) 2. make api call 3. load data However I need to do this for many different Apikey (ie do this for 100+ different api keys, but function is the same across all, only difference for each job is params of step1) how would you approach this? Would you dynamically create individual dags based on params for each api key? Would you have a parent dag to generate subdags for each apikey? Or any other ideas? Thanks a lot in advance!

  • @mukundreddy9374

    @mukundreddy9374

    Жыл бұрын

    Hi did you find a way to do it?

  • @RajeshSamson
    @RajeshSamson2 жыл бұрын

    Do you have any git repo this example?

  • @5hubham
    @5hubham2 жыл бұрын

    Can we use JSON also instead of YAML?

  • @MarcLamberti

    @MarcLamberti

    2 жыл бұрын

    of course :)

  • @gowthamch
    @gowthamch2 жыл бұрын

    Hmm.. why can I only hear music but not the voice from my right earbud. great video nonetheless thank you !!

  • @MarcLamberti

    @MarcLamberti

    2 жыл бұрын

    My mic :'( Sorry about that

  • @twndomn
    @twndomn Жыл бұрын

    may you re-record this?

  • @MarcLamberti

    @MarcLamberti

    Жыл бұрын

    Why? 👀

  • @nataliaresende1121
    @nataliaresende11212 жыл бұрын

    I never managed to install airflow to start learning…the local host 8080 never opens to me

  • @prasadb7213
    @prasadb7213 Жыл бұрын

    Audio is not good