Pass limit argument to Database.query()
This commit is contained in:
parent
7da2dd34f2
commit
330117dea5
1 changed files with 2 additions and 2 deletions
|
@ -64,13 +64,13 @@ class City(DatabaseTable):
|
||||||
yield City.from_tsv_row(row)
|
yield City.from_tsv_row(row)
|
||||||
|
|
||||||
@staticmethod
|
@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 = db.query(City, [
|
||||||
'ST_Within(location, GeomFromText(:poly, 4326)) = 1'
|
'ST_Within(location, GeomFromText(:poly, 4326)) = 1'
|
||||||
], {
|
], {
|
||||||
'poly': shapely.to_wkt(poly)
|
'poly': shapely.to_wkt(poly)
|
||||||
}, [
|
}, [
|
||||||
('population', DatabaseOrder.DESC)
|
('population', DatabaseOrder.DESC)
|
||||||
])
|
], limit)
|
||||||
|
|
||||||
yield from st.each()
|
yield from st.each()
|
||||||
|
|
Loading…
Add table
Reference in a new issue