Black Lives Matter. Please consider donating to Black Girls Code today.

State Sharing in Dash not accessing data

Hi -

I am having some issues with the state sharing between functions.

I am able to create the state sharing function that has the data, but when I try and pass the data to a function that updates the function nothing happens.

I have a multi-value drop down and pass those to query to run in a MySQL database. The query successfully extracts the necessary data but when does nothing to the figure I want to update. Suggestions?

sample code:

def get_data(district):
        #get data from SQL database

        dfJSON = df.to_json(orient = 'split')

       #successfully gets data

        return(json.dumps(dfJSON))

@app.callback(
    dash.dependencies.Output('rev-graph', 'figure'),
    [dash.dependencies.Input('intermediate-value', 'children')])

def update_revGraph(state_df):
        load_json = json.loads(state_df)
        df = pd.read_json(load_json, orient = 'split')
        #nothing happens but no error messages