Hello everyone, I am trying to connect my sqlite database table to dash as well as displaying the table in my dash. However, there is an error “sqlite3.OperationalError: no such table: information” but I have already created the table information.
Heres my code:
import pandas as pd
import dash
import dash_table
import dash_html_components as html
import sqlite3
conn = sqlite3.connect('databasename.db')
cursor =conn.cursor()
cursor.execute('SELECT A,B,C,D,E FROM informtion')
df = pd.read_sql("SELECT A,B,C,D,E FROM information",conn)
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1("This is a random table", style={'text-align': 'center'}),
dash_table.DataTable(
id='table',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict('records'),
)])
if __name__ == '__main__':
app.run_server(debug=True)