Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.

import threading
from dataclasses import InitVar, dataclass
from typing import Any, Iterable, List, Mapping, Optional

import dpath

from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
from airbyte_cdk.sources.declarative.retrievers import Retriever
from airbyte_cdk.sources.types import Config, StreamSlice
from airbyte_cdk.sources.types import Config


@dataclass
Expand All @@ -25,19 +25,22 @@ class PropertiesFromEndpoint:
_cached_properties: Optional[List[str]] = None

def __post_init__(self, parameters: Mapping[str, Any]) -> None:
self._lock = threading.RLock()
self._property_field_path = [
InterpolatedString(string=property_field, parameters=parameters)
for property_field in self.property_field_path
]

def get_properties_from_endpoint(self) -> List[str]:
if self._cached_properties is None:
self._cached_properties = list(
map(
self._get_property, # type: ignore # SimpleRetriever and AsyncRetriever only returns Record. Should we change the return type of Retriever.read_records?
self.retriever.read_records(records_schema={}, stream_slice=None),
)
)
with self._lock:
if self._cached_properties is None:
self._cached_properties = list(
map(
self._get_property, # type: ignore # SimpleRetriever and AsyncRetriever only returns Record. Should we change the return type of Retriever.read_records?
self.retriever.read_records(records_schema={}, stream_slice=None),
)
)
return self._cached_properties

def _get_property(self, property_obj: Mapping[str, Any]) -> str:
Expand Down
Loading