summaryrefslogtreecommitdiff
path: root/Doc/includes/sqlite3/insert_more_langs.py
blob: ceef949608449e9eda88a7723adb0f928c765c47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sqlite3

con = sqlite3.connect("mydb")

cur = con.cursor()

languages = (
    ("Smalltalk", 1972),
    ("Swift", 2014),
)

for lang in languages:
    cur.execute("insert into lang (name, first_appeared) values (?, ?)", lang)

# The changes will not be saved unless the transaction is committed explicitly:
con.commit()

con.close()