__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:python-fhrs-osm 作者: gregrs-uk 项目源码 文件源码
def get_district_distant_matches(self, distant_matches_view='distant_matches',
                                     district_id=182):
        """Get OSM entities that are matched to an FHRS establishment where
        the OSM/FHRS locations are distant.

        distant_matches_view (string): name of distant matches database view
        district_id (integer): Boundary Line district ID
        Returns dict
        """

        dict_cur = self.connection.cursor(cursor_factory=DictCursor)

        sql = ('SELECT osm_id, osm_type,\n' +
               'CONCAT(SUBSTRING(osm_type FROM 1 FOR 1), osm_id) AS osm_ident, fhrs_id,\n' +
               'osm_name, fhrs_name, distance\n' +
               'FROM ' + distant_matches_view + '\n' +
               'WHERE district_id = %s' +
               'ORDER BY distance;')
        values = (district_id,)
        dict_cur.execute(sql, values)

        result = []
        for row in dict_cur.fetchall():
            result.append(row)

        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号