I'm been trying to export all the tables in my database into a single csv file.
I've tried
import MySQLdb as dbapi
import sys
import csv
import time
dbname = 'site-local'
user = 'root'
host = '127.0.0.1'
password = ''
date = time.strftime("%d-%m-%Y")
file_name = date+'-portal'
query='SELECT * FROM site-local;' //<---- I'm stuck here
db=dbapi.connect(host=host,user=user,passwd=password)
cur=db.cursor()
cur.execute(query)
result=cur.fetchall()
c = csv.writer(open(file_name+'.csv','wb'))
c.writerow(result)
I'm a little stuck now, I hope someone can sheds some light base on what I have.