Skip to content

Commit

Permalink
feat: _sdc_timestamp (#5)
Browse files Browse the repository at this point in the history
* _sdc_timestamp

* unix_time as replication key

* remove testing snippet
  • Loading branch information
sebastianswms authored Dec 18, 2024
1 parent 9e63da4 commit a80ece7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion meltano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins:
- name: secret_key
sensitive: true
- name: start_date
kind: integer
kind: date_iso8601
loaders:
- name: target-jsonl
variant: andyh1203
Expand Down
15 changes: 10 additions & 5 deletions tap_calltrackingmetrics/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,18 @@ def get_url_params(
next_page_token: t.Any | None,
) -> dict[str, t.Any]:
params = super().get_url_params(context, next_page_token)
starting_replication_key_value = self.get_starting_replication_key_value(
context
) or self.config.get("start_date")
if "start_date" not in params and starting_replication_key_value is not None:
starting_replication_key_value = self.get_starting_replication_key_value(context) # noqa: E501
start_date = None
if isinstance(starting_replication_key_value, str):
start_date = datetime.datetime.fromisoformat(
starting_replication_key_value
).strftime("%Y-%m-%d")
elif isinstance(starting_replication_key_value, int):
start_date = datetime.datetime.fromtimestamp(
starting_replication_key_value, tz=datetime.timezone.utc
starting_replication_key_value,
tz=datetime.timezone.utc,
).strftime("%Y-%m-%d")
if start_date is not None:
params["start_date"] = start_date
return params

Expand Down
4 changes: 2 additions & 2 deletions tap_calltrackingmetrics/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class TapCallTrackingMetrics(Tap):
),
th.Property(
"start_date",
th.IntegerType,
th.DateTimeType,
required=False,
title="Start Date",
description="Formatted as a Unix timestamp.",
description="The earliest record to sync.",
),
).to_dict()

Expand Down

0 comments on commit a80ece7

Please sign in to comment.