Need help passing secrets contents to pymysql connector

Hi folks, happy Monday. I am attempting to deploy my application which connects to a Google Cloud MySQL database. My application uses pymysql to query the database. I am not entirely sure how to pass the secrets.toml contents to the pymysql.connect() argument.

Has anyone successfully used Secrets in pymysql? Thanks so much!

1 Like

Hi @thanks_paul, and welcome to the Streamlit community! :balloon::raised_hands:

Have you tried passing your secrets variables where required in pymysql.connect()?

Maybe @BeyondMyself can help, as I believe he recently managed to deploy an app relying on pymysql, see related post here:


@thanks_paul @Charly_Wargnier
yes, use pymysql to connect the database is a mature solution.
see the link:

1 Like

Thanks @BeyondMyself!