2024-07-27 15:39:09 +00:00
|
|
|
import abc
|
2024-08-14 05:21:36 +00:00
|
|
|
|
2024-07-27 15:39:09 +00:00
|
|
|
from .metadata import AbstractMetadataEngine
|
|
|
|
|
|
|
|
|
2024-08-07 09:39:33 +00:00
|
|
|
class AbstractRepository(abc.ABC):
|
2024-07-27 15:39:09 +00:00
|
|
|
metadata_engine = AbstractMetadataEngine
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
2024-08-14 05:21:36 +00:00
|
|
|
def schemas(self) -> list[str]:
|
|
|
|
"""List schemas"""
|
2024-07-27 15:39:09 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
2024-08-14 05:21:36 +00:00
|
|
|
def tables(self, schema) -> list[str]:
|
|
|
|
"""List table in schema"""
|
2024-07-27 15:39:09 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
2024-08-14 05:21:36 +00:00
|
|
|
def infos(self, table: str, schema: str) -> dict[str, str]:
|
|
|
|
"""Get infos about the table"""
|
2024-07-27 15:39:09 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
2024-08-14 05:21:36 +00:00
|
|
|
def read(self, table: str, schema: str):
|
|
|
|
"""Get content of the table"""
|
2024-07-27 15:39:09 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
2024-08-14 05:21:36 +00:00
|
|
|
def write(self, content, table: str, schema: str):
|
|
|
|
"""Write content into the table"""
|
2024-07-27 15:39:09 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
2024-08-14 05:21:36 +00:00
|
|
|
def delete_table(self, table: str, schema: str):
|
|
|
|
"""Delete the table"""
|
2024-07-27 15:39:09 +00:00
|
|
|
raise NotImplementedError
|