Processing a MySQL Dump file with Python
nicogrubert at arcor.de
Mon Oct 4 18:47:27 CEST 2004
>>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.
thank you for you reply.
Calling the MySQL interpreter manually in a shell and pass a dump file
on a unix-type system like:
mysql -h myhost.com -p -u myusername < dumpfile
works fine for me.
What I need to do is calling "mysql -h myhost.com -p -u myusername <
dumpfile" directly from python.
How can I do this in python?
Does the _mysql python interface provide a method that imports a MySQL
dump file? I did not find
anything in the API of _mysql python interface.
More information about the Python-list