Skip to content

Exceptions

deep_db_agents.exceptions

Exceptions raised by the deep-db-agents library.

DeepDbAgentError

Bases: Exception

Base class for all exceptions raised by the library.

GuardrailError

Bases: DeepDbAgentError

A hard guardrail blocked execution (e.g. EXPLAIN threshold or budget exceeded).

InvalidDbUrlError

Bases: DeepDbAgentError

The database URL is not in the <scheme>://<host>:<port> format.

InvalidMultiAgentConfigError

Bases: DeepDbAgentError

The db_agents configuration for the multi-database orchestrator is invalid.

QueryNotAllowedError

Bases: DeepDbAgentError

The query violates the whitelist of allowed operations (e.g. it is not a SELECT).

UnsupportedSchemeError

UnsupportedSchemeError(scheme: str, available: list[str])

Bases: DeepDbAgentError

No dialect is registered for the requested scheme.

Initialize the error with the offending scheme and the available ones.

Parameters:

Name Type Description Default
scheme str

The unsupported URL scheme that was requested.

required
available list[str]

The list of currently registered schemes.

required
Source code in src/deep_db_agents/exceptions.py
17
18
19
20
21
22
23
24
25
26
27
28
29
def __init__(self, scheme: str, available: list[str]):
    """Initialize the error with the offending scheme and the available ones.

    Args:
        scheme: The unsupported URL scheme that was requested.
        available: The list of currently registered schemes.
    """
    self.scheme = scheme
    self.available = available
    super().__init__(
        f"Unsupported database scheme: {scheme!r}. "
        f"Available schemes: {', '.join(sorted(available)) or '(none)'}."
    )