Creating Orion database in postgres manually

hi,
This might sound trivial… but if I dont want to use docker image but want to create the postgres database in an existing database server, how can I do it? I dont see any scripts for building the required tables.

1 Like

Great question! You don’t have to use Postgres in Docker, any Postgres database will work - sorry to hear that docs showing how to do it with Postgres running in Docker confused you to believe that’s the only option

All you need to do is to specify the DB connection in your Prefect settings. Then, once you start Orion, DB migrations will start to take care of it

prefect config set PREFECT_ORION_DATABASE_CONNECTION_URL="postgresql+asyncpg://postgres:yourTopSecretPassword@localhost:5432/orion"

Thanks! I was able to do this. however asyncpg doesnt support kerberos. is it possible to use any other database? Ony Postgres and sqlite are supported?

Exactly, you can use either Postgres or SQLite. And if that doesn’t work, there is always the option to leverage Prefect Cloud

I installed postgresql and created a database named ‘orion’ as ‘new_user’ with password.
In my local postgresql’s port number is 5433, I wrote the config setting code as you told me above .

prefect config set PREFECT_ORION_DATABASE_CONNECTION_URL="postgresql+asyncpg://new_user:password@localhost:5433/orion"

I set the above settings and restarted the orion server.
I usally check the databases using a tool called debeaver, but nothing is recorded in the postgresql ‘orion’ database I created. If I finish the config setting, is the meta information related to the flow running on the orion server is saved there?
There is no change in manually connected database.

Also there is an ‘orion.db’ file in my local path where prefect2.0 is installed, is it related to it?
Like registering the flow at prefect 1.0, is the flow that was tested locally must have to deployed to record the data in the db?

orion.db is the SQLite DB created by Prefect

@only1sun Delete the orion.db file and then try again. if it is recreated you will know that your problem does indeed stem from prefect not recognizing your configuration of the external postgres db.

Perhaps try setting the environment variable directly (without the surrounding quotation marks) before you run the server.

1 Like