Hi I am faced with a task where i have to build an application which has the following requirements:- 1.the users of an organisation upload dbf files(foxpro database files) remotely into my application 2.this dbf file is used to开发者_StackOverflow中文版 update the mysql database which is the central repository
This web application has to be built on php or python. Can someone please suggest some ways Thanks
There are at least two Python modules for accessing DBF file formats: dbfpy and dbf. Once you can parse the DBF file, you'll need to pass rows to a translation routine which constructs SQL statements to populate the MySQL tables, using the MySQLdb extension.
Also make sure to plan how to recover if an insert fails and a user has to re-upload the same file, like wrapping all your inserts/updates in a single transaction which can be rolled back.
If the files are quite large you might want to consider queuing the files and having a background process insert them, instead of doing it within the web request. It could keep a record of each file it has successfully completed, so users can check status, or email them once their job has run successfully, depending on your requirements.
精彩评论