Flask site: Replit & PlanetScale Connection with SSL issue

I’m creating a flask site and can connect to a planet scale mySQL db using the following fine:

engine = create_engine(my_secret, connect_args={
    "ssl":{
    "ssl_ca": "/etc/ssl/cert.pem"
    }
  })

but when forming the URI I get errors like “file not found” and missing get with various configs such as:

app.config['SQLALCHEMY_DATABASE_URI'] = mysecret2 

where secret 2 has the following appended: &ssl={“ssl”:{“ssl_ca”: “/etc/ssl/cert.pem”}} . This one produces error: AttributeError: ‘str’ object has no attribute ‘get’

Welcome to the community @ChrisFigy

AFAIK SQLAlchemy expects connection arguments, including SSL configurations, to be passed separately from the URI string.

1 Like

I found this:

But those options are not working with URI addition. Wondering if URI can take the SSL info.