Category: sqlite3

Problem

Use parameterized SQL queries.

Solution

  cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
  

Notes

  • Adapt variable names and paths to your project
  • Add error handling for production use
  • See related chapters in the Learning Path