Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-fsn committed May 1, 2024
1 parent 7f42acd commit 7371f56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sc_runner/data.py
Original file line number Diff line number Diff line change
@@ -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}"))
Expand Down Expand Up @@ -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()

0 comments on commit 7371f56

Please sign in to comment.