[storm] execute batch sql

Jean Daniel jeandaniel.browne at gmail.com
Wed Oct 15 16:00:26 BST 2008


Hello,

i would like to keep and maintain my schema generation in a sql file,
I would like to execute it from my initialization/installation
function in my python code. But store.execute() only accept a single
SQL statements and I could find another method to do it. I do :

"""
store = Store( create_database('sqlite:%s' % dbfile) )
store.execute( file(schemafile).read() )
"""

While my schemafile is :
"""
CREATE TABLE names ( name VARCHAR, id INTEGER PRIMARY KEY );
CREATE TABLE rights ( right varchar, id INTEGER PRIMARY KEY );
"""

I could open a subprocess which calls the SQL client, the sqlite
command in this case, or psql for postgresql with my file as a
parameter?
I could split my file into statement embedded in the python code?

I am satisfied with neither of these solution? do you see a better way?

Thank you



More information about the storm mailing list