Solution
data = [{'cid': 1, ...}, {'cid': 2, ...}, {'cid': 3, ...}]
for item in data: # type: dict
cid = item['cid']
json_hash = hash(json.dumps(data))
# Record - let's say a model from db
record = get_record_by_cid(cid)
if not record:
save_record(cid, item, json_hash)
continue
if record.json_hash != json_hash:
update_record(cid, item, json_hash)