File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 2020# misrepresented as being the original software.
2121# 3. This notice may not be removed or altered from any source distribution.
2222
23+ """
24+ The sqlite3 extension module provides a DB-API 2.0 (PEP 249) compilant
25+ interface to the SQLite library, and requires SQLite 3.7.15 or newer.
26+
27+ To use the module, you must first create a database Connection object:
28+
29+ import sqlite3
30+ cx = sqlite3.connect("test.db") # test.db will be created or opened
31+
32+ You can also use the special database name ":memory:" to connect to a transient
33+ in-memory database:
34+
35+ cx = sqlite3.connect(":memory:") # connect to a database in RAM
36+
37+ Once you have a Connection object, you can create a Cursor object and call its
38+ execute() method to perform SQL queries:
39+
40+ cu = cx.cursor()
41+
42+ # create a table
43+ cu.execute("create table lang(name, first_appeared)")
44+
45+ # insert values into a table
46+ cu.execute("insert into lang values (?, ?)", ("C", 1972))
47+
48+ # execute a query and iterate over the result
49+ for row in cu.execute("select * from lang"):
50+ print(row)
51+
52+ cx.close()
53+
54+ The sqlite3 module is written by Gerhard Häring <gh@ghaering.de>.
55+ """
56+
2357from sqlite3 .dbapi2 import *
2458
2559
You can’t perform that action at this time.
0 commit comments