def loc_join_1(db, t1, t2, r1, r2):
    # given radius r1, r2, find overlapping lat lons
    t1cols = get_numeric_columns(db, t1, ignore=['id'])
    t2cols = get_numeric_columns(db, t2, ignore=['id'])
    sels1 = map(lambda s: '%s.%s' % (t1, s), t1cols)
    sels2 = map(lambda s: '%s.%s' % (t2, s), t2cols)
    sels = sels1 + sels2
    if not sels:
        return []
    cols = [(t1, c) for c in t1cols] + [(t2, c) for c in t2cols]
    q = """select %s from %s, %s where
     circle(%s._latlon, %%s) &&
     circle(%s._latlon, %%s) and
     %s._latlon is not null and
     %s._latlon is not null
    """ % (','.join(sels), t1, t2, t1, t2, t1, t2)

    res = db.execute(q, (r1, r2)).fetchall()
    return [dict(zip(cols, row)) for row in res]
dataset/ETHPy150Open sirrice/dbtruck/dbtruck/analyze/fuzzyjoin.py/loc_join_1/original