When I came back to Python from a couple of years of doing Typescript, I was sad to lose tagged templates because I wouldn’t have an equivalent to my favorite Postgres library, Slonik. I loved that its use of templates and strong typing allowed me to write SQL fragments in a Postgres prompt as strings that could be combined like regular strings while ensuring that parameters were always sanitized even when multiple fragments were combined as subqueries or CTEs.
I was pointed to a library where I would write similar SQL in separate files, but that was the closest I could find. (I don’t remember its name now.)
Looks like this would make it possible to build something similar.
When I came back to Python from a couple of years of doing Typescript, I was sad to lose tagged templates because I wouldn’t have an equivalent to my favorite Postgres library, Slonik. I loved that its use of templates and strong typing allowed me to write SQL fragments in a Postgres prompt as strings that could be combined like regular strings while ensuring that parameters were always sanitized even when multiple fragments were combined as subqueries or CTEs.
I was pointed to a library where I would write similar SQL in separate files, but that was the closest I could find. (I don’t remember its name now.)
Looks like this would make it possible to build something similar.
score 3 · canonical