convert Dbase (.dbf) files to SQLite databases

John Machin sjmachin at
Wed Jul 15 18:30:29 CEST 2009

On Jul 15, 8:39 pm, David Lyon <david.l... at> wrote:
> On Wed, 15 Jul 2009 11:53:28 +0200, Helmut Jarausch
> <jarau... at> 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?
> yes...
> Use OpenOffice-Scalc or MS-Office-Excel to open the table...

Max 64K rows for Scalc and Excel 2003; 2007 can take 2**20 rows.
Only old dBase (not dBase 7). Memo fields not handled. Visual FoxPro
DBFs not supported by Excel even tho' VFP is an MS product.

> Export to csv....


> Use SQLite Manager (
> and use the import wizard to import your data....
> It shouldn't take too long...

... before you get sick of the error-prone manual tasks.

I'd write a script that took a DBF file, analysed the field
descriptions, made a CREATE TABLE statement, executed it, and then
started doing inserts. Fairly easy to write. Scripts have the great
benefit that you can fix them and re-run a whole lot easier than
redoing manual steps.

If dbfpy can't handle any new-fangled stuff you may have in your
files, drop me a line ... I have a soon-to-be released DBF module that
should be able to read the "new" stuff up to dBase7 and VFP9,
including memo files, conversion from whatever to Unicode if
needed, ...


More information about the Python-list mailing list