I am following this sqlite3 for python tutorial.
I am trying to insert a row into a table with this script:
conn = sqlite3.connect(database)
sql = ''' INSERT INTO projects(name,begin_date,end_date)
              VALUES(?,?,?) '''    
project = ('X', '2015-01-01', '2015-01-30');
cur = conn.cursor()
cur.execute(sql,project)
conn.close()
I can run it with no errors but the row is not inserted.
Although, the row is inserted when using with:
with conn:
    sql = ''' INSERT INTO projects(name,begin_date,end_date)
                  VALUES(?,?,?) '''    
    project = ('X', '2015-01-01', '2015-01-30');
    cur = conn.cursor()
    cur.execute(sql,project)
Does anyone know whats happening?
UPDATE
I found in docs.python.org
that after one or more execute statements one does commit as in
cur.execute(sql, project)
conn.commit()
and everything goes fine.
But still, I would much appreciate some technical explanation of with keyword
 
    