pyODK merge - updates and conflicts

1. What is the issue? Please be detailed.

I am trying to use pyODK to create new entities and manage update of existing entities. I can work in reasonably simple scenarios, but before stepping towards release into the wild, I'd like to be sure that I haven't missed any critical 'features'.

In particular I am trying to make sure I understand how MERGE works before getting myself (and my data) into trouble. It seems to be a more 'all encompassing' technique of managing entities compared with UPDATE, but it looks like UPDATE has a check/balance of FORCE and BASE_VERSION... maybe UPDATE is 'safer' / useful in more complex scenarios?

If I supply a CSV with a list of entities to update using MERGE, will pyODK always overwrite the version on Central? I've looked through the source code (I know!) and can't quite follow whether there are and 'checks' on version or conflict status.

And that might affect working with offline entities - not so much of a problem if I have 'full control' over the entity list, but if I'm trying to update via pyODK and an enumerator tries to update via Collect (possibly offline or maybe since I last checked the server), how do I manage potential conflicts?

The docs are a little 'scant' in this area and I can't find any working examples of MERGE except where it is used to create_many... I'm also finding the language in the docs a little obtuse (or maybe I am too obtuse to understand the concepts).

"source_keys If provided, process only these keys in data. " - does this mean ignore for example 'label' or uuid / __id?

and how does that integrate / conflict with

match_keys: Dictionary keys common to source and target used to match rows. Defaults to ("label",). If a custom source_label_key is provided, specify that key as "label", because it is translated to "label" for matching. (that's a complicated sentence, which I think cross refers to other settings, but without examples I find it hard to follow.)

And clarifications for the terminally dim would be much appreciated :slight_smile: