Python template engine for sql queries