code: def apply_sql_script(conn, fname):
      
      sql = open(fname).read()
      try:
          # we cannot use conn.executescript which is non transactional
          for query in sql.split('\n\n'):
              conn.execute(query)
      except Exception:
          logging.error('Error executing %s' % fname)
          raise
docs: Apply the given SQL script to the database
  
      :param conn: a DB API 2 connection
      :param fname: full path to the creation script