SQLite – Run multi-line SQL script from file?

I realize that this is not a direct answer to your question. As Brian mentions, this could be a silly platform issue.

If you interface with SQLite through Python, you will probably avoid most platform-specific issues and you get to have fun things like datetime columns 🙂

Something like this should work fine:

import sqlite3

qry = open('create_table_user.sql', 'r').read()
conn = sqlite3.connect('/path/to/db')
c = conn.cursor()
c.execute(qry)
conn.commit()
c.close()
conn.close()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)