- sql: SaLambdaSelect = sa.lambda_stmt(lambda: _select_from_placex(t)
- .where(t.c.geometry.ST_DWithin(WKT_PARAM, 0.001))
- .where(t.c.parent_place_id == parent_place_id)
- .where(_is_address_point(t))
- .where(t.c.indexed_status == 0)
- .where(t.c.linked_place_id == None)
- .order_by('distance')
- .limit(1))
-
+ def _base_query() -> SaSelect:
+ return _select_from_placex(t)\
+ .where(t.c.geometry.within_distance(WKT_PARAM, 0.001))\
+ .where(t.c.parent_place_id == parent_place_id)\
+ .where(sa.func.IsAddressPoint(t))\
+ .where(t.c.indexed_status == 0)\
+ .where(t.c.linked_place_id == None)\
+ .order_by('distance')\
+ .limit(1)
+
+ sql: SaLambdaSelect