Skip to content

Commit fafab4d

Browse files
added ComponentConstructor to QueryProperties
1 parent 01d2f87 commit fafab4d

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

airbyte_cdk/sources/declarative/requesters/query_properties/query_properties.py

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
22

33
from dataclasses import InitVar, dataclass
4-
from typing import Any, Iterable, List, Mapping, Optional, Union
4+
from typing import Any, Iterable, List, Mapping, Optional, Union, Callable
55

66
from airbyte_cdk.sources.declarative.requesters.query_properties import (
77
PropertiesFromEndpoint,
88
PropertyChunking,
99
)
1010
from airbyte_cdk.sources.types import Config, StreamSlice
11+
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
12+
QueryProperties as QueryPropertiesModel,
13+
)
14+
from airbyte_cdk.sources.declarative.parsers.component_constructor import (
15+
ComponentConstructor,
16+
AdditionalFlags,
17+
)
1118

1219

1320
@dataclass
14-
class QueryProperties:
21+
class QueryProperties(ComponentConstructor[QueryPropertiesModel]):
1522
"""
1623
Low-code component that encompasses the behavior to inject additional property values into the outbound API
1724
requests. Property values can be defined statically within the manifest or dynamically by making requests
@@ -25,6 +32,35 @@ class QueryProperties:
2532
config: Config
2633
parameters: InitVar[Mapping[str, Any]]
2734

35+
@classmethod
36+
def resolve_dependencies(
37+
cls,
38+
model: QueryPropertiesModel,
39+
config: Config,
40+
dependency_constructor: Callable[..., Any],
41+
additional_flags: AdditionalFlags,
42+
**kwargs: Any,
43+
) -> Mapping[str, Any]:
44+
if isinstance(model.property_list, list):
45+
property_list = model.property_list
46+
else:
47+
property_list = dependency_constructor(
48+
model=model.property_list, config=config, **kwargs
49+
)
50+
51+
property_chunking = (
52+
dependency_constructor(model=model.property_chunking, config=config, **kwargs)
53+
if model.property_chunking
54+
else None
55+
)
56+
return {
57+
"property_list": property_list,
58+
"always_include_properties": model.always_include_properties,
59+
"property_chunking": property_chunking,
60+
"config": config,
61+
"parameters": model.parameters or {},
62+
}
63+
2864
def get_request_property_chunks(
2965
self, stream_slice: Optional[StreamSlice] = None
3066
) -> Iterable[List[str]]:

0 commit comments

Comments
 (0)