Syncing
Synchronization client.
Strategy:
- upsert organizations, get {source_id: ckan_id} map
- upsert groups, get {source_id: ckan_id} map
- create collection of CkanDatasets from original dicts
- calculate differences between desired and actual state
- perform syncrhonization
- double-check differences
-
class ckan_api_client.syncing.SynchronizationClient(base_url, api_key=None, **kw)[source]
Synchronization client, providing functionality for importing
collections of datasets into a Ckan instance.
Strategy:
- find all “own” datasets from Ckan
- figure out which datasets need insertion/update/deletion
- apply changes
-
sync(source_name, data)[source]
Synchronize data from a source into Ckan.
- datasets are matched by _harvest_source
- groups and organizations are matched by name
Parameters: |
- source_name – string identifying the source
- data – data to be synchronized
|