✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Udapte data from db on the fly

I’m in the same situation as this post.
I’m trying to implement the option 1 proposed by chriddyp. But I can’t figure out how to do “set the data on page load and pass it through to different callbacks with hidden divs”.

Here is what I have implemented but I’m not sure where I’m going.
I did turn my app.layout into a function and I’d like to know how to set the data on page load. I understand that I should do it in a hidden div but I don’t get what could by the Input.

def serve_layout():
    return html.Div(children=[

        html.Div(id='intermediate-data', style={'display': 'none'})

app.layout = serve_layout

    Output('intermediate-data', 'children'),
def load_data(....):
    data = MyDB.query.filter_by(...)
    data_values = pd.DataFrame([(d.col1, d.col2) for d in data], columns=['col1', 'col2'])
    return data_values

Can you help me? Thanks