Hacker News new | past | comments | ask | show | jobs | submit login

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.




SQL templating is one of the explicitly cited motivating use cases.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: