title: Python and sqlite3 - importing and exporting databases
body: <p>I'm trying to write a script to import a database file.  I wrote the script to export the file like so:</p>
  
  <pre><code>import sqlite3
  
  con = sqlite3.connect('../sqlite.db')
  with open('../dump.sql', 'w') as f:
      for line in con.iterdump():
          f.write('%s\n' % line)
  </code></pre>
  
  <p>Now I want to be able to import that database. I have tried :</p>
  
  <pre><code>import sqlite3
  
  con = sqlite3.connect('../sqlite.db')
  f = open('../dump.sql','r')
  str = f.read()
  con.execute(str)
  </code></pre>
  
  <p>but I'm not allowed to execute more than one statement.  Is there a way to get it to run an SQL script directly?</p>