0

I am trying to use sqlite3's executemany() to insert multiple values with Python3.

Code:

import sqlite3
conn = sqlite3.connect('rssnewsdata.db')
c = conn.cursor()

entries = [
    ('url1', 1234, 'title1', 'summary1', 'feedurl1'),
    ('url2', 1235, 'title2', 'summary2', 'feedurl2'),
    ('url3', 1236, 'title3', 'summary3', 'feedurl3'),
    ('url4', 1237, 'title4', 'summary4', 'feedurl4')
]

c.executemany('INSERT INTO entries VALUES (?, ?, ?, ?, ?)', entries)

The db file exists, the table exists, I can use Python3 to SELECT from it, so connecting to it is not a problem. The columns are of TEXT, INTEGER, TEXT, TEXT, TEXT type.

Python reports no errors. What is missing?

Amareesh
  • 368
  • 2
  • 5
  • 19
imrek
  • 2,930
  • 3
  • 20
  • 36

1 Answers1

6

you need to

conn.commit()

after the insert.

hiro protagonist
  • 44,693
  • 14
  • 86
  • 111