Skip to content

Commit

Permalink
refactor: update remaining component in model factory
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristoGrab committed Jan 30, 2025
1 parent 97bf0cb commit c4c3df1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def create_api_key_authenticator(
parameters=model.parameters or {},
)
)

return ApiKeyAuthenticator(
token_provider=(
token_provider
Expand Down Expand Up @@ -1272,7 +1272,6 @@ def create_datetime_based_cursor(
self._create_component_from_model(model.end_time_option, config)
if model.end_time_option
else None

)
start_time_option = (
self._create_component_from_model(model.start_time_option, config)
Expand Down Expand Up @@ -1348,20 +1347,12 @@ def create_declarative_stream(
cursor_model = model.incremental_sync

end_time_option = (
RequestOption(
inject_into=RequestOptionType(cursor_model.end_time_option.inject_into.value),
field_name=cursor_model.end_time_option.field_name,
parameters=cursor_model.parameters or {},
)
self._create_component_from_model(cursor_model.end_time_option, config)
if cursor_model.end_time_option
else None
)
start_time_option = (
RequestOption(
inject_into=RequestOptionType(cursor_model.start_time_option.inject_into.value),
field_name=cursor_model.start_time_option.field_name,
parameters=cursor_model.parameters or {},
)
self._create_component_from_model(cursor_model.start_time_option, config)
if cursor_model.start_time_option
else None
)
Expand Down Expand Up @@ -1870,8 +1861,7 @@ def create_jwt_authenticator(
)

def create_list_partition_router(
self,
model: ListPartitionRouterModel, config: Config, **kwargs: Any
self, model: ListPartitionRouterModel, config: Config, **kwargs: Any
) -> ListPartitionRouter:
request_option = (
self._create_component_from_model(model.request_option, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RequestOption:
parameters: InitVar[Mapping[str, Any]]
field_name: Optional[Union[InterpolatedString, str]] = None
field_path: Optional[List[Union[InterpolatedString, str]]] = None

def __post_init__(self, parameters: Mapping[str, Any]) -> None:
# Validate inputs. We should expect either field_name or field_path, but not both
if self.field_name is None and self.field_path is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
import datetime
from typing import Any, Iterable, Mapping

import logging

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

import freezegun
import pendulum
import pytest
Expand Down Expand Up @@ -612,11 +607,6 @@ def test_list_based_stream_slicer_with_values_defined_in_config():
component_definition=partition_router_manifest,
config=input_config,
)

logger.info(f"Raw manifest: {content}")
logger.info(f"Parsed manifest: {parsed_manifest}")
logger.info(f"Resolved manifest: {resolved_manifest}")
logger.info(f"Transformed manifest: {partition_router_manifest}")

assert isinstance(partition_router, ListPartitionRouter)
assert partition_router.values == ["airbyte", "airbyte-cloud"]
Expand All @@ -626,7 +616,6 @@ def test_list_based_stream_slicer_with_values_defined_in_config():
assert len(partition_router.request_option.field_path) == 2



def test_create_substream_partition_router():
content = """
schema_loader:
Expand Down

0 comments on commit c4c3df1

Please sign in to comment.