DB connection
A database connection is the live link from Python to the database. Flow: connect → cursor → execute SQL → fetch or commit → close. Use ? placeholders (or the driver’s params). Never build SQL with + user text — that is injection. Commit after writes if autocommit is off. Close so connections don’t leak. Don’t put passwords in source.
Same pattern on sqlite3, MySQL driver, others. Viva steps in order. Mention placeholders in the same breath as execute.
DB connection — output — 1. ? placeholders — real parameterized query, not string + id.
Never string-format user text into SQL.