corrlib/corrlib/sql.py
Justus Kuhlmann d6de8e6387
All checks were successful
Mypy / mypy (push) Successful in 1m11s
Pytest / pytest (3.12) (push) Successful in 1m19s
Pytest / pytest (3.13) (push) Successful in 1m14s
Pytest / pytest (3.14) (push) Successful in 1m16s
Ruff / ruff (push) Successful in 1m3s
Mypy / mypy (pull_request) Successful in 1m13s
Pytest / pytest (3.12) (pull_request) Successful in 1m18s
Pytest / pytest (3.13) (pull_request) Successful in 1m12s
Pytest / pytest (3.14) (pull_request) Successful in 1m15s
Ruff / ruff (pull_request) Successful in 1m0s
Introduce thin wrapper for SQL calls
2026-04-21 10:22:46 +02:00

17 lines
365 B
Python

import sqlite3
from .tools import get_db_file
from pathlib import Path
from typing import Any
def thin_sql_wrapper(path: Path, stmt: str) -> list[Any]:
db_file = get_db_file(path)
db = path / db_file
conn = sqlite3.connect(db)
c = conn.cursor()
c.execute(stmt)
results = c.fetchall()
conn.commit()
conn.close()
return results