Hi,
I have a relatively simple app as follows:
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
from layout_constructor import create_header
import dao
import sqlite3
from sqlalchemy import create_engine
import pandas as pd
conn = create_engine('sqlite:///G:/pyplicate/attunity.db')
def query(q):
df = pd.read_sql_query(sql=q, con=conn)
return df
def get_summary_server_details():
server_details_query = f'''SELECT cdc_inserts_count, cdc_update_count, cdc_delete_count, cdc_ddl_count
FROM taskDetails ORDER BY status_timestamp DESC LIMIT 1'''
return query(server_details_query)
external_stylesheets = [
'https://codepen.io/chriddyp/pen/bWLwgP.css', dbc.themes.SUPERHERO]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
create_header(),
html.Div(
[
dcc.Interval(
id='interval-component',
interval=1*1000,
n_intervals=0
)
]
)
])
@app.callback(
Output(component_id='agg-running-task', component_property='children'),
[Input(component_id='interval-component', component_property='n_intervals')]
)
def update_output_div(n):
#sql_result = pd.read_sql_query('SELECT cdc_inserts_count, cdc_update_count, cdc_delete_count, cdc_ddl_count FROM taskDetails ORDER BY status_timestamp DESC LIMIT 1', con=conn)
return 'Ok!'
# return 'You\'ve entered "{}"'.format(input_value)
if __name__ == '__main__':
app.run_server(debug=True)
For now the callback returns ‘Ok’. The moment i uncomment the “sql_result” line i cant get the callback to return anything. Not even “Ok”. Does anyone have a clue why uncommenting this one line breaks the whole app?
Any help is highly appreciated.
Best Regards,
Simon