Error using Orion on PostgreSQL

I’m Trying to connect Prefect to an existing DB (I already have a db called orion inside it).
And im getting this error while doing so:


sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedFunctionError'>: functio
n gen_random_uuid() does not exist
atool-application-1  | HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
atool-application-1  | [SQL:
atool-application-1  | CREATE TABLE flow (
atool-application-1  |  id UUID DEFAULT (GEN_RANDOM_UUID()) NOT NULL,
atool-application-1  |  created TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
atool-application-1  |  updated TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
atool-application-1  |  name VARCHAR NOT NULL,
atool-application-1  |  tags JSONB DEFAULT '[]' NOT NULL,
atool-application-1  |  CONSTRAINT pk_flow PRIMARY KEY (id),
atool-application-1  |  CONSTRAINT uq_flow__name UNIQUE (name)
atool-application-1  | )
atool-application-1  | 
atool-application-1  | ]
atool-application-1  | (Background on this error at: https://sqlalche.me/e/14/f405)
atool-application-1  | 
atool-application-1  | ERROR:    Application startup failed. Exiting.
atool-application-1  | Orion stopped!

I know it does connect to the DB, because when I delete the DB, I’m getting an error that it can’t find it.

Would love to get help.

The PG version appears to be 9.5, If It’s crucial.

1 Like

Solved this Issue, using this:
ubuntu 14.04 - PostgreSQL function gen_random_uuid() not working - Stack Overflow

Now I’m getting another error:

atool-application-1  |     raise translated_error from error
atool-application-1  | sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.ActiveSQLTransactionError'>: ALTER TYPE ... ADD ca
nnot run inside a transaction block
atool-application-1  | [SQL: ALTER TYPE state_type ADD VALUE IF NOT EXISTS 'CRASHED';]
atool-application-1  | (Background on this error at: https://sqlalche.me/e/14/dbapi)
atool-application-1  | 
atool-application-1  | ERROR:    Application startup failed. Exiting.
atool-application-1  | Orion stopped!
1 Like

What’s your prefect version output? Can you try creating a fresh Conda environment and installing Prefect from scratch there?

Hi Anna, thank’s for the response, I’ve tested it afterwards by using PGSQL V13+ and it seems to work perfectly, So I guess it is a postgress

1 Like

Gotcha, let me cross-check with the team

To be fair, the docs to say to use PG 13+

1 Like

I opened an issue here for tracking, thx for reporting this