py-sa2schema:将SqlAlchemy模型转换为Pydantic模型

时间:2021-05-24 22:45:06
【文件属性】:
文件名称:py-sa2schema:将SqlAlchemy模型转换为Pydantic模型
文件大小:65KB
文件格式:ZIP
更新时间:2021-05-24 22:45:06
Python SQLAlchemy模型到Pydantic模型的转换器 sa2schema是SqlAlchemy到Pydantic的桥梁,将来可能会支持其他架构。 金字塔转换器 使用sa2schema.to.pydantic包,可以将SqlAlchemy模型转换为Pydantic模型。 $ pip install sa2schema ... :smiling_face_with_smiling_eyes: 列示例 让我们从一个基本示例开始:一个User模型将成为Pydantic模型的真实来源: # models.py from sqlalchemy import Column , Integer , String from sqlalchemy . ext . declarative import declarative_base import pydantic as v # SqlAlchemy models Base = declarative_base
【文件预览】:
py-sa2schema-master
----.github()
--------workflows()
----.envrc(461B)
----build-wheels.sh(995B)
----noxfile.py(1KB)
----LICENSE(1KB)
----sa2schema()
--------stubgen.py(5KB)
--------util.py(892B)
--------compat.py(464B)
--------pluck.py(6KB)
--------annotations.py(951B)
--------info()
--------__init__.py(839B)
--------to()
----README.md(8KB)
----tests()
--------db.py(693B)
--------test_stubgen.py(2KB)
--------__init__.py(0B)
--------models.py(7KB)
--------lib.py(632B)
--------test_README.py(8KB)
--------test_pluck.py(4KB)
--------conftest.py(376B)
--------test_sa_to_pydantic.py(46KB)
--------test_sa_extract_info.py(29KB)
--------test_filters.py(3KB)
----.gitignore(592B)
----pyproject.toml(792B)
----CHANGELOG.md(404B)
----build.py(1KB)

网友评论