functions run_query, get_id