-
Notifications
You must be signed in to change notification settings - Fork 32
feat(query_properties): Add configured catalog to SimpleRetriever and only fetch properties that are included in the stream schema #788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
brianjlai
merged 8 commits into
main
from
brian/property_chunking_only_fetch_enabled_fields
Oct 23, 2025
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a3b3563
add configured catalog to SimpleRetriever and only fetch properties t…
brianjlai de0b73f
fix tests and clean up a few parts of the code
brianjlai 15d8769
introduce a JsonSchemaPropertySelector component to allow for more fl…
brianjlai 901a313
Merge branch 'main' into brian/property_chunking_only_fetch_enabled_f…
brianjlai 4b872d6
fix tests
brianjlai df6dd69
Merge branch 'main' into brian/property_chunking_only_fetch_enabled_f…
brianjlai 19f4cf7
pr feedback and bug fix so we always include properties if no propert…
brianjlai afc67fd
don't modify the original schema when we run transforms
brianjlai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
airbyte_cdk/sources/declarative/requesters/query_properties/json_schema_property_selector.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright (c) 2025 Airbyte, Inc., all rights reserved. | ||
|
|
||
| from dataclasses import InitVar, dataclass, field | ||
| from typing import Any, List, Mapping, Optional, Set | ||
|
|
||
| from airbyte_protocol_dataclasses.models import ConfiguredAirbyteStream | ||
|
|
||
| from airbyte_cdk.sources.declarative.transformations import RecordTransformation | ||
| from airbyte_cdk.sources.types import Config | ||
|
|
||
|
|
||
| @dataclass | ||
| class JsonSchemaPropertySelector: | ||
| """ | ||
| A class that contains a list of transformations to apply to properties. | ||
| """ | ||
|
|
||
| configured_stream: ConfiguredAirbyteStream | ||
brianjlai marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| config: Config | ||
| parameters: InitVar[Mapping[str, Any]] | ||
| properties_transformations: List[RecordTransformation] = field(default_factory=lambda: []) | ||
|
|
||
| def __post_init__(self, parameters: Mapping[str, Any]) -> None: | ||
| self._parameters = parameters | ||
|
|
||
| def select(self) -> Set[str]: | ||
| properties = set() | ||
| for schema_property in self.configured_stream.stream.json_schema.get( | ||
| "properties", {} | ||
| ).keys(): | ||
| if self.properties_transformations: | ||
| for transformation in self.properties_transformations: | ||
| transformation.transform( | ||
| schema_property, # type: ignore # record has type Mapping[str, Any], but Dict[str, Any] expected | ||
brianjlai marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| config=self.config, | ||
| ) | ||
| properties.add(schema_property) | ||
| return properties | ||
brianjlai marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
airbyte_cdk/sources/declarative/requesters/query_properties/property_selector/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright (c) 2025 Airbyte, Inc., all rights reserved. | ||
|
|
||
| from airbyte_cdk.sources.declarative.requesters.query_properties.property_selector.json_schema_property_selector import ( | ||
| JsonSchemaPropertySelector, | ||
| ) | ||
| from airbyte_cdk.sources.declarative.requesters.query_properties.property_selector.property_selector import ( | ||
| PropertySelector, | ||
| ) | ||
|
|
||
| __all__ = ["JsonSchemaPropertySelector", "PropertySelector"] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.