title: SQLAlchemy: What's the difference between flush() and commit()?
body: <p>What the difference is between <code>flush()</code> and <code>commit()</code> in SQLAlchemy?</p>
  
  <p>I've read the docs, but am none the wiser - they seem to assume a pre-understanding that I don't have.</p>
  
  <p>I'm particularly interested in their impact on memory usage. I'm loading some data into a database from a series of files (around 5 million rows in total) and my session is occasionally falling over - it's a large database and a machine with not much memory. </p>
  
  <p>I'm wondering if I'm using too many <code>commit()</code> and not enough <code>flush()</code> calls - but without really understanding what the difference is, it's hard to tell!</p>