Re: [Dhis2-users] Cross database querying for updating data

2015-04-21 Thread Bob Jolliffe
Hi Jason yes DELETES are a problem alright. Having a complete copy of the remote database would in general defeat the purpose of the exercise :-) Which is to maintain such a copy with increments rather that download the whole thing ... A while back i thought about using postgres native replicat

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Jason Pickering
Yeah maybe, or simply "NOT EXISTS" . However, cross-database queries in postgres are not in general supported without an extension, so you would need to deal with that, and obviously have a completely integral copy of the remote database on the local machine. Seems like a lot of moving parts, but

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Knut Staring
Couldn't two "left joins with null" give you the diff? On Apr 21, 2015 12:36 AM, "Jason Pickering" wrote: > Hi there. I think the big challenge here is what is not there, as opposed > to what needs to be added. DHIS2 has no functionality for "soft deletes", > meaning when you mark a record with

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Jason Pickering
Hi there. I think the big challenge here is what is not there, as opposed to what needs to be added. DHIS2 has no functionality for "soft deletes", meaning when you mark a record with a column like "deletedon" with a timestamp for deletion, but you actually do not remove it from the database. Thi

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Knut Staring
I think I would trust UIDs or Codes more than database IDs On Mon, Apr 20, 2015 at 10:48 PM, Muyepa A. wrote: > Indeed Database A has extra data not available in B while B has data > missing in A. No changes have been made to orgunits, dataelements, > periods or users. The delta is in data-val

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Muyepa A.
Indeed Database A has extra data not available in B while B has data missing in A. No changes have been made to orgunits, dataelements, periods or users. The delta is in data-values. I would really want to get views on whether the operation described (all other parameters being equal) will bring

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Bob Jolliffe
If database B is restored off a backup of database A then it will probably work with some caveats. Clearly they are not exactly the same because you've got extra data in A which you are trying to push into B. So it depends really on what else might have changed in A. If you have made any changes

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Muyepa A.
I had thought of data import/export functionality, however this will require two instances of tomcat to be running. (or one instance with one database at a time, however there will be an associated down time). Since upgrading to 2.18, when exported, the resultant download zip file says invalid for

Re: [Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Jason Pickering
It may work, but in general, it will not because the internal IDs of different DHIS2 databases are not the same. So, it might work, but it requires both databases to be in essentially the same state. Better to use the data import/export functionality if you can. Regards, Jason On Mon, Apr 20, 20

[Dhis2-users] Cross database querying for updating data

2015-04-20 Thread Muyepa A.
Can I safely update DHIS2 database A with data from DHIS database B both on the same PostgreSQL server by cross query. B is backup of A >From database B, I can retrieve and save the data that is required using: psql B -c "\copy (select * from datavalue where periodid='') TO STDOUT" > /tmp/da