文章内容

2020/11/10 18:08:06,作 者: 黄兵

SQLAlchemy BigInteger与BIGINT区别

BigInteger定义:

class BigInteger(Integer):

    """A type for bigger ``int`` integers.

    Typically generates a ``BIGINT`` in DDL, and otherwise acts like
    a normal :class:`.Integer` on the Python side.

    """

    __visit_name__ = 'big_integer'

BIGINT定义:

class BIGINT(BigInteger):

    """The SQL BIGINT type."""

    __visit_name__ = 'BIGINT'

BigIntegerBIGINT有什么区别呢?

BIGINT必须从特定的方言中导入,使用BigInteger由sqlalchemy自动处理映射,这取决于您所使用的数据库。

因此在数据库改变的时候,使用BigInteger可以避免潜在的一些问题,存在的这些问题都由sqlalchemy自动处理。

参考资料:

1、What's the difference between BIGINT and BigInteger in SQLAlchemy?

分享到:

发表评论

评论列表