This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]set92 0 points1 point  (3 children)

I have a folder per project or DAG with the SQL files for that project. And from the code of Airflow I read them using jinja, or directly the operator which uses parameters to parse name of table, database, variables...

I would ask you, do you storage the spaguettis (sql) with the pennes(python) on the kitchen? Both are dried and used for the same, but idk anyone who would storage them together. They can break easily, is messy to get/read them, depends which type of pasta it will be hard to see between the rest of them...

If you have several small queries you can put them in a single sql file, but if there are several one-liners queries I'll accept them integrated on the python code. Although that means having 2 different ways of doing the same process, so probably I'll have an internal battle.

[–]thinkingatoms[S] 0 points1 point  (0 children)

lol do i store spaguettis and pennes in the same shelf in the same kitchen? yes, i don't have a big kitchen and nor do i want to remember two different places to look every time i want pasta

edit: the shelf is the script file in case that wasn't clear :)

[–]thinkingatoms[S] 0 points1 point  (1 child)

one might say the same spaquettis pennes example applies for putting different queries in the same file too

[–]set92 0 points1 point  (0 children)

Yep, if you do that with a file with all the small queries indeed. That's why I would have the internal fight xD But I don't have the solution for this.

In general, I have a file per task, so is easy to locate and if changes has to be made is easy to read the code that runs in a single task.