MLFLOW and Postgres getting Bad Request error

874 Views Asked by At

I have been pulling my hair trying to figure out what's wrong with mlflow. Iam deploying mlflow v1.26 in google cloudRun . back end artitfactory is google storage and backend database is google cloudsql postgres v13 instance.

here is my entrypoint using pg8000 v1.21.3 (I tried latest version as well) and psycopg2-binary v2.9.3


set -e
export ARTIFACT_URL="gs://ei-cs-dev01-ein-sb-teambucket-chaai-01/mlflow/"
export DATABASE_URL="postgresql+pg8000://mlflow:[email protected]:5432/mlflowps" #"$(python3 /app/get_secret.py --project="${GCP_PROJECT}" --secret=mlflow_database_url)"

if [[ -z "${PORT}" ]]; then
    export PORT=8080
fi

exec mlflow server -h 0.0.0.0 -w 4 -p ${PORT} --default-artifact-root ${ARTIFACT_URL} --backend-store-uri ${DATABASE_URL}

now when I open mlflow ui page I see this error happening: (

BAD_REQUEST: (pg8000.dbapi.ProgrammingError) {'S': 'ERROR', 'V': 'ERROR', 'C': '42883', 'M': 'operator does not exist: integer = character varying', 'H': 'No operator matches the given name and argument types. You might need to add explicit type casts.', 'P': '382', 'F': 'parse_oper.c', 'L': '731', 'R': 'op_error'} [SQL: SELECT DISTINCT runs.run_uuid..

) enter image description here

2

There are 2 best solutions below

3
On BEST ANSWER

You should use psycopg2 instead, e.g.:

postgresql+psycopg2://<username>:<password>@<dbname>?host=/cloudsql/<my-project>:<us-central1>:<dbinstance>

It works for me, with versions:

mlflow==1.26.1

psycopg2-binary==2.9.3

0
On

I still faced this error after changing the driver to psycopg2 as suggested in Ludva's answer. I also switched to MySQL and then it worked.