diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-05-19 09:41:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-19 10:41:19 +0300 |
commit | 92d1064727d6b7f4136f9c09ab52ae15e3676afe (patch) | |
tree | ae8bf88ce5406adf0d8fc2f0f64f8b20de077142 /Doc/includes/sqlite3/insert_more_langs.py | |
parent | 901443757333a66ff2b5c85eba30dc1c48eac321 (diff) | |
download | cpython-git-92d1064727d6b7f4136f9c09ab52ae15e3676afe.tar.gz |
bpo-44106: Improve sqlite3 example database contents (GH-26027)
Diffstat (limited to 'Doc/includes/sqlite3/insert_more_langs.py')
-rw-r--r-- | Doc/includes/sqlite3/insert_more_langs.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/includes/sqlite3/insert_more_langs.py b/Doc/includes/sqlite3/insert_more_langs.py new file mode 100644 index 0000000000..ceef949608 --- /dev/null +++ b/Doc/includes/sqlite3/insert_more_langs.py @@ -0,0 +1,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() |