Postgres Render Config Connection Issue

Can’t connect to Render’s internal PSQL DB despite using their internal string command and code which works in my dev environment with accessible string.

i.e.

# page implements the main database models.
from flask import Flask as fl
import src.scripts.index as scripts
import sqlalchemy as sa
from sqlalchemy.orm import scoped_session, sessionmaker, configure_mappers
from sqlalchemy.ext.declarative import declarative_base
# connect

engine = sa.create_engine("postgres+psycopg2://user:host@password/my_db", convert_unicode=True, echo=True)
session = scoped_session(sessionmaker(autocommit=False,
                                         autoflush=False,
                                         bind=engine))

Hi @bcartwri96, are you still seeing issues? If so, I’d recommend trying to connect from within your service’s shell using psql and the internal connection string.

Yep, I did try this in the shell and it was able to successfully connect with the string provided. For some reason, within Python SQLAlchemy the connection was not allowed. However, I can’t see how this is SQLAlch’s fault, because my local connection string is accepted perfectly inside my own local dev instance…

Any thoughts?

Hmmm, can you share the error message you’re seeing (without revealing any sensitive information)? Feel free to follow up in a DM or email support@render.com if you prefer.