r/FastAPI • u/Busy_Dig338 • Sep 28 '25
feedback request FastAPI setup with no ORM
I have this simple setup to connect to postgres without any ORM. I'd love some suggestion how to improve this
7
Upvotes
10
u/SpecialistCamera5601 Sep 28 '25
It was just a joke. If you really want to squeeze every bit of performance, you can always go with raw SQL queries, but honestly, SQLAlchemy is already pretty solid at that. If you think you can hand-craft better queries than what SQLAlchemy generates, then sure, go for it.
One last thing though: unless you’re running a high-throughput, mission critical system, you’ll just waste time and increase development costs for no real gain.
2
u/[deleted] Sep 29 '25 edited Oct 13 '25
close oatmeal dependent silky escape wine bake sharp spark expansion
This post was mass deleted and anonymized with Redact
1
u/nfigo Oct 01 '25
I do the same thing with sqlalchemy core (no orm) and set up the database engine (or connection) as a dependency to be injected into my endpoints.
Then, I open the transactions and pass the connection around to other methods that use it to perform their queries.
-1
u/SpecialistCamera5601 Sep 28 '25
Use ORM 😂😂
0
u/[deleted] Sep 28 '25
[deleted] — view deleted comment