SQLAlchemy.exc部分錯誤總結

文章目錄

class ArgumentError(SQLAlchemyError):
    """
    原文:
    Raised when an invalid or conflicting function argument is supplied.
    This error generally corresponds to construction time state errors.
    提供無效或衝突的函數參數時引發。
    此錯誤通常與施工時間狀態錯誤相對應。

    實踐:
    常見於創建實例的時候,參數傳遞不對索引發,如:非空字段,外鍵等
    """

class ObjectNotExecutableError(ArgumentError):   # 對象不可執行錯誤
    """
    Raised when an object is passed to .execute() that can't be executed as SQL.
    當對象傳遞給.execute()時引發作爲SQL執行。
    """

class NoSuchModuleError(ArgumentError):   # 沒有這樣的模塊
    """
    Raised when a dynamically-loaded module (usually a database dialect)
    of a particular name cannot be located.

    當動態加載模塊(通常是數據庫方言)時引發無法找到特定名稱的。
    """

class NoForeignKeysError(ArgumentError):   # 沒有外鍵
    """
    Raised when no foreign keys can be located between two selectables
    during a join.
    當兩個可選擇項之間沒有外鍵時引發在加入時。
    """

class AmbiguousForeignKeysError(ArgumentError):   # 外鍵混亂
    """
    Raised when more than one foreign key matching can be located
    between two selectables during a join.

    當可以找到多個外鍵匹配時引發在連接期間在兩個可選擇項之間。
    """

class IdentifierError(SQLAlchemyError):  # 標識符錯誤
    """
    Raised when a schema name is beyond the max character limit
    當架構名稱超過最大字符限制時引發
    """

class TimeoutError(SQLAlchemyError):  # 超時
    """Raised when a connection pool times out on getting a connection."""


class InvalidRequestError(SQLAlchemyError):   # 無效請求
    """SQLAlchemy was asked to do something it can't do.

    This error generally corresponds to runtime state errors.

    SQLAlchemy被要求做一些它不能做的事情。此錯誤通常對應於運行時狀態錯誤。
    """

class ResourceClosedError(InvalidRequestError):
    """An operation was requested from a connection, cursor, or other
    object that's in a closed state.
    從連接、遊標或其他對象請求操作處於關閉狀態的對象。
    """

class NoSuchColumnError(KeyError, InvalidRequestError):
    """A nonexistent column is requested from a ``RowProxy``."""


class NoSuchTableError(InvalidRequestError):
    """Table does not exist or is not visible to a connection."""

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章