I am planning to deploy an app that uses SQLite database. Where do I host the DB file
Hey, thanks for posting,
Streamlit provides support for SQL database,
You can refer to this simple tutorial from the docs…
This would be on either a server or a cloud based system which the app will be pointed to read is my understanding. Hopefully right
Yes you are right, this was for server like if you are deploying your app…
But if you want to test it on your local then you can use SQLAlchemy
library to connect to your local SQL…
You can look for this tutorial for some motivation
https://docs.streamlit.io/library/advanced-features/connecting-to-data
I followed the docs and set up my app. However, my db is Mysql. And the app is working fine with mysql connector when using # db_config = {
‘user’: ‘user’,
‘password’: ‘passwdxxxx’,
‘host’: ‘xx.xxx.xxx.xxx’,
‘database’: ‘MySQLDB’
}
conn = mysql.connector.connect(**db_config).
Is there something I am missing as I am being asked to install sqlalchemy - wonder if I need to make changes to my code itself.
Thanks in advance
It is always fine if it is working…
The benifit you might get from SQLalchemy
is that, SQLAlchemy primarily uses ORM (Object-Relational Mapping) in order to abstract the details of handling the database. This can help avoid errors some times… whereas mysql connector works only with simple SQL
Got over this. Now struggling to import mathplotlib import matplotlib.pyplot as plt. Made another thread for this