human
I am working on the file "P4B - Capitolo 2 - Persistenza, Unicode, OOP e DB.ipynb".
The first task is:
DB-API
Can you write Python code for it?
assistant
#Here is the Python code you requested.

# [PEP 249](https://www.python.org/dev/peps/pep-0249/)
# v. gestionale/managers02/db.py

class SqliteDBManager(object):
    
    def _do_export(self, rows):

        cu = self.conn.cursor()

        # KO: Never do this -- insecure!
        # KO: for row in rows:
        # KO:     c.execute("INSERT INTO people VALUES ('{name}','{city}','{salary}')".format(**row))

        # Do this instead
        for row in rows:
            t = (row["name"], row["city"], row["salary"])
            cu.execute('INSERT INTO people VALUES (?,?,?)', t)
        self.conn.commit()