Re:Show HN: SQL-tString a t-string SQL builder in Python
by pgjones on Friday May 16, 2025 @10:37AM
(#44006039)
The presence of Absent removes the entire expression, and if that removal results in an empty clause (or group) it will remove that as well. For example if `a = Absent` `WHERE a = {a}` will remove everything, whereas `WHERE a = {a} AND b = {b}` will result in `WHERE b = {b}`.
> Do you support templating a sql tstring into an sql tstring for composition?
Yep
Do you support templating a sql tstring into an sql tstring for composition?
I use that feature a lot with the roughly equivalent TypeScript sql`…` template literals for the NOT NULL thing and handling absence but it’s all ternaries in “user space”.