[openspending-dev] How to update data from specific source?

andmrm at yahoo.com.br andmrm at yahoo.com.br
Thu Nov 19 17:52:56 UTC 2015


Hello! In a dataset, is there a way to update data from a specific source?

We have a dataset with many sources (one source for each year), and we want to
update the current year data weekly.

After a source is marked as "Successfully loaded" there is no button in the
website interface to unload it, and the "/sources/{id}/delete" endpoint seems
not to work neither.
The "Delete loaded data" button unloads all the sources, what is bad in this
case, because then we have to reload ALL the sources (years) again and we just
need to update the current year, not all of them.
So I tried to just add a new source for the current year (duplicating it), the
interface returned errors about duplicated PK (what is expected), but I hoped
it to replace old lines with new lines where PKs collided, updating the data.
After some months doing that, it seems I was wrong and instead of updating the
data OpenSpending is keeping old lines when PKs collide, inserting only new
lines (with new PKs).

So, is our only option to drop and reload ALL the sources?

Is there a way to delete data based on a field value?
e.g.: delete lines where year==2015


Thanks for the attention


More information about the openspending-dev mailing list