| 1 | [[TOC]] |
| 2 | = S3XRC - Data Synchronisation = |
| 3 | |
| 4 | - [wiki:S3XRC] |
| 5 | |
| 6 | == Introduction == |
| 7 | |
| 8 | - ''tbw'' |
| 9 | |
| 10 | == msince == |
| 11 | |
| 12 | msince parameter allows selecting of records since a specific time. This needs to be ISO8601, i.e. |
| 13 | {{{ |
| 14 | YYYY-MM-DDThh:mm:ssZ |
| 15 | }}} |
| 16 | If given, this exports only resources which have been modified since this date/time (=if either the main record or any of its component records has been |
| 17 | modified since then). Referenced resources are exported regardless of "msince", because it could always be that the reference itself has changed |
| 18 | since then. |
| 19 | |
| 20 | == Strategy == |
| 21 | |
| 22 | vector.strategy contains the allowed import strategies as a list, which allows |
| 23 | you to control the import behavior: |
| 24 | |
| 25 | If this list is empty (or None), then the importer skips this records (and all |
| 26 | related components). |
| 27 | |
| 28 | If this list contains vector.METHOD.CREATE, then new records will be created, |
| 29 | otherwise records from the import source which don't have an instance in the |
| 30 | local database, will be skipped (together will all their components). |
| 31 | |
| 32 | If this list contains vector.METHOD.UPDATE, then vectors which already have a |
| 33 | local instance will be updated from the import source, otherwise they will be |
| 34 | ignored (together will all their components). |
| 35 | |
| 36 | The function hooked in as s3xrc.sync_resolve(vector) is expected to set |
| 37 | vector.strategy according to the policies, otherwise the fallback strategy |
| 38 | will allow both, create and update. |
| 39 | |
| 40 | == Resolution == |
| 41 | |
| 42 | The function s3xrc.sync_resolve(vector) can issue a resolution per vector, |
| 43 | that is, you can tell the importer which fields from which record (the local |
| 44 | one or the imported one) are to be kept for the import: |
| 45 | |
| 46 | vector.resolution can contain this resolution either as a single value, or as |
| 47 | a dict of values with fieldnames as keys (per-field resolution). There are |
| 48 | three possible values for resolution: |
| 49 | |
| 50 | vector.RESOLUTION.THIS means: keep the local value |
| 51 | vector.RESOLUTION.OTHER means: keep the imported value (if any) |
| 52 | vector.RESOLUTION.NEWER means: keep the newer value |
| 53 | |
| 54 | vector.resolution falls back to vector.default_resolution. |
| 55 | |
| 56 | If you use per-field resolutions, you need to set vector.default_resolution |
| 57 | for all fields for which there is no entry in vector.resolution. The default |
| 58 | resolution falls back to vector.RESOLUTION.THIS. |
| 59 | |
| 60 | ---- |
| 61 | |
| 62 | DeveloperGuidelines |