This file contains hidden or 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
import sqlite3 | |
from sqlite3 import OperationalError | |
from typing import Union, Literal | |
# typings | |
REPR_UNION = Union[Literal["string"], Literal["list"], None] | |
QUERY_UNION = Union[None, list[tuple[str]], str, list[str]] | |
class SqlQueryWrapper: |
This file contains hidden or 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
from importlib.util import spec_from_file_location, module_from_spec | |
from os import path | |
def get_function_from_modulepath(function_name: str, module_path:str): | |
"""Returns a function with provided name object from provided module / python file path""" | |
if(not path.exists(module_path)): | |
raise FileNotFoundError(f"No module exists at path ${module_path}") | |
if(not path.isfile(module_path)): | |
raise FileNotFoundError(f"Target at path ${module_path} is not a file") |