Use SQL queries to get data instead of restful api