Earlier quoted context omitted.
The author of FastApi wrote an ORM too: https://github.com/tiangolo/sqlmodel I have not yet used it, but I think that’s the best approach now
Whats the deal with they large number of open issues an pull requests on FastAPI and SQLModel? SQLModel 100 issues, 54 open PRs FastAPI 903 issues, 448(!!) open PRs I recently had to choose between Flask and FastAPI for a fresh project and went with Flask in the end, partly due to long term maintenance concerns with FastAPI.
Django Ninja – Fast Django REST Framework for Building APIs
11–20 of 35 posts
Re: Django Ninja – Fast Django REST Framework for Building APIs
#12Earlier quoted context omitted.
> Full support for Django and particularly it’s ORM (hard to do with FastAPI as the ORM is not yet async) I think you may have it backwards. Django's ORM isn't async yet [1], whereas FastAPI doesn't actually have an "included" ORM. However, the docs give an example of an async ORM [2], and SQLAlchemy also has async support [3]. --- [1] https://docs.djangoproject.com/en/4.0/topics/async/ : We’re still working on async…
No, sorry, did have it right but wasn't clear in my sentence: Full support for Django and particularly it’s ORM (hard to do with FastAPI as the Django ORM is not yet async and can’t be used with FastAPI ) Will edit to make clear.
Plans exist to make the Django Queryset async, so it’ll be exciting when that day comes!
Re: Django Ninja – Fast Django REST Framework for Building APIs
#13Earlier quoted context omitted.
If your needs are simple enough, built-in Django function-based views will do. When you outgrow those, DRF's complexity is often warranted.
But is DRFs complexity worth it compared to Ninja?
Re: Django Ninja – Fast Django REST Framework for Building APIs
#14Earlier quoted context omitted.
No, sorry, did have it right but wasn't clear in my sentence: Full support for Django and particularly it’s ORM (hard to do with FastAPI as the Django ORM is not yet async and can’t be used with FastAPI ) Will edit to make clear.
This isn’t exactly true. The Django ORM can be used with care in the async views found in FastAPI and Django (see sync_to_async and run_in_threadpool helpers). Plans exist to make the Django Queryset async, so it’ll be exciting when that day comes!
https://github.com/django/django/pull/14843
So far they are only going down the the queryset level, it then uses a thread pool for the db connector, next job would be to support async db connections.
Re: Django Ninja – Fast Django REST Framework for Building APIs
#15Re: Django Ninja – Fast Django REST Framework for Building APIs
#16Earlier quoted context omitted.
If your needs are simple enough, built-in Django function-based views will do. When you outgrow those, DRF's complexity is often warranted.
But is DRFs complexity worth it compared to Ninja?
Re: Django Ninja – Fast Django REST Framework for Building APIs
#17The approach for this I have taken lately is this: 1. A custom made serializer. This is the most complicated 150 lines of code in that it can traverse Django ORM objects/query sets and output them to JSON. It supports explicit included and excluded fields and included relationships which it automatically prefetches. 2. Custom middleware that parses any application/json request bodies in request.data . 3. I use Django…
Re: Django Ninja – Fast Django REST Framework for Building APIs
#18Earlier quoted context omitted.
The author of FastApi wrote an ORM too: https://github.com/tiangolo/sqlmodel I have not yet used it, but I think that’s the best approach now
Whats the deal with they large number of open issues an pull requests on FastAPI and SQLModel? SQLModel 100 issues, 54 open PRs FastAPI 903 issues, 448(!!) open PRs I recently had to choose between Flask and FastAPI for a fresh project and went with Flask in the end, partly due to long term maintenance concerns with FastAPI.
Re: Django Ninja – Fast Django REST Framework for Building APIs
#19Nice to have a simpler option than DRF which has grown into a quite complicated mound of code.
I'm excited to try this out, been looking at FastAPI.
Re: Django Ninja – Fast Django REST Framework for Building APIs
#20Nice to have a simpler option than DRF which has grown into a quite complicated mound of code.
If your needs are simple enough, built-in Django function-based views will do. When you outgrow those, DRF's complexity is often warranted.
This is the bit I find not really true.
My needs are simple (10-20 basic get/post/put/delete APIs, many at the business logic layer than true REST) but I still would really like the OpenAPI docs, auto-generated schema definitions, etc etc. If I can get that with just some simple decorators on my existing views and pydantic models for the inputs and outputs .... that would be awesome.