Writing SQL

SQL From Python

Passing variables and lists into SQL queries from Python, with the string handling around them.

How do I put variables into a string?

Use an f-string to put a variable into text in Python. Learn why string building is unsafe for SQL and how placeholders keep values out of the query.

2 min read

What does vars() do in Python?

vars() returns an object's attribute dictionary, or the local names with no argument. See how its output can supply named values to an SQL query.

2 min read

Related topics

More in writing sql