collerek / ormar

python async orm with fastapi in mind and pydantic validation
https://collerek.github.io/ormar/
MIT License
1.66k stars 87 forks source link

How to initialize the database? #18

Closed paolodina closed 3 years ago

paolodina commented 3 years ago

Hi and thanks for the great package. Testing it with with FastAPI I get 500 Internal Server Error trying to access http://127.0.0.1:8000/docs or http://127.0.0.1:8000/openapi.json.

Does anyone have the same problem?

paolodina commented 3 years ago

Sorry I realized I forgot to create tables. Btw, how to do that? I found this but I'm not sure if it's the most proper way. https://github.com/encode/databases/issues/240#issuecomment-682136715

collerek commented 3 years ago

Thanks for the first user issue! ✨

Under the hood ormar uses sqlalchemy to manage the tables (and construct the queries). So all sqlalchemy/alembic tutorials are valid for ormar in this regard.

I updated the docs to avoid this confusion - thanks for pointing that out!

You can visit the relevant section here: https://collerek.github.io/ormar/models/#database-initialization-migrations

collerek commented 3 years ago

I assume that solves your issue, please reopen this issue if you need or create a new one if something else pops up.