diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-05-19 07:43:44 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-19 07:43:44 (GMT) |
| commit | db20afe6c43ad585577589131bf658ce7ebe6bd2 (patch) | |
| tree | 0e29f0bf5d7c2cb4466b883972050a21303ea596 /Doc/includes/sqlite3/insert_more_langs.py | |
| parent | 76ed53ca7bf0d4a43099d9401af5fe9f75689885 (diff) | |
| download | cpython-db20afe6c43ad585577589131bf658ce7ebe6bd2.zip cpython-db20afe6c43ad585577589131bf658ce7ebe6bd2.tar.gz cpython-db20afe6c43ad585577589131bf658ce7ebe6bd2.tar.bz2 | |
bpo-44106: Improve sqlite3 example database contents (GH-26027)
(cherry picked from commit 92d1064727d6b7f4136f9c09ab52ae15e3676afe)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
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 0000000..ceef949 --- /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() |
