Processing a MySQL Dump file with Python
jeffrey at fro.man
Mon Oct 4 16:32:52 CEST 2004
Nico Grubert wrote:
> can I somehow call the MySQL interpreter in background to pass the dump
> file to it so the SQL Dump is imported in order
> to write the tables and data into the MySQL database?
Sure, that's what dump files are good for. Simply pipe the contents of the
file into a mysql command. On a Unix-type system (maybe Windows too, I
wouldn't know) you'd run something like:
mysql -h myhost.com -p -u myusername < dumpfile
MySQL does all this by itself, no Python required.
Hope that helps,
More information about the Python-list