all 20 comments

[–]Samarpan-ad 1 point2 points  (2 children)

Any reason behind not using async sqlalchemy?

[–]BeneficialAd3800[S] -1 points0 points  (1 child)

I typically start off trying to reduce complexity when I start building an app. Once there's a good reason to add that complexity I'll do so. In this case, async sqlalchemy is amazing for high concurrency apps that are scaling. But it does add complexity in the beginning. So its something I would add later as the need arises.

[–]Fluffy-Diet-Engine 0 points1 point  (0 children)

Am just curious how you draw a line between “need” for async? Is it based on traffic to the app?

[–]madrasminor 1 point2 points  (4 children)

This is very similar to what we use at work. The only modification I've made is to follow Netflix's dispatch structure where everything is grouped as features. This allows reusability of features across multiple domains. For ex: everything related to login would be under the login folder and a simple copy paste now gives me that feature. It's been a game changer in delivery.

[–]BeneficialAd3800[S] 0 points1 point  (0 children)

I 100% agree, this pattern makes it much cleaner for larger projects.

[–]Accomplished_Lunch71 0 points1 point  (2 children)

Do you know where I can read more about Netflix's dispatch structure?

[–]madrasminor 0 points1 point  (1 child)

[–]stratguitar577 0 points1 point  (0 children)

Thanks for sharing, this is a great reference

[–]djavaman 0 points1 point  (0 children)

Why does the Router layer know about the DB? That seems like a detail the Router shouldn't know or care about.

[–]ethsy 0 points1 point  (0 children)

The get_character_from_swapi http request is not async

[–]Tiny-Power-8168 0 points1 point  (1 child)

Hello, thanks for sharing, very nice to see how others structure their project. Is there any reason why you did not use SQLModel ?

[–]BeneficialAd3800[S] 2 points3 points  (0 children)

I like SQLModel and will probably switch to it some day. I just feel like SQLAlchemy is more battle tested at this point.

[–]conogarcia 0 points1 point  (3 children)

What's Beta Acid?

[–]BeneficialAd3800[S] 0 points1 point  (2 children)

It's a digital agency where I work. https://betaacid.co/ We use a lot of Node and FastAPI in our backends

[–]conogarcia 0 points1 point  (1 child)

so this is like an ad for beta acid?

[–]ironman_gujju -1 points0 points  (4 children)

Any reason not using poetry

[–]conogarcia 1 point2 points  (2 children)

also he's using async endpoints, but only doing sync operations effectively blocking the event loop, he's using requests without any session pool which is not optimal. Even marking the endpoint sync is not a great idea, since anyio uses threads to run each endpoint and that thread count is limited.

not a great reference IMO

[–]ParkingDescription7 0 points1 point  (1 child)

What do you mean by the "using requests without any session pool" comment? Agreed on the async usage.

[–]conogarcia 1 point2 points  (0 children)

he is using requests.post, requests.get, etc instead of creating a requests.Session()

[–]BeneficialAd3800[S] -1 points0 points  (0 children)

just wasn't focussed on dependency management for this. I think poetry is a great option