datamodel-code-generator
sqlmodel
Our great sponsors
datamodel-code-generator | sqlmodel | |
---|---|---|
9 | 23 | |
2,273 | 12,831 | |
- | - | |
9.4 | 8.6 | |
6 days ago | 8 days ago | |
Python | Python | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
datamodel-code-generator
-
tRPC – Move Fast and Break Nothing. End-to-end typesafe APIs made easy
Like generating pydantic models or dataclasses for an OpenAPI schema? I haven't needed to go in that direction myself, but this[0] looks promising!
Apologies if I've misunderstood your comment
-
OpenAPI v4 Proposal
I'm sorry, but you have completely misunderstood the purpose of Open API.
It is not a specification to define your business logic classes and objects -- either client or server side. Its goal is to define the interface of an API, and to provide a single source of truth that requests and responses can be validated against. It contains everything you need to know to make requests to an API; code generation is nice to have (and I use it myself, but mainly on the server side, for routing and validation), but not something required or expected from OpenAPI
For what it's worth, my personal preferred workflow to build an API is as follows:
1. Build the OpenAPI spec first. A smaller spec could easily be done by hand, but I prefer using a design tool like Stoplight [0]; it has the best Web-based OpenAPI (and JSON Schema) editor I have encountered, and integrates with git nearly flawlessly.
2. Use an automated tool to generate the API code implementation. Again, a static generation tool such as datamodel-code-generator [1] (which generates Pydantic models) would suffice, but for Python I prefer the dynamic request routing and validation provided by pyapi-server [2].
3. Finally, I use automated testing tools such as schemathesis [3] to test the implementation against the specification.
[1] https://koxudaxi.github.io/datamodel-code-generator/
-
Create Pydantic datamodel from huge JSON file with local datamodel-code-generator
The site also provide a link to the github repo of the underlying program.
-
PSA: I think this JSON to Pydantic converter is extremely useful for boilerplate model creation
Not sure who owns/hosts the site, but its based on this github repo.
-
My top python library
That's what datamodel-code-generator propose.
-
I use attrs instead of pydantic
had generally good experience creating typed wrappers for api's with json-schema-to-pydantic[0] converter
sqlmodel
-
I wrote okjson - A fast, simple, and pythonic JSON Schema Validator
I had a requirement to process and validate large payloads of JSON concurrently for a web service, initially I implemented it using jsonschema and fastjsonschema but I found the whole JSON Schema Specification to be confusing at times and on top of that wanted better performance. Albeit there are ways to compile/cache the schema, I wanted to move away from the schema specification so I wrote a validation library inspired by the design of tiangolo/sqlmodel (type hints) to solve this problem easier.
- Django Ninja – Fast Django REST Framework for Building APIs
-
Trending Python Projects of the Week
Github Repository
-
The hand-picked selection of the best Python libraries released in 2021
SQLModel.
-
If you managed the Django project, what would you focus on in the next 12 months?
Have you seen SQLModel? It dropped two weeks ago.
- SQLModel: SQL DBs based on Python type hints. The biggest thing I've built since FastAPI and Typer. 😅
-
SQLModel – SQL Databases in FastAPI
This bit looks like async support: https://github.com/tiangolo/sqlmodel/blob/0.0.3/sqlmodel/ext...
What are some alternatives?
pydantic-sqlalchemy - Tools to convert SQLAlchemy models to Pydantic models
pydantic - Data validation using Python type hints
SQLAlchemy - The Database Toolkit for Python
ormar - python async orm with fastapi in mind and pydantic validation
geojson-pydantic - Pydantic data models for the GeoJSON spec
sqlalchemy-hana - SQLAlchemy Dialect for SAP HANA
sqlalchemy-filters-plus - Lightweight library for providing filtering mechanism for your APIs using SQLAlchemy
pydantic-factories - Simple and powerful mock data generation using pydantic or dataclasses
fastapi - FastAPI framework, high performance, easy to learn, fast to code, ready for production
sqlite-utils - Python CLI utility and library for manipulating SQLite databases
FastAPIQuickCRUD - Generate CRUD methods in FastApi from an SQLAlchemy schema