Problem with MySQL


I am unable to connect to MySQL.
I repeated the example in the documentation and nothing…frustration…frustration…frustration.

Thanks in advance

Can you share more details about your setup and code and what errors you are getting?

  • don’t paste logs or code as images
  • this is not the full log
  • you probably have invalid packages in your requirements.txt file, maybe “time” which is already part of the python standard library
1 Like

import streamlit as st
import pandas as pd
from sqlalchemy import create_engine

SQL_script = st.text_area(label=‘SQL Input’, value=‘SELECT * FROM df’)

def get_connection():
return create_engine(“mysql+pymysql://{user}:{pw}@localhost/{db}”

def load_data(SQL_script):
with st.spinner(‘Loading Data…’):
df = pd.read_sql_query(SQL_script, get_connection())
return df

raw_data = load_data(SQL_script)

I think the main problem is with ```


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