started actual fastapi server with DB

This commit is contained in:
Jack Case
2025-10-19 15:33:34 +00:00
parent 4931a785a1
commit e90bc1cc72
3 changed files with 69 additions and 0 deletions

12
slopserver/db.py Normal file
View File

@@ -0,0 +1,12 @@
from collections.abc import Iterable
from urllib.parse import ParseResult
from sqlalchemy import select
from sqlalchemy.engine import Engine
from sqlalchemy.orm import Session
from slopserver.models import Domain, Path, User
def select_slop(urls: list[ParseResult], engine: Engine) -> Iterable[Domain]:
query = select(Domain).where(Domain.domain_name.in_(url[1] for url in urls))
with Session(engine) as session:
rows = session.scalars(query).all()
return rows