Skip to content

Commit

Permalink
Small refactor set_replication_keys method
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardWez committed Nov 24, 2023
1 parent 5c41aa8 commit f3c1fe5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions elx/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,21 @@ def set_replication_keys(self, replication_keys: Optional[dict]) -> "Catalog":
# Set the replication method to INCREMENTAL
stream.replication_method = "INCREMENTAL"

# The replication key for current stream
replication_key = replication_keys[stream.tap_stream_id]

# Update the replication key value
stream.replication_key = replication_keys[stream.tap_stream_id]
stream.replication_key = replication_key

# Add the replication key to stream metadata
stream.upsert_metadata(
breadcrumb=[],
metadata={
"valid-replication-keys": [
replication_keys[stream.tap_stream_id]
]
},
metadata={"valid-replication-keys": [replication_key]},
)

# Set inclusion of replication property metadata to `automatic`
stream.upsert_metadata(
breadcrumb=["properties", replication_keys[stream.tap_stream_id]],
breadcrumb=["properties", replication_key],
metadata={"inclusion": "automatic"},
)

Expand Down

0 comments on commit f3c1fe5

Please sign in to comment.