Skip to content

Commit

Permalink
dissatisfying headstand to pass tests/pipeline/test_pipeline_extra.py…
Browse files Browse the repository at this point in the history
…::test_dump_trace_freeze_exception
  • Loading branch information
willi-mueller committed Aug 8, 2024
1 parent 99c1e39 commit 06aff12
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions dlt/extract/incremental/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,21 @@ def find_cursor_value(self, row: TDataItem) -> Any:
# ignores the other found values, e.g. when the path is $data.items[*].created_at
row_value = cursor_values[0]
else:
row_value = row.get(self.cursor_path)
row_value = None
try:
row_value = row.get(self.cursor_path)
except AttributeError:
# just to pass tests/pipeline/test_pipeline_extra.py::test_dump_trace_freeze_exception
# Wouldn't it be preferrable to tell the exact exception?
pass
if row_value is None:
if self.on_cursor_value_missing == "raise":
if self.cursor_path not in row.keys():
has_field = None
if isinstance(row, dict):
has_field = self.cursor_path in row.keys()
else:
has_field = hasattr(row, self.cursor_path)
if not has_field:
raise IncrementalCursorPathMissing(
self.resource_name, self.cursor_path, row
)
Expand Down

0 comments on commit 06aff12

Please sign in to comment.