Skip to content

base_sql_driver

BaseSqlDriver

Bases: ABC

Source code in griptape/drivers/sql/base_sql_driver.py
@define
class BaseSqlDriver(ABC):
    @dataclass
    class RowResult:
        cells: dict[str, Any]

    @abstractmethod
    def execute_query(self, query: str) -> Optional[list[RowResult]]: ...

    @abstractmethod
    def execute_query_raw(self, query: str) -> Optional[list[dict[str, Any]]]: ...

    @abstractmethod
    def get_table_schema(self, table_name: str, schema: Optional[str] = None) -> Optional[str]: ...

RowResult dataclass

Source code in griptape/drivers/sql/base_sql_driver.py
@dataclass
class RowResult:
    cells: dict[str, Any]
cells: dict[str, Any] instance-attribute
__init__(cells)

execute_query(query) abstractmethod

Source code in griptape/drivers/sql/base_sql_driver.py
@abstractmethod
def execute_query(self, query: str) -> Optional[list[RowResult]]: ...

execute_query_raw(query) abstractmethod

Source code in griptape/drivers/sql/base_sql_driver.py
@abstractmethod
def execute_query_raw(self, query: str) -> Optional[list[dict[str, Any]]]: ...

get_table_schema(table_name, schema=None) abstractmethod

Source code in griptape/drivers/sql/base_sql_driver.py
@abstractmethod
def get_table_schema(self, table_name: str, schema: Optional[str] = None) -> Optional[str]: ...