update the db_query sql.
Update table instances and database queries.