SQL connection error due SSL (st.experimental_connection)


I use a predefined way to establish an sql database connection with streamlit. This works fine till today, as I had to switch to another server. No connection is possible since then. The error is:

(MySQLdb.OperationalError) (3159, ‘Connections using insecure transport are prohibited while --require_secure_transport=ON.’)
(Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)

After some research it is due the new server requires secure transport. I tried to change this on server side, but have no rights. So I need a way to pass SSL credentials via st.experimental connection.

Any ideas how to do this?

Steps to reproduce

Code snippet:

from sqlalchemy import text
import streamlit as st

# Establish connection to mysql server, secrets are defined in .streamlit/secrets.toml
def init_connection():
    return st.experimental_connection('mysql',type='sql',autocommit=False)

conn = init_connection()

# Cache data from mysql database
def run_query():
    return conn.query('SELECT * from parlist;')#, ttl=600)

df = run_query()

Expected behavior:

Possibility for mysql access.

Actual behavior:

No access possible due to missing credentials for SSL - don´t know how to pass arguments / files to st.experimental_connection

Debug info

  • Streamlit version: 1.27.2
  • Python version: 3.9.17

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