Wrong info about database URI

According to your webpage, my database URI begins with ‘postgres://’. However, I actually had to use ‘postgresql://’, as I learned from https://stackoverflow.com/questions/62688256/sqlalchemy-exc-nosuchmoduleerror-cant-load-plugin-sqlalchemy-dialectspostgre. Should this information not be updated?

On a related note, my attempt to fix this bug was thrown off by the fact that when the webpage says that a new deploy is live, it seems that it is actually the previous deploy that is used to serve requests for a minute or two afterwards.

I hope this information is helpful. If it’s me who have misunderstood something, please let me know.

Hi Casper,

Thanks for reaching out.

SQLAlchemy >=1.4 dropped support for postgres:// in favor of postgresql://. This causes an issue with Render supplied database connection strings (as well as other cloud platform Postgres providers). There’s futher discussion in this GitHub issue: https://github.com/sqlalchemy/sqlalchemy/issues/6083

A workaround for this could be to update the connection string in code, something like:

import osrender_database_uri = os.getenv("DATABASE_URL") # or the env var containing your connection stringif render_database_uri.startswith("postgres://"): database_uri = uri.replace("postgres://", "postgresql://", 1)# then use database_uri with SQLAlchemy

Hope that helps.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.