Skip to content

Commit 88f8256

Browse files
authored
feat(property-chunking): Allow the definition of query_properties on the HttpRequester component (#638)
1 parent cad95c9 commit 88f8256

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,9 +2043,15 @@ definitions:
20432043
- "$ref": "#/definitions/NoAuth"
20442044
- "$ref": "#/definitions/LegacySessionTokenAuthenticator"
20452045
fetch_properties_from_endpoint:
2046+
deprecated: true
2047+
deprecation_message: "Use `query_properties` field instead."
20462048
title: Fetch Properties from Endpoint
20472049
description: Allows for retrieving a dynamic set of properties from an API endpoint which can be injected into outbound request using the stream_partition.extra_fields.
20482050
"$ref": "#/definitions/PropertiesFromEndpoint"
2051+
query_properties:
2052+
title: Query Properties
2053+
description: For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.
2054+
"$ref": "#/definitions/QueryProperties"
20492055
request_parameters:
20502056
title: Query Parameters
20512057
description: Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,9 +2543,16 @@ class HttpRequester(BaseModelWithDeprecations):
25432543
)
25442544
fetch_properties_from_endpoint: Optional[PropertiesFromEndpoint] = Field(
25452545
None,
2546+
deprecated=True,
2547+
deprecation_message="Use `query_properties` field instead.",
25462548
description="Allows for retrieving a dynamic set of properties from an API endpoint which can be injected into outbound request using the stream_partition.extra_fields.",
25472549
title="Fetch Properties from Endpoint",
25482550
)
2551+
query_properties: Optional[QueryProperties] = Field(
2552+
None,
2553+
description="For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.",
2554+
title="Query Properties",
2555+
)
25492556
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
25502557
None,
25512558
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3221,6 +3221,7 @@ def _get_url() -> str:
32213221
hasattr(model.requester, "fetch_properties_from_endpoint")
32223222
and model.requester.fetch_properties_from_endpoint
32233223
):
3224+
# todo: Deprecate this condition once dependent connectors migrate to query_properties
32243225
query_properties_definition = QueryPropertiesModel(
32253226
type="QueryProperties",
32263227
property_list=model.requester.fetch_properties_from_endpoint,
@@ -3232,6 +3233,11 @@ def _get_url() -> str:
32323233
model=query_properties_definition,
32333234
config=config,
32343235
)
3236+
elif hasattr(model.requester, "query_properties") and model.requester.query_properties:
3237+
query_properties = self.create_query_properties(
3238+
model=model.requester.query_properties,
3239+
config=config,
3240+
)
32353241

32363242
requester = self._create_component_from_model(
32373243
model=model.requester,

unit_tests/sources/declarative/parsers/test_model_to_component_factory.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4404,21 +4404,23 @@ def test_simple_retriever_with_requester_properties_from_endpoint():
44044404
url_base: "https://api.hubapi.com"
44054405
http_method: "GET"
44064406
path: "adAnalytics"
4407-
fetch_properties_from_endpoint:
4408-
type: PropertiesFromEndpoint
4409-
property_field_path: [ "name" ]
4410-
retriever:
4411-
type: SimpleRetriever
4412-
requester:
4413-
type: HttpRequester
4414-
url_base: https://api.hubapi.com
4415-
path: "/properties/v2/dynamics/properties"
4416-
http_method: GET
4417-
record_selector:
4418-
type: RecordSelector
4419-
extractor:
4420-
type: DpathExtractor
4421-
field_path: []
4407+
query_properties:
4408+
type: QueryProperties
4409+
property_list:
4410+
type: PropertiesFromEndpoint
4411+
property_field_path: [ "name" ]
4412+
retriever:
4413+
type: SimpleRetriever
4414+
requester:
4415+
type: HttpRequester
4416+
url_base: https://api.hubapi.com
4417+
path: "/properties/v2/dynamics/properties"
4418+
http_method: GET
4419+
record_selector:
4420+
type: RecordSelector
4421+
extractor:
4422+
type: DpathExtractor
4423+
field_path: []
44224424
dynamic_properties_stream:
44234425
type: DeclarativeStream
44244426
incremental_sync:

0 commit comments

Comments
 (0)