Foxbase to postrgresql data transfer. (dbf files r

2019-08-02 17:55发布

I rewrite a program based on the old Foxbase database consisting of files .dbf. I need a tool that would read these files, and helped in the transfer of data to PostgreSQL. You know maybe some of this type of tool?

2条回答
狗以群分
2楼-- · 2019-08-02 18:03

pgdbf.sourceforge.net - has worked for all the DBF I've fed it. Quoting the site description:

PgDBF is a program for converting XBase databases - particularly FoxPro tables with memo files - into a format that PostgreSQL can directly import. It's a compact C project with no dependencies other than standard Unix libraries.

If you are looking for something to run on Windows, and this doesn't compile directly, you could use cygwin (www.cygwin.com) to build and run pgdbf.

查看更多
你好瞎i
3楼-- · 2019-08-02 18:23

As part of the migration path you could use Python and my dbf module. A very simple script to convert the dbf files to csv would be:

import sys
import dbf
dbf.export(sys.argv[1])

which will create a .csv file of the same name as the dbf file. If you put that code into a script named dbf2csv.py you could then call it as

python dbf2csv.py dbfname

Hopefully there are some handy tools to get the csv file into PostgreSQL.

查看更多
登录 后发表回答