1

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:change2022@10.238.139.37: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

SaD
  • 63
  • 4

1 Answers1

3

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

Ludva
  • 56
  • 1
  • 1
    thank you very much for your answer. I switched to mySQL so can't try it in that project anymore but if it works for you I mark it as the answer – SaD Jun 26 '22 at 05:36
  • Thank you very much, this saved me hours of search – Abdulaziz Al-Homaid Oct 16 '22 at 14:34
  • This also helped me in trying to set up mlflow on GCP with the following project, https://github.com/dlabsai/mlflow-for-gcp. I wish it had saved me from many hours of search, but it did save me after a few hours of it! Also, for some reason I also had to create a different password for my PostgreSQL user before I was able to authenticate. – covert Jun 30 '23 at 14:19