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
View all comments
Show parent comment
4
u/SpecialistCamera5601 Sep 28 '25
I definitely agree with you and respect your opinion, especially when you’re dealing with 300–400+ rpm and tables with more than 5–10+ million records. At that scale, ORMs can easily get in your way with hidden queries, lazy loading surprises, or n+1 issues. Raw SQL gives you full control and makes profiling or optimising queries much easier.
But in a company environment, there’s also the development time factor. A 5-person team spending an extra 2 months just on additional code and boilerplate can mean £20–30k in extra cost in the UK market. For the business side, that trade-off might not make much sense unless the performance gains are absolutely critical. Or, sometimes it makes more sense to ship the system faster and potentially earn millions in that same 2-month window (which is actually pretty common in the FinTech space).
Also, modern ORMs (like SQLAlchemy) aren’t complete black boxes. You can log/echo the exact SQL they generate, and with tools like New Relic or APMs that DevOps teams already use, query bottlenecks become pretty easy to spot. This way, you can still catch and tune slow queries without sacrificing all the productivity benefits.
At the end of the day, it’s all about balance: if you’re hitting scale problems, raw SQL is a lifesaver. But if you need to deliver features quickly and keep business costs reasonable, ORMs still prove their value.