From 7024ecc3c90599e865220c86c8f5376761da3472 Mon Sep 17 00:00:00 2001 From: Alexandre Girard Date: Thu, 11 Aug 2022 07:23:20 -0700 Subject: [PATCH] docstring --- .../declarative/extractors/dpath_extractor.py | 23 +++++++++++++++---- .../parsers/class_types_registry.py | 2 ++ .../default_implementation_registry.py | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/airbyte-cdk/python/airbyte_cdk/sources/declarative/extractors/dpath_extractor.py b/airbyte-cdk/python/airbyte_cdk/sources/declarative/extractors/dpath_extractor.py index 4e392a9f5c3d..3859a0870850 100644 --- a/airbyte-cdk/python/airbyte_cdk/sources/declarative/extractors/dpath_extractor.py +++ b/airbyte-cdk/python/airbyte_cdk/sources/declarative/extractors/dpath_extractor.py @@ -18,12 +18,27 @@ @dataclass class DpathExtractor(RecordExtractor, JsonSchemaMixin): """ - Record extractor that evaluates a Jello query to extract records from a decoded response. - - More information on Jello can be found at https://github.com/kellyjonbrazil/jello + Record extractor that searches a decoded response over a path defined as an array of fields. + + Examples of instantiating this transform: + ``` + extractor: + type: DpathExtractor + transform: + - "root" + - "data" + ``` + + ``` + extractor: + type: DpathExtractor + transform: + - "root" + - "{{ options['field'] }}" + ``` Attributes: - transform (Union[InterpolatedString, str]): The Jello query to evaluate on the decoded response + transform (Union[InterpolatedString, str]): Pointer to the field that should be extracted config (Config): The user-provided configuration as specified by the source's spec decoder (Decoder): The decoder responsible to transfom the response in a Mapping """ diff --git a/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/class_types_registry.py b/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/class_types_registry.py index ad0c268e1ac1..e075936d289a 100644 --- a/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/class_types_registry.py +++ b/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/class_types_registry.py @@ -7,6 +7,7 @@ from airbyte_cdk.sources.declarative.auth.token import ApiKeyAuthenticator, BasicHttpAuthenticator, BearerAuthenticator from airbyte_cdk.sources.declarative.datetime.min_max_datetime import MinMaxDatetime from airbyte_cdk.sources.declarative.declarative_stream import DeclarativeStream +from airbyte_cdk.sources.declarative.extractors.dpath_extractor import DpathExtractor from airbyte_cdk.sources.declarative.extractors.jello import JelloExtractor from airbyte_cdk.sources.declarative.extractors.record_selector import RecordSelector from airbyte_cdk.sources.declarative.interpolation.interpolated_boolean import InterpolatedBoolean @@ -46,6 +47,7 @@ "DatetimeStreamSlicer": DatetimeStreamSlicer, "DeclarativeStream": DeclarativeStream, "DefaultErrorHandler": DefaultErrorHandler, + "DpathExtractor": DpathExtractor, "ExponentialBackoffStrategy": ExponentialBackoffStrategy, "HttpRequester": HttpRequester, "InterpolatedBoolean": InterpolatedBoolean, diff --git a/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/default_implementation_registry.py b/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/default_implementation_registry.py index 1a9862fa59bb..993c49d5f61f 100644 --- a/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/default_implementation_registry.py +++ b/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/default_implementation_registry.py @@ -52,13 +52,13 @@ InterpolatedString: InterpolatedString, MinMaxDatetime: MinMaxDatetime, Paginator: NoPagination, + ParentStreamConfig: ParentStreamConfig, + RecordExtractor: JelloExtractor, RequestOption: RequestOption, RequestOptionsProvider: InterpolatedRequestOptionsProvider, Requester: HttpRequester, Retriever: SimpleRetriever, - ParentStreamConfig: ParentStreamConfig, SchemaLoader: JsonSchema, Stream: DeclarativeStream, StreamSlicer: SingleSlice, - RecordExtractor: JelloExtractor, }