We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
0 parents commit d50e77eCopy full SHA for d50e77e
1 file changed
sqlite_python.py
@@ -0,0 +1,17 @@
1
+import sqlite3
2
+
3
4
+def db_connect(database_name: str) -> sqlite3.Connection:
5
+ db = sqlite3.connect(
6
+ database_name,
7
+ detect_types=sqlite3.PARSE_DECLTYPES,
8
+ uri=database_name.startswith("file:"),
9
+ )
10
+ db.row_factory = sqlite3.Row
11
12
+ db.execute("PRAGMA foreign_keys = ON;")
13
14
+ return db
15
16
17
+conn = db_connect("books.db")
0 commit comments