1
我想在python中創建一個dbf到mysql連接器。到目前爲止,我已經把它連接到mysql服務器並讀取dbf文件,但是當我運行該程序時,它顯示沒有數據在sql中複製。python dbf到mysql
繼承人我的代碼到目前爲止。
from dbfpy import dbf
import MySQLdb
source = dbf.Dbf("foxpro.Dbf")
db = MySQLdb.connect(host = "localhost", user = "root", passwd = "", db = "mydb")
cur = db.cursor()
for r in source:
query = """INSERT mytb SET column1 = %s, column2 = %s, column3 = %s"""
values = (r["column1"], r["column2"], r["column3"])
print r["column1"], r["column2"], r["column3"]