From 0a6cfaa95f3b716957a44db45098064ecfd1ab7f Mon Sep 17 00:00:00 2001 From: "Aaron (AJ) Steers" Date: Mon, 28 Aug 2023 15:50:18 +0000 Subject: [PATCH] chore: rename api_key setting --- .devcontainer/destination-duckdb/devcontainer.json | 12 ++++++++++-- .../destination_duckdb/destination.py | 12 +++++------- .../destination-duckdb/destination_duckdb/spec.json | 2 +- docs/integrations/destinations/duckdb.md | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.devcontainer/destination-duckdb/devcontainer.json b/.devcontainer/destination-duckdb/devcontainer.json index f78dad77cd47..107105d216f7 100644 --- a/.devcontainer/destination-duckdb/devcontainer.json +++ b/.devcontainer/destination-duckdb/devcontainer.json @@ -24,13 +24,21 @@ ], "settings": { "extensions.ignoreRecommendations": true, + "git.openRepositoryInParentFolders": "always", "python.defaultInterpreterPath": ".venv/bin/python", "python.interpreter.infoVisibility": "always", - "git.openRepositoryInParentFolders": "always", "python.terminal.activateEnvironment": true, + "python.testing.pytestEnabled": true, "python.testing.cwd": "/workspaces/airbyte/airbyte-integrations/connectors/destination-duckdb", "python.testing.pytestArgs": ["--rootdir=/workspaces/airbyte/airbyte-integrations/connectors/destination-duckdb", "."] } + }, + "codespaces": { + "repositories": { + "airbytehq/airbyte": { + "python.testing.pytestEnabled": true + } + } } }, "containerEnv": { @@ -43,7 +51,7 @@ // 2. Map the devcontainer.json file to it. // 3. Mark the root directory as 'safe' for git. // 4. Install the Python/Poetry dependencies. - "postCreateCommand": "mkdir -p ./.symlinks && ln -sf /workspaces/airbyte/.devcontainer/destination-duckdb/devcontainer.json ./.symlinks/devcontainer.json && git config --add safe.directory /workspaces/airbyte && poetry install" + "postCreateCommand": "mkdir -p ./.symlinks && ln -sf /workspaces/airbyte/docs/destinations/duckdb/devcontainer.json ./.symlinks/devcontainer.json && ln -sf /workspaces/airbyte/docs/integrations/destinations/duckdb.md ./.symlinks/duckdb-docs.md && git config --add safe.directory /workspaces/airbyte && poetry install" // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], diff --git a/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/destination.py b/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/destination.py index 9855aed92830..89a9567ff230 100644 --- a/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/destination.py +++ b/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/destination.py @@ -63,9 +63,9 @@ def write( path = self._get_destination_path(path) # Get and register auth token if applicable - api_key = str(config.get("api_key")) - if api_key: - os.environ["motherduck_token"] = api_key + motherduck_api_key = str(config.get("motherduck_api_key")) + if motherduck_api_key: + os.environ["motherduck_token"] = motherduck_api_key con = duckdb.connect(database=path, read_only=False) @@ -157,14 +157,12 @@ def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConn path = config.get("destination_path") path = self._get_destination_path(path) - api_key = config.get("api_key") - if path.startswith("/local"): logger.info(f"Using DuckDB file at {path}") os.makedirs(os.path.dirname(path), exist_ok=True) - if "api_key" in config: - os.environ["motherduck_token"] = config["api_key"] + if "motherduck_api_key" in config: + os.environ["motherduck_token"] = config["motherduck_api_key"] con = duckdb.connect(database=path, read_only=False) con.execute("SELECT 1;") diff --git a/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/spec.json b/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/spec.json index edc2270e4d55..f59e2dc8f538 100644 --- a/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/spec.json +++ b/airbyte-integrations/connectors/destination-duckdb/destination_duckdb/spec.json @@ -11,7 +11,7 @@ "required": ["destination_path"], "additionalProperties": true, "properties": { - "api_key": { + "motherduck_api_key": { "type": "string", "description": "API key to use for authentication to a MotherDuck database.", "writeOnly": true diff --git a/docs/integrations/destinations/duckdb.md b/docs/integrations/destinations/duckdb.md index 47baa6e75b48..03faaf8497c8 100644 --- a/docs/integrations/destinations/duckdb.md +++ b/docs/integrations/destinations/duckdb.md @@ -22,7 +22,7 @@ To specify a MotherDuck-hosted database as your destination, simply provide your ### Authenticating to MotherDuck -For authentication, you can can provide your [MotherDuck Service Credential](https://motherduck.com/docs/authenticating-to-motherduck/#syntax) as the `api_key` configuration option. +For authentication, you can can provide your [MotherDuck Service Credential](https://motherduck.com/docs/authenticating-to-motherduck/#syntax) as the `motherduck_api_key` configuration option. ### Sync Overview