Skip to content

Commit 41329e0

Browse files
refactor: Simplify helper function and update schema description per review feedback
Co-Authored-By: unknown <>
1 parent cdeed60 commit 41329e0

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

airbyte_cdk/legacy/sources/declarative/manifest_declarative_source.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,9 @@ def _initialize_cache_for_parent_streams(
350350
"""
351351
parent_streams = set()
352352

353-
def _should_enable_cache(requester: Dict[str, Any]) -> bool:
354-
"""Return False only if use_cache is explicitly set to False."""
355-
return requester.get("use_cache") is not False
356-
357353
def _set_cache_if_not_disabled(requester: Dict[str, Any]) -> None:
358354
"""Set use_cache to True only if not explicitly disabled."""
359-
if _should_enable_cache(requester):
355+
if requester.get("use_cache") is not False:
360356
requester["use_cache"] = True
361357

362358
def update_with_cache_parent_configs(

airbyte_cdk/sources/declarative/concurrent_declarative_source.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,9 @@ def _initialize_cache_for_parent_streams(
433433
"""
434434
parent_streams = set()
435435

436-
def _should_enable_cache(requester: Dict[str, Any]) -> bool:
437-
"""Return False only if use_cache is explicitly set to False."""
438-
return requester.get("use_cache") is not False
439-
440436
def _set_cache_if_not_disabled(requester: Dict[str, Any]) -> None:
441437
"""Set use_cache to True only if not explicitly disabled."""
442-
if _should_enable_cache(requester):
438+
if requester.get("use_cache") is not False:
443439
requester["use_cache"] = True
444440

445441
def update_with_cache_parent_configs(

airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ definitions:
22862286
- "$ref": "#/definitions/CustomErrorHandler"
22872287
use_cache:
22882288
title: Use Cache
2289-
description: Enables stream requests caching. This field is automatically set by the CDK.
2289+
description: Enables stream requests caching. When set to true, repeated requests to the same URL will return cached responses. Parent streams automatically have caching enabled. Only set this to false if you are certain that caching should be disabled, as it may negatively impact performance when the same data is needed multiple times (e.g., for scroll-based pagination APIs where caching causes duplicate records).
22902290
type: boolean
22912291
default: false
22922292
$parameters:

0 commit comments

Comments
 (0)