In Python one may interact with an sqlite database using the pysqlite2
class.
from pysqlite2 import dbapi2 as sqlite
One way to send commands to the database is through the database object:
db = sqlite.connect('mydb.sqlite')
db.execute('CREATE TABLE IF NOT EXISTS t1(a, b, c)')
another way is through a cursor:
cur = db.cursor()
cur.execute('CREATE TABLE IF NOT EXISTS t2(x, y, z)')
Both the ways work and do the job, however I suspect that there are cases where one way is peferred over the another. What are those cases?