title: how to load pre-existing data flask-sqlalchemy
body: <p>I am writing a <code>REST API</code> using <code>flask_restful</code> and managing the <code>mysql</code> db using <code>flask-sqlalchemy</code>. I would like to know what the best practice for loading existing data into a table when the app starts is. </p>
  
  <p>I am currently calling the <code>db.create_all()</code> method withing an endpoint with the <code>@app.before_first_request</code> decorator. I would like to then fill in one of the tables created with existing data from a <code>csv</code> file. Should the code to push the data in a separate script or within the function? </p>
  
  <p>Thanks!</p>