pull from the database if database is not empty