Created db module and get_latest_data function

all arguments should be passed to the query, add `%s` to the queries