Refactor database access through managed connections
This commit is contained in:
parent
f19bab6fa2
commit
3f28e46ff6
10 changed files with 1327 additions and 716 deletions
|
|
@ -309,7 +309,7 @@ def main(argv: list[str] | None = None) -> int:
|
|||
def _load_job_source_config(*, db_path: str, job_id: int) -> JobSourceConfig:
|
||||
initialize_database(db_path)
|
||||
primary_key = getattr(Job, "_meta").primary_key
|
||||
with database.connection_context():
|
||||
with database.reader():
|
||||
job = (
|
||||
Job.select(Job, Source)
|
||||
.join(Source)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue