plesna/dashboard/libs/repository/repository.py

38 lines
1004 B
Python
Raw Normal View History

2024-07-27 15:39:09 +00:00
import abc
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
def schemas(self) -> list[str]:
"""List schemas"""
2024-07-27 15:39:09 +00:00
raise NotImplementedError
@abc.abstractmethod
def tables(self, schema) -> list[str]:
"""List table in schema"""
2024-07-27 15:39:09 +00:00
raise NotImplementedError
@abc.abstractmethod
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
def read(self, table: str, schema: str):
"""Get content of the table"""
2024-07-27 15:39:09 +00:00
raise NotImplementedError
@abc.abstractmethod
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
def delete_table(self, table: str, schema: str):
"""Delete the table"""
2024-07-27 15:39:09 +00:00
raise NotImplementedError