MySQL and restore

Frank Aune Frank.Aune at broadpark.no
Wed Feb 27 10:23:41 EST 2008


Hi,

Inspired from http://blog.spikesource.com/mysql_hotbackup.htm:
I restore a database from an SQL dump like this:

(...)
f= open('test.sql', 'r')
sql = f.read()
f.close()
self.query("""%s""" % sql)
(...)

This works fine for dumps made with "mysqldump -uroot -B test > test.sql". 
However, if performing a commit afterwards in the above code, I get 
a "command out of sync; you can't run this command now" I even get this when 
trying out the SET FOREIGN_KEY_CHECK properties as suggested in the URL.

How do I properly "clearn up" after processing the raw SQL file in the query 
above? 

Thanks,
Frank



More information about the Python-list mailing list