Skip to content

Commit

Permalink
uses datetime as load_package_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed May 7, 2024
1 parent dc6f1ba commit 3af94e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dlt/destinations/path_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_unused_placeholders(

def prepare_datetime_params(
current_datetime: Optional[pendulum.DateTime] = None,
load_package_timestamp: Optional[str] = None,
load_package_timestamp: Optional[pendulum.DateTime] = None,
) -> Dict[str, str]:
params: Dict[str, str] = {}
current_timestamp: pendulum.DateTime = None
Expand Down Expand Up @@ -214,7 +214,7 @@ def create_path(
file_name: str,
schema_name: str,
load_id: str,
load_package_timestamp: Optional[str] = None,
load_package_timestamp: Optional[pendulum.DateTime] = None,
current_datetime: Optional[TCurrentDateTime] = None,
extra_placeholders: Optional[Dict[str, Any]] = None,
) -> str:
Expand Down
10 changes: 5 additions & 5 deletions tests/destinations/test_path_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def test_layout_validity(
return_value=job_info,
)

now_timestamp = frozen_datetime.to_iso8601_string()
now_timestamp = frozen_datetime
if is_valid:
path = create_path(
layout,
Expand Down Expand Up @@ -404,7 +404,7 @@ def test_create_path_uses_provided_load_package_timestamp(test_load: TestLoad) -
"{schema_name}/{table_name}/{load_id}.{file_id}.{timestamp}.{ext}",
schema_name="schema_name",
load_id=load_id,
load_package_timestamp=now.to_iso8601_string(),
load_package_timestamp=now,
file_name=job_info.file_name(),
)

Expand All @@ -425,7 +425,7 @@ def test_create_path_resolves_current_datetime(test_load: TestLoad) -> None:
load_id, job_info = test_load
now = pendulum.now()
timestamp = int(now.timestamp())
now_timestamp = now.to_iso8601_string()
now_timestamp = now
calls = 0

def current_datetime_callback():
Expand Down Expand Up @@ -508,7 +508,7 @@ def test_create_path_uses_load_package_timestamp_as_current_datetime(
load_id, job_info = test_load
now = pendulum.now()
timestamp = int(now.timestamp())
now_timestamp = now.to_iso8601_string()
now_timestamp = now
logger_spy = mocker.spy(logger, "info")
ensure_pendulum_datetime_spy = mocker.spy(
dlt.destinations.path_utils, "ensure_pendulum_datetime"
Expand Down Expand Up @@ -557,7 +557,7 @@ def inc(self, *args, **kwargs):
}
now = pendulum.now()
timestamp = int(now.timestamp())
now_timestamp = now.to_iso8601_string()
now_timestamp = now
created_path = create_path(
"{schema_name}/{table_name}/{callable_1}-{otter}/{load_id}.{file_id}.{timestamp}.{ext}",
schema_name="schema_name",
Expand Down

0 comments on commit 3af94e4

Please sign in to comment.