Skip to content

Commit 9989417

Browse files
committed
Attach dbs immutably
1 parent 2b96110 commit 9989417

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

wikdict_web/base.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ def db_query(
124124
conn = get_conn(db_name, path, attach_dbs, write)
125125
cur = conn.cursor()
126126
for name, db in (attach_dbs or {}).items():
127-
cur.execute("ATTACH DATABASE '{}' AS {}".format(path_for_db(db, path), name))
127+
cur.execute(
128+
"ATTACH DATABASE 'file:{}?immutable=1' AS {}".format(
129+
path_for_db(db, path), name
130+
)
131+
)
128132
if explain:
129133
condensed_stmt = " ".join(stmt.split())
130134
print("\nPlan for {}".format(repr(condensed_stmt[:160])))

0 commit comments

Comments
 (0)