Connect to a database and build model loading