Skip to content
Advertisement

How to cotinuosly append data from DB2 server to sqlite using preferably django and if nothing else then python alone code

I am writing a django website that has some reports that pulls data based on DB2 database. Since I have only read only access to that database, I want the data from DB2 to be continuosly appended (or appended at intervals of lets say 20 minutes) to sqlite database being used by django.
Now I am totally new to python as well hence I am blank with what should I use for this.
Is there any django method that can be implemented or should I write a python only script to copy the data.

Lets say I have a database with fields – DEAL,BUSINESS,CUSTID,REPID,REPNAME in DB2 (I don’t have any primary key here since the database if very old). I want to continuisly copy this data from DB2 to Sqlite. What should be the simplest code?

Please help.

Advertisement

Answer

Keep in mind that Db2 for Linux Unix windows, Db2 for zOS, Db2 for IBM i, and Db2 Warehouse are all different inside, so, if you need further information, specify type and version of Db2.

For moving data periodically you have many options. @Iakovos_Belonias suggestion is one of them. Your main challenge will be recognizing new rows, rows being changed, and rows being deleted. If source table is not very large, you can copy it completely, but if the source table is large, you will have to try a smarter mechanism. If this is the case, please put comment or open a new question.

For moving data near-real-time, the best option is by using a Change Data Capture (CDC) application such as IBM Infosphere Data Replication or Oracle Golden Gate, among others. I think there is not a free CDC application (except for licenses with limitations that will not cover your need), and commercial CDC applications are offered for Db2 versions still under supported.

I hope this help…

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement