airbyte_cdk.sources.declarative.transformations.transformation
1# 2# Copyright (c) 2023 Airbyte, Inc., all rights reserved. 3# 4 5from abc import abstractmethod 6from dataclasses import dataclass 7from typing import Any, Dict, Optional 8 9from airbyte_cdk.sources.types import Config, StreamSlice, StreamState 10 11 12@dataclass 13class RecordTransformation: 14 """ 15 Implementations of this class define transformations that can be applied to records of a stream. 16 """ 17 18 @abstractmethod 19 def transform( 20 self, 21 record: Dict[str, Any], 22 config: Optional[Config] = None, 23 stream_state: Optional[StreamState] = None, 24 stream_slice: Optional[StreamSlice] = None, 25 ) -> None: 26 """ 27 Transform a record by adding, deleting, or mutating fields directly from the record reference passed in argument. 28 29 :param record: The input record to be transformed 30 :param config: The user-provided configuration as specified by the source's spec 31 :param stream_state: The stream state 32 :param stream_slice: The stream slice 33 :return: The transformed record 34 """ 35 36 def __eq__(self, other: object) -> bool: 37 return other.__dict__ == self.__dict__
@dataclass
class
RecordTransformation:
13@dataclass 14class RecordTransformation: 15 """ 16 Implementations of this class define transformations that can be applied to records of a stream. 17 """ 18 19 @abstractmethod 20 def transform( 21 self, 22 record: Dict[str, Any], 23 config: Optional[Config] = None, 24 stream_state: Optional[StreamState] = None, 25 stream_slice: Optional[StreamSlice] = None, 26 ) -> None: 27 """ 28 Transform a record by adding, deleting, or mutating fields directly from the record reference passed in argument. 29 30 :param record: The input record to be transformed 31 :param config: The user-provided configuration as specified by the source's spec 32 :param stream_state: The stream state 33 :param stream_slice: The stream slice 34 :return: The transformed record 35 """ 36 37 def __eq__(self, other: object) -> bool: 38 return other.__dict__ == self.__dict__
Implementations of this class define transformations that can be applied to records of a stream.
@abstractmethod
def
transform( self, record: Dict[str, Any], config: Optional[Mapping[str, Any]] = None, stream_state: Optional[Mapping[str, Any]] = None, stream_slice: Optional[airbyte_cdk.StreamSlice] = None) -> None:
19 @abstractmethod 20 def transform( 21 self, 22 record: Dict[str, Any], 23 config: Optional[Config] = None, 24 stream_state: Optional[StreamState] = None, 25 stream_slice: Optional[StreamSlice] = None, 26 ) -> None: 27 """ 28 Transform a record by adding, deleting, or mutating fields directly from the record reference passed in argument. 29 30 :param record: The input record to be transformed 31 :param config: The user-provided configuration as specified by the source's spec 32 :param stream_state: The stream state 33 :param stream_slice: The stream slice 34 :return: The transformed record 35 """
Transform a record by adding, deleting, or mutating fields directly from the record reference passed in argument.
Parameters
- record: The input record to be transformed
- config: The user-provided configuration as specified by the source's spec
- stream_state: The stream state
- stream_slice: The stream slice
Returns
The transformed record