Problem with MySQL

Hi,

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’)

@st.cache(allow_output_mutation=True)
def get_connection():
return create_engine(“mysql+pymysql://{user}:{pw}@localhost/{db}”
.format(user=“root”,
pw=“Platinum79”,
db=“ebird”))

@st.cache
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)
raw_data

I think the main problem is with ```
mysqlclient


![image|690x423](upload://2xoOVjkyjGciTPatd8MuKkrHCLj.png)

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