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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -