sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres

I’m getting this error from SQLAlchemy:

sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres

turns out, the DB URL generated by Render is an obsolete one — now postgres: is deprecated, and should use postgresql: instead.

Context: python - sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres - Stack Overflow

Will you fix this soon?

1 Like

Hi,

Thanks for reaching out.

SQLAlchemy is one of the only Postgres clients that enforces the postgresql:// scheme, most others will accept it along with postgres://. libpq of Postgres itself also accepts both (docs)

This is discussed at length in a GitHub issue here: https://github.com/sqlalchemy/sqlalchemy/issues/6083

A couple of workarounds could be:

  • If you’re setting a database URL on your service manually, amend the scheme to postgresql:// when creating the env var.
  • Or, of you’re getting a database env var setup via a Blueprint, then a small check in code may help, as suggested in the GitHub issue above.

However, I’ll raise this with the Datastores team.

Kind regards

Alan

2 Likes

Hi Alan,

Thanks for your response!

Actually, I faced the same problem the second time today with Retool, a trending Admin-as-a-Service app.

They take the DB URL string, and postgres: scheme failed, while manually modifying it to postgresql: worked.

So it’s not just SQLAlchemy, it’s more than that. I’m not sure if it’s a good trade-off worth saving 2 characters?

Thanks for pointing out another case, however, I didn’t say SQLAlchemy was the only example. I’ll still be running this past our engineers, until then, you’ll need to add the ql manually.

Alan

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