Answers for "bulk insert example sqlite"

PHP
0

insert bulk values into table in sqlite

# connect to db
database = sqlite3.connect('database.db')
cursor = database.cursor()

# using INSERT INTO in bulk (where each line represents a new entry)
cursor.execute('''INSERT INTO tablename (column1,column2) VALUES
               (data1,data2),
               (data3,data4),
           	   (data5,data6),
               (data7,data8)''')

# disconnect from db :)
database.commit()
cursor.close()
Posted by: Guest on December-30-2020

Browse Popular Code Answers by Language