- inner = sa.select(t,
- t.c.linegeo.ST_Distance(WKT_PARAM).label('distance'),
- _locate_interpolation(t))\
- .where(t.c.linegeo.ST_DWithin(WKT_PARAM, 0.001))\
- .where(t.c.parent_place_id == parent_place_id)\
- .order_by('distance')\
- .limit(1)\
- .subquery('tiger')
-
- sql = sa.select(inner.c.place_id,
- inner.c.parent_place_id,
- sa.literal(parent_type).label('osm_type'),
- sa.literal(parent_id).label('osm_id'),
- _interpolated_housenumber(inner),
- _interpolated_position(inner),
- inner.c.postcode,
- inner.c.distance)
+ def _base_query() -> SaSelect:
+ inner = sa.select(t,
+ t.c.linegeo.ST_Distance(WKT_PARAM).label('distance'),
+ _locate_interpolation(t))\
+ .where(t.c.linegeo.within_distance(WKT_PARAM, 0.001))\
+ .where(t.c.parent_place_id == parent_place_id)\
+ .order_by('distance')\
+ .limit(1)\
+ .subquery('tiger')