From 90d78f76c0615444b769b64c60a0753dd6cb1c57 Mon Sep 17 00:00:00 2001 From: AJ Steers Date: Mon, 18 Mar 2024 12:59:56 -0700 Subject: [PATCH] use windows-style separator if needed --- airbyte/caches/duckdb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/airbyte/caches/duckdb.py b/airbyte/caches/duckdb.py index 5ed2abc2..1bbaf550 100644 --- a/airbyte/caches/duckdb.py +++ b/airbyte/caches/duckdb.py @@ -20,6 +20,7 @@ from typing import Union from overrides import overrides +from typing_extensions import Literal from airbyte._processors.sql.duckdb import DuckDBSqlProcessor from airbyte.caches.base import CacheBase @@ -60,5 +61,8 @@ def get_database_name(self) -> str: if self.db_path == ":memory:": return "memory" + # Split the path on the appropriate separator ("/" or "\") + split_on: Literal["/", "\\"] = "\\" if "\\" in str(self.db_path) else "/" + # Return the file name without the extension - return str(self.db_path).split("/")[-1].split(".")[0] + return str(self.db_path).split(sep=split_on)[-1].split(".")[0]