I am trying to access a remote database through Streamlit but I keep getting this syntax error for the query line I have built into the code. This code originated in Jupyter notebook but I wanted to display the tab in a Streamlit format.
Share a clear and concise description of the issue. Aim for 2-3 sentences.
st.dataframe( #mydb = connector.connect(host="192.168.1.8", database = 'FreeWeibo',user="abc", passwd="abc",use_pure=True) mydb = connector.connect(host="22.214.171.124", database = 'FreeWeibo',user="abc", passwd="abc",use_pure=True) query = "Select * from FreeWeiboPosts" data = pd.read_sql(query,mydb) mydb.close() #close the connection
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
I get this error from the get go of running the above code.
Explain what you expect to happen when you run the code above.
Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.
File "C:\Users\avida\FreeWeibo\FreeWeibo.py", line 27 query = "Select * from FreeWeiboPosts" ^ SyntaxError: invalid syntax
- Streamlit version:1.15.1
- Python version:3.9.15
- Using Conda
- OS version: Windows 10
- Browser version: Crome
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
- Link to your GitHub repo:
- Link to your deployed app:
If needed, add any other context about the problem here.