We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
序列化反序列化很好用的一个库,不过本人最近在用sqlalchemy2.x,类的属性反序列化会报错
from datetime import datetime from objtyping import objtyping from sqlalchemy import Integer, String, VARCHAR, DateTime from sqlalchemy.orm import DeclarativeBase from sqlalchemy.orm import Mapped, mapped_column class Base(DeclarativeBase): pass class Area(Base): __tablename__ = 'area' id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True, nullable=False) code: Mapped[str] = mapped_column(String(12), nullable=False) name: Mapped[str] = mapped_column(VARCHAR(15), nullable=False) level: Mapped[int] = mapped_column(Integer, nullable=False) pcode: Mapped[str] = mapped_column(String(12), nullable=False) create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False) update_time: Mapped[datetime] = mapped_column(DateTime, onupdate=datetime.now) def __str__(self): return self.name __repr__ = __str__ if __name__ == '__main__': area = Area(id=1, code='213123131', name='里斯', level=1, pcode='1212313131') s = objtyping.to_primitive(area) print(s) print(objtyping.from_primitive(s, Area))
会将数据库字段判断为sqlalchemy.orm.MappedColumn类型,但实际值为基本类型
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
No branches or pull requests
序列化反序列化很好用的一个库,不过本人最近在用sqlalchemy2.x,类的属性反序列化会报错
会将数据库字段判断为sqlalchemy.orm.MappedColumn类型,但实际值为基本类型
The text was updated successfully, but these errors were encountered: