connects to DB.  Only calls REST API if QUERY is not in DB.