#!/usr/bin/env python3 # -*- coding: utf-8 -*- from Interfaces.Application.CXCVInterface import CXCVInterface from Models.ResultsModel import ResultsModel from typing import Optional, Self, Any from abc import ABC, abstractmethod class DatabasesAbstract(ABC): def __init__(self:Self, cxcv:CXCVInterface, key:str, inputs:dict[str, Any|None]|list[Any|None]|tuple[Any|None, ...] ) -> None: self.cxcv:CXCVInterface = cxcv self.key:str = key self.type:str = "UNKNOWN" @abstractmethod def connect(self:Self) -> bool:pass @abstractmethod def close(self:Self) -> bool:pass @abstractmethod def execute(self:Self, sql:str, parameters:Optional[dict[str, Any|None]] = None ) -> ResultsModel:pass @abstractmethod def execute_file(self:Self, path:str, parameters:Optional[dict[str, Any|None]] = None ) -> ResultsModel:pass @abstractmethod def get_id(self:Self, query:str, parameters:Optional[dict[str, Any|None]] = None) -> int|None:pass @abstractmethod def get_last_id(self:Self) -> int|None:pass