diff --git a/src/sc_runner/data.py b/src/sc_runner/data.py index 6341101..e33a9a1 100644 --- a/src/sc_runner/data.py +++ b/src/sc_runner/data.py @@ -1,6 +1,6 @@ -import sc_data from sc_crawler.tables import Server, ServerPrice, Datacenter, Vendor, Zone from sqlmodel import create_engine, Session, select +import sc_data session = Session(create_engine(f"sqlite:///{sc_data.db.path}")) @@ -33,7 +33,7 @@ def servers(vendor: str, region: str | None = None, zone: str | None = None): def servers_vendors(vendor: str, region: str | None = None, zone: str | None = None): stmt = select(ServerPrice.vendor_id, ServerPrice.datacenter_id, Zone.name, ServerPrice.server_id).join(Zone).where(ServerPrice.vendor_id == vendor) if region: - stmt = stmt.where(ServerPrice.datacenter_id==region) + stmt = stmt.where(ServerPrice.datacenter_id == region) if zone: - stmt = stmt.where(ServerPrice.zone_id==zone) + stmt = stmt.where(ServerPrice.zone_id == zone) return session.exec(stmt.distinct()).all()