Closed wangwangwar closed 7 years ago
UUID ref 1,ref 3, 如果UUID不带参数, 直接注意如果直接插入uuid格式的数据, 会出错. 必须UUID(as_uuid=True), 会自动转换.
from sqlalchemy.dialects.postgresql import UUID import uuid class User(Base): __tablename__ = 'users' id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid1) name = Column(String(10), nullable=False) def __repr__(self): return "<User '%s'>" % self.name
与GUID ref 2, GUID做了兼容.
UUID ref 1,ref 3, 如果UUID不带参数, 直接注意如果直接插入uuid格式的数据, 会出错. 必须UUID(as_uuid=True), 会自动转换.
与GUID ref 2, GUID做了兼容.