4 ms·
I really like this approach because as you said, it gets really messy to do string replacements inline in a python file. I'm curious if any people here are com
by elamje 6y ago
I really like this approach because as you said, it gets really messy to do string replacements inline in a python file.
I'm curious if any people here are comfortable using stored procedures as an alternative to this.
Stored procs give you the benefit of your sql being easy to change in a sql editor, but you also get query planner caching of the results which means it will likely execute faster than string replacement inline sql.
- rrrrrrrrrrrryan 6y agoI think it really depends on the project. Stored procs are really nice for a lot of different use-cases, but one major downside is that they can be challenging to version control. Storing this sort of stuff outside of the database with the Python project itself would make version control trivially easy.
- elamje 6y agoThat's true. I've never attempted to keep procs in VC, but I think it would be pretty easy if you wanted to.
- tuatoru 6y agoWhy are stored procs hard to version control? They're just text in a text file.
- yellowstuff 6y agoAlmost, but not exactly. If you import a Python file you get exactly what's in that file. A stored proc is not tied to a file- you can change the file and forget to update the proc, or change the proc without updating the file.