|
|
|
|
|
by somat
215 days ago
|
|
Here is my rather naive take on the same subject. But I had a very different motivation than the author. See I actually quite like SQL and enjoy programming in it, but what I don't like is mixing sql and python. So one night in a flash of inspiration or perhaps a fever dream I wrote this thing that lets you have stand alone parameterized sql queries and you call them like a python function or generator. It is one of those overly clever things where I sort of hate the magic, but I find myself using it more and more which I will probably regret one day. https://nl1.outband.net/fossil/query/file?name=query.py&ci=t... In short you have your query in file sql/dept_personal.sql and you call it like for row in q.dept_personal(db_cursor, department='manpower'):
|
|