diff --git a/dlt/extract/incremental/transform.py b/dlt/extract/incremental/transform.py index 8f2ff4309f..6a1514ac5b 100644 --- a/dlt/extract/incremental/transform.py +++ b/dlt/extract/incremental/transform.py @@ -156,26 +156,19 @@ def find_cursor_value(self, row: TDataItem) -> Any: return row_value - - def _value_at_cursor_path(self, row: TDataItem): - row_value = None + def _value_at_cursor_path(self, row: TDataItem) -> Optional[TDataItem]: try: - row_value = row.get(self.cursor_path) + return row.get(self.cursor_path) except AttributeError: # supports Pydantic models and other classes - row_value = getattr(row, self.cursor_path) - return row_value - + return getattr(row, self.cursor_path) def _contains_cursor_path(self, row: TDataItem) -> bool: - has_field = None try: - has_field = self.cursor_path in row.keys() + return self.cursor_path in row.keys() except AttributeError: # supports Pydantic models and other classes - has_field = hasattr(row, self.cursor_path) - return has_field - + return hasattr(row, self.cursor_path) def __call__( self,