def _is_geocode_in_db(address): db = db_connect() table = db['geocoding'] row = table.find_one(address=address) if row: return True else: return False
def _save_geocoding(address, lat, long): db = db_connect() table = db['geocoding'] row = table.find_one(address=address) if not row: table.insert({'address': address, 'lat': lat, 'long': long})
def _get_geocoding(address): db = db_connect() table = db['geocoding'] row = table.find_one(address=address) if row: return row['lat'], row['long']