Foxbase to postrgresql data transfer. (dbf files reader)

元气小坏坏 提交于 2019-12-11 10:59:35

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8038056/foxbase-to-postrgresql-data-transfer-dbf-files-reader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!