31 ms·
I guess this could be useful in SQL for escaping values, I saw a project on the comments here. With templates: mysql.execute(t"DELETE FROM table WHERE id={i
by _el1s7 2y ago
I guess this could be useful in SQL for escaping values, I saw a project on the comments here.
With templates:
mysql.execute(t"DELETE FROM table WHERE id={id} AND param1={param1}")
Without templates:
mysql.execute("DELETE FROM table WHERE id=%s AND param1=%s", [id, param1])
So one less argument to pass if we use templates.
But yeah it does seem a bit confusing, and maybe kinda not pythonic? Not sure.
- zahlman 2y agoSQL templating is one of the explicitly cited motivating use cases.