Alternatively, the program can decide that something's wrong and roll back the transaction without making the changes. For databases that support transactions, the Python interface silently starts a transaction when the cursor is created. Each method then starts a new transaction. Some databases don't have transactions, but simply apply all changes as they're executed. Listing 2 is a Python function that tries to get all this right by committing the transaction once both operations have been performed.
Database programming can be potentially quite complex.
D.C. One of his past projects was a sizable commercial site that was implemented using Python on top of an Illustra database.