Skip to content

Commit f8bf0c7

Browse files
authored
Merge pull request #65 from scotho3/tscott/potenda-skip-unmatched-src
feat: Add skip_unmatched_source option
2 parents 6d42095 + 033f716 commit f8bf0c7

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

docs/docs/reference/config.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ Describes the overall synchronization configuration.
1717

1818
| Property | Type | Description | Mandatory |
1919
| -------- | ---- | ----------- | --------- |
20-
| name | string | Unique identifier for the sync instance. | Yes |
21-
| store | SyncStore | Configuration for the optional storage mechanism. | No |
22-
| source | SyncAdapter | Configuration for the source adapter. | Yes |
23-
| destination | SyncAdapter | Configuration for the destination adapter. | Yes |
24-
| order | List of strings | Specifies the order in which objects should be synchronized. | Yes |
25-
| schema_mapping | List of SchemaMappingModel | Defines how data is mapped from source to destination. | Yes |
20+
| `name` | string | Unique identifier for the sync instance. | Yes |
21+
| `store` | SyncStore | Configuration for the optional storage mechanism. | No |
22+
| `source` | SyncAdapter | Configuration for the source adapter. | Yes |
23+
| `destination` | SyncAdapter | Configuration for the destination adapter. | Yes |
24+
| `order` | List of strings | Specifies the order in which objects should be synchronized. | Yes |
25+
| `schema_mapping` | List of SchemaMappingModel | Defines how data is mapped from source to destination. | Yes |
26+
| `skip_unmatched_source` | boolean | If set to `true`, Source records will not be compared if they do not exist in the Destination | No |
2627

2728
### Sync store
2829

infrahub_sync/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class SyncConfig(pydantic.BaseModel):
5555
destination: SyncAdapter
5656
order: list[str] = pydantic.Field(default_factory=list)
5757
schema_mapping: list[SchemaMappingModel] = []
58+
skip_unmatched_source: bool = pydantic.Field(default=False)
5859

5960

6061
class SyncInstance(SyncConfig):

infrahub_sync/potenda/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ def __init__(
3737
self.progress_bar = None
3838
self.show_progress = show_progress
3939
enable_console_logging(verbosity=1)
40-
self.flags = DiffSyncFlags.SKIP_UNMATCHED_DST
40+
self.flags = (
41+
DiffSyncFlags.SKIP_UNMATCHED_BOTH
42+
if self.config.skip_unmatched_destination
43+
else DiffSyncFlags.SKIP_UNMATCHED_DST
44+
)
4145

4246
def _print_callback(self, stage: str, elements_processed: int, total_models: int):
4347
"""Callback for DiffSync using tqdm"""

0 commit comments

Comments
 (0)