python - Overwrite a database -
i have online database , connect using mysqldb.
db = mysqldb.connect(......) cur = db.cursor() cur.execute("select * your_table_name") data = cur.fetchall()
now, want write whole database localhost (overwrite). there way this? thanks
if i'm reading correctly, have 2 database servers, , b (where remote server , b running on local machine) , want copy database server server b?
in honesty, if one-off, consider using mysqldump command-line tool, either directly or calling python.
if not, last answer on http://bytes.com/topic/python/answers/24635-dump-table-data-mysqldb details sql needed define procedure output tables , data, though may miss subtleties mysqldump not
Comments
Post a Comment