-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2e8f0b
commit b7a127e
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""A cache implementation for the MotherDuck service, built on DuckDB.""" | ||
from __future__ import annotations | ||
|
||
from overrides import overrides | ||
|
||
from airbyte.caches.duckdb import DuckDBCacheBase, DuckDBCacheConfig | ||
|
||
|
||
class MotherDuckCacheConfig(DuckDBCacheConfig): | ||
"""Configuration for the MotherDuck cache.""" | ||
|
||
db_path = "md:" | ||
database: str | ||
api_key: str | ||
|
||
@overrides | ||
def get_sql_alchemy_url(self) -> str: | ||
"""Return the SQLAlchemy URL to use.""" | ||
# return f"duckdb:///{self.db_path}?schema={self.schema_name}" | ||
return f"duckdb:///md:{self.api_key}@{self.database}" | ||
|
||
@overrides | ||
def get_database_name(self) -> str: | ||
"""Return the name of the database.""" | ||
return self.database | ||
|
||
|
||
class MotherDuckCache(DuckDBCacheBase): | ||
"""A cache implementation for the MotherDuck service, built on DuckDB.""" | ||
|
||
config_class = MotherDuckCacheConfig |