s3rius / FastAPI-template

Feature rich robust FastAPI template.
MIT License
1.99k stars 173 forks source link

Use async url for Ormar ORM #67

Closed sorasful closed 2 years ago

sorasful commented 2 years ago

Hello,

While looking at the template here :

I noticed that for SqlAlchemy we use async scheme ("postgresql+asyncpg" ) but not for Ormar, is there a reason or it's just missing the template ?

Thanks !

s3rius commented 2 years ago

Hi. Thanks for creating an issue. This is not a mistake. This async scheme is SQLAlchemy-specific. We don't need to use it with tortoise or ormar.

sorasful commented 2 years ago

Thanks for the quick answer, do you mind elaborate why we don't need it for tortoise and ormar ?

Thanks!

s3rius commented 2 years ago

Beacuse tortoise doesn't support it. You can see supported schemas here: https://github.com/tortoise/tortoise-orm/blob/develop/tortoise/backends/base/config_generator.py#L13

Ormar also uses synchronous SQLAlchemy so it doesn't support async schemas.

s3rius commented 2 years ago

Closed due to inactivity.