sqlmesh.utils.errors API documentation

Edit on GitHub

# sqlmesh.utils.errors

View Source

     1from __future__ import annotations
     2
     3import typing as t
     4from enum import auto
     5from pathlib import Path
     6
     7from sqlglot.helper import AutoName
     8
     9
    10class ErrorLevel(AutoName):
    11    IGNORE = auto()
    12    WARN = auto()
    13    RAISE = auto()
    14
    15
    16class SQLMeshError(Exception):
    17    pass
    18
    19
    20class ConfigError(SQLMeshError):
    21    pass
    22
    23
    24class MissingDependencyError(SQLMeshError):
    25    """Local environment is missing a required dependency for the given operation"""
    26
    27
    28class MacroEvalError(SQLMeshError):
    29    pass
    30
    31
    32class PlanError(SQLMeshError):
    33    pass
    34
    35
    36class MissingContextException(Exception):
    37    pass
    38
    39
    40class SnapshotVersionError(SQLMeshError):
    41    pass
    42
    43
    44class MagicError(SQLMeshError):
    45    pass
    46
    47
    48class AuditConfigError(ConfigError):
    49    pass
    50
    51
    52class AuditError(SQLMeshError):
    53    pass
    54
    55
    56class NotificationTargetError(SQLMeshError):
    57    pass
    58
    59
    60class ApiError(SQLMeshError):
    61    pass
    62
    63
    64class ApiClientError(ApiError):
    65    pass
    66
    67
    68class ApiServerError(ApiError):
    69    pass
    70
    71
    72class NotFoundError(ApiClientError):
    73    pass
    74
    75
    76def raise_config_error(
    77    msg: str,
    78    location: t.Optional[str | Path] = None,
    79    error_type: t.Type[ConfigError] = ConfigError,
    80) -> None:
    81    if location:
    82        raise error_type(f"{msg} at '{location}'")
    83    raise error_type(msg)

class ErrorLevel(sqlglot.helper.AutoName): View Source

    11class ErrorLevel(AutoName):
    12    IGNORE = auto()
    13    WARN = auto()
    14    RAISE = auto()

An enumeration.

IGNORE = <ErrorLevel.IGNORE: 'IGNORE'>
WARN = <ErrorLevel.WARN: 'WARN'>
RAISE = <ErrorLevel.RAISE: 'RAISE'>

##### Inherited Members

enum.Enum
  name
  value

class SQLMeshError(builtins.Exception): View Source

    17class SQLMeshError(Exception):
    18    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class ConfigError(SQLMeshError): View Source

    21class ConfigError(SQLMeshError):
    22    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class MissingDependencyError(SQLMeshError): View Source

    25class MissingDependencyError(SQLMeshError):
    26    """Local environment is missing a required dependency for the given operation"""

Local environment is missing a required dependency for the given operation

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class MacroEvalError(SQLMeshError): View Source

    29class MacroEvalError(SQLMeshError):
    30    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class PlanError(SQLMeshError): View Source

    33class PlanError(SQLMeshError):
    34    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class MissingContextException(builtins.Exception): View Source

    37class MissingContextException(Exception):
    38    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class SnapshotVersionError(SQLMeshError): View Source

    41class SnapshotVersionError(SQLMeshError):
    42    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class MagicError(SQLMeshError): View Source

    45class MagicError(SQLMeshError):
    46    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class AuditConfigError(ConfigError): View Source

    49class AuditConfigError(ConfigError):
    50    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class AuditError(SQLMeshError): View Source

    53class AuditError(SQLMeshError):
    54    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class NotificationTargetError(SQLMeshError): View Source

    57class NotificationTargetError(SQLMeshError):
    58    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class ApiError(SQLMeshError): View Source

    61class ApiError(SQLMeshError):
    62    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class ApiClientError(ApiError): View Source

    65class ApiClientError(ApiError):
    66    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class ApiServerError(ApiError): View Source

    69class ApiServerError(ApiError):
    70    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

class NotFoundError(ApiClientError): View Source

    73class NotFoundError(ApiClientError):
    74    pass

Common base class for all non-exit exceptions.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback

def raise_config_error( msg: str, location: Union[str, pathlib.Path, NoneType] = None, error_type: Type[sqlmesh.utils.errors.ConfigError] = <class 'sqlmesh.utils.errors.ConfigError'>) -> None: View Source

    77def raise_config_error(
    78    msg: str,
    79    location: t.Optional[str | Path] = None,
    80    error_type: t.Type[ConfigError] = ConfigError,
    81) -> None:
    82    if location:
    83        raise error_type(f"{msg} at '{location}'")
    84    raise error_type(msg)