Pass limit argument to Database.query()

This commit is contained in:
XANTRONIX 2025-03-31 14:35:37 -04:00
parent 7da2dd34f2
commit 330117dea5

View file

@ -64,13 +64,13 @@ class City(DatabaseTable):
yield City.from_tsv_row(row)
@staticmethod
def each_within_poly(db: Database, poly: shapely.Polygon):
def each_within_poly(db: Database, poly: shapely.Polygon, limit=None):
st = db.query(City, [
'ST_Within(location, GeomFromText(:poly, 4326)) = 1'
], {
'poly': shapely.to_wkt(poly)
}, [
('population', DatabaseOrder.DESC)
])
], limit)
yield from st.each()