Loading...

vastorbit.errors.MissingRelation

exception vastorbit.errors.MissingRelation

An exception raised when attempting to access or perform an operation on a relational data structure that is missing or not available. This error typically signifies the absence of the required dataset or data structure needed for the intended operation.

Examples

The following function checks for the existence of the input relation and raises an error if it does not exist.

from vastorbit._utils._sql._sys import _executeSQL
from vastorbit.errors import MissingRelation

def does_table_exists(table_name: str):

    query = f"SELECT * FROM columns WHERE table_name = '{table_name}';"
    result = _executeSQL(query, method="fetchall")
    assert result, MissingRelation(
        f"The relation '{table_name}' does not exist."
    )

Note

Errors can be employed when implementing new functions to provide clear explanations for why a particular option or feature is not functioning as intended. It is essential to review all available errors to choose the most appropriate one.