From 2fbce7fed0f7a4aa5ff9403d87efb542fe528673 Mon Sep 17 00:00:00 2001 From: Thomas Boles Date: Tue, 5 Nov 2024 11:43:12 -0500 Subject: [PATCH] Updates config_change_callback to only pass config --- airbyte/_connector_base.py | 4 ++-- airbyte/destinations/base.py | 2 +- airbyte/destinations/util.py | 2 +- airbyte/sources/base.py | 2 +- airbyte/sources/util.py | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/airbyte/_connector_base.py b/airbyte/_connector_base.py index 71d6a075..deea63b5 100644 --- a/airbyte/_connector_base.py +++ b/airbyte/_connector_base.py @@ -56,7 +56,7 @@ def __init__( executor: Executor, name: str, config: dict[str, Any] | None = None, - config_change_callback: Callable[[dict[str, Any], int], None] | None = None, + config_change_callback: Callable[[dict[str, Any]], None] | None = None, *, validate: bool = False, ) -> None: @@ -388,7 +388,7 @@ def _peek_airbyte_message( and message.control.type == "CONNECTOR_CONFIG" and self.config_change_callback is not None ): - self.config_change_callback(message.control.config, message.control.emitted_at) + self.config_change_callback(message.control.config) return def _execute( diff --git a/airbyte/destinations/base.py b/airbyte/destinations/base.py index e5f41de5..1cb72efe 100644 --- a/airbyte/destinations/base.py +++ b/airbyte/destinations/base.py @@ -50,7 +50,7 @@ def __init__( executor: Executor, name: str, config: dict[str, Any] | None = None, - config_change_callback: Callable[[dict[str, Any], int], None] | None = None, + config_change_callback: Callable[[dict[str, Any]], None] | None = None, *, validate: bool = False, ) -> None: diff --git a/airbyte/destinations/util.py b/airbyte/destinations/util.py index 9f0cd89b..173d6215 100644 --- a/airbyte/destinations/util.py +++ b/airbyte/destinations/util.py @@ -20,7 +20,7 @@ def get_destination( name: str, config: dict[str, Any] | None = None, - config_change_callback: Callable[[dict[str, Any], int], None] | None = None, + config_change_callback: Callable[[dict[str, Any]], None] | None = None, *, version: str | None = None, pip_url: str | None = None, diff --git a/airbyte/sources/base.py b/airbyte/sources/base.py index 80bfd9d4..9913aeb3 100644 --- a/airbyte/sources/base.py +++ b/airbyte/sources/base.py @@ -58,7 +58,7 @@ def __init__( executor: Executor, name: str, config: dict[str, Any] | None = None, - config_change_callback: Callable[[dict[str, Any], int], None] | None = None, + config_change_callback: Callable[[dict[str, Any]], None] | None = None, streams: str | list[str] | None = None, *, validate: bool = False, diff --git a/airbyte/sources/util.py b/airbyte/sources/util.py index eafc3857..731cccaa 100644 --- a/airbyte/sources/util.py +++ b/airbyte/sources/util.py @@ -46,7 +46,7 @@ def get_connector( def get_source( # noqa: PLR0913 # Too many arguments name: str, config: dict[str, Any] | None = None, - config_change_callback: Callable[[dict[str, Any], int], None] | None = None, + config_change_callback: Callable[[dict[str, Any]], None] | None = None, *, streams: str | list[str] | None = None, version: str | None = None, @@ -74,6 +74,7 @@ def get_source( # noqa: PLR0913 # Too many arguments name: connector name config: connector config - if not provided, you need to set it later via the set_config method. + config_change_callback: callback function to be called when the connector config changes. streams: list of stream names to select for reading. If set to "*", all streams will be selected. If not provided, you can set it later via the `select_streams()` or `select_all_streams()` method.