MCPcopy Index your code
hub / github.com/python/mypy / connect_db

Function connect_db

mypy/metastore.py:165–176  ·  view source on GitHub ↗
(db_file: str, set_journal_mode: bool)

Source from the content-addressed store, hash-verified

163
164
165def connect_db(db_file: str, set_journal_mode: bool) -> sqlite3.Connection:
166 import sqlite3.dbapi2
167
168 db = sqlite3.dbapi2.connect(db_file, check_same_thread=False)
169 # This is a bit unfortunate (as we may get corrupt cache after e.g. Ctrl + C),
170 # but without this flag, commits are *very* slow, especially when using HDDs,
171 # see https://www.sqlite.org/faq.html#q19 for details.
172 db.execute("PRAGMA synchronous=OFF")
173 if set_journal_mode:
174 db.execute("PRAGMA journal_mode=WAL")
175 db.executescript(SCHEMA)
176 return db
177
178
179class SqliteMetadataStore(MetadataStore):

Callers 1

__init__Method · 0.85

Calls 1

connectMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…