Search code examples
pythonsqlitepysqlite

pysqlite and python : wont insert data into table but code executes fine


I am trying to insert some data into a pysqlite database but even tho the code runs fine with no errors nothing shows up in the database and i have made sure that the variable does contain a value

    cur = self.con.execute("insert into urllist(url) values('%s')" % seed)

i have double checked the table and column name and they are also correct


Solution

  • Are you calling con.commit() ?

    Apparently changes are lost unless this method is used before closing the connection.

    http://readthedocs.org/docs/pysqlite/en/latest/sqlite3.html