convert Dbase (.dbf) files to SQLite databases

Ethan Furman ethan at
Wed Jul 15 12:25:08 EDT 2009

Helmut Jarausch wrote:
> Hi,
> I have a lot of old Dbase files (.dbf) and I'll like to convert these
> to SQLite databases as automatically as possible.
> Does anybody know a tool/Python script to do so?
> I know, I could use dbfpy and create the SQLite table and import all
> data. But is there something easier?
> Many thanks for a hint,
> Helmut.


If your tables are either dBase III or Visual Foxpro 6 (may work with 
other VFP versions...) you can try

#open table
import dbf
table = dbf.Table('/path/to/old/dbf')

#generate .csv file
table.export()	# defaults to same name with csv extension

#access records
for rec in table:
     tups = tuple(rec)
     lst = list(rec)
     dct = rec.scatter_fields()

I haven't used SQlite, so I'm unable to provide samples for that portion 
of the conversion.

Hope this helps.


More information about the Python-list mailing list