0

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

Niall Byrne
  • 2,448
  • 1
  • 17
  • 18
Dan
  • 27
  • 1
  • 7
  • Why do you mention `pysqlite`? That has been shipped as `sqlite3` with standard Python downloads since Python 2.5. – John Machin Apr 09 '12 at 05:04
  • The pysqlite to which I refer IS pysqlite2. pysqlite1 (if it was ever called that) is ancient history. What version of Python are you running on what distro/version of what operating system? What do you import? `sqlite3`? `pysqlite2`? something else? – John Machin Apr 09 '12 at 05:52

1 Answers1

2

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

Niall Byrne
  • 2,448
  • 1
  • 17
  • 18
  • 99.9% chance Niall is correct. Data is not saved until you do a `COMMIT`. (More precisely: the new data will be visible to your python program, but won't be made visible to other programs until you do a `COMMIT`.) – Li-aung Yip Apr 09 '12 at 07:01