# Dashboard not getting updated

**URL:** <https://community.plotly.com/t/dashboard-not-getting-updated/39790>\
**Category:** Dash Python\
**Created:** [May 20, 2020, 7:17am UTC](https://community.plotly.com/t/dashboard-not-getting-updated/39790 "2020-05-20T07:17:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adnan](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Adnan](https://community.plotly.com/u/Adnan)\
**Post date:** [May 20, 2020, 7:17am UTC](https://community.plotly.com/t/dashboard-not-getting-updated/39790/1 "2020-05-20T07:17:18Z")

</div>

Hi Team,

Trying to run the below code but i am getting the old output and not the output for the code.

Kindly advice

```auto
import pandas as pd
import pyodbc
server='LAPTOP-OO3V36UA\SQLEXPRESS'
db='addy'

conn=pyodbc.connect('DRIVER={SQL Server}; SERVER=' +server + ';DATABASE=' + db + ';Trusted_connection=yes')

sql="""

SELECT * FROM Summry

"""

df=pd.read_sql(sql ,conn)
df
import dash
from dash.dependencies import Output, Input
import dash_core_components as dcc
import dash_html_components as html
from random import random
import plotly

app = dash.Dash( __name__ )
app.layout = html.Div([
        dcc.Graph(id='live-update-graph-scatter', animate=True),
        dcc.Interval(
            id='interval-component',
            interval=1*1000
        )
    ])

@app.callback(Output('live-update-graph-scatter', 'figure'),
              [Input('interval-component', 'interval')])
def update_graph_scatter():
    
    trace1=go.Scatter(
    y=df['ACL'],
    x = df['DateandnTime'],
    mode='lines',
    name='ACL'
    
)
    layout = go.Layout(
    title='Daily Monitoring'
    )
    return {'data': trace1, 'layout': layout}
if __name__ == ' __main__':
    app.run_server()

```

---

<div class="post-metadata">

**Author:** ![Emmanuelle](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emmanuelle/32/7853_2.png) [@Emmanuelle](https://community.plotly.com/u/Emmanuelle)\
**Post date:** [May 21, 2020, 10:12am UTC](https://community.plotly.com/t/dashboard-not-getting-updated/39790/2 "2020-05-21T10:12:24Z")

</div>

Hi @Adnan I think the problem is that you query the database only once at the beginning of the script, you need to fetch the new data inside the callback otherwise `df` is never updated. You can print `df` inside the callback to check whether it is updated, but I don’t think the problem is with Dash.

---

<div class="post-metadata">

**Author:** ![Adnan](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Adnan](https://community.plotly.com/u/Adnan)\
**Post date:** [May 22, 2020, 7:15am UTC](https://community.plotly.com/t/dashboard-not-getting-updated/39790/3 "2020-05-22T07:15:14Z")

</div>

I added print df but it is showing an error  
I even added the sql query after the call back it is giving an error could u please help what changes exactly needs to be done
