api,util: use g.db_session

refs #16017