awtkns / fastapi-crudrouter

A dynamic FastAPI router that automatically creates CRUD routes for your models
https://fastapi-crudrouter.awtkns.com
MIT License
1.4k stars 155 forks source link

[FEAT] Tortoise orm support #15

Closed awtkns closed 3 years ago

timwford commented 3 years ago

What does this look like in your eyes? I have a pipeline setup that auto generates schemas from tortoise ORM. Wouldn't you want to just use the schemas from that?

awtkns commented 3 years ago

I haven't used Tortoise much before but I imagine it would be very similar to the way it is used with SQLAclchemy.

So something like this:

from fastapi_crudrouter import TortoiseCRUDRouter

ormModel = # ... Tortoise ORM model
pydanticOrmModel = # ... The pydantic model for the above tortoise model

router = TortoiseCRUDRouter(model=ormModel, schema=pydanticOrmModel)

Thoughts?

timwford commented 3 years ago

I like it. I'd work on this if there wasn't an incredibly tight timeline you'd be looking for it.

awtkns commented 3 years ago

Awesome! It should be pretty easy. The actual implementation could closely follow this.