'Date picker component controlling the date of SQL query

I am implementing date picker to my dash web app. When the date is picked I want it to be passed to SQL code so it returns values from the selected date. Although it sounds pretty simple I'm stuck on the second day with it and have no idea how to make it work. In the code below I am trying to return date_value from the function and assign it to the variable datev and then insert it into SQL query inside the class Values. Result is the error pasted just below.

ERROR File "C:\Users\patryk.suwala\Documents\pythonProject\pythonProject6\data.py", line 28, in dates, datev = update_output() File "C:\Users\patryk.suwala\Documents\pythonProject\pythonProject6\venv\lib\site-packages\dash_callback.py", line 143, in add_context output_spec = kwargs.pop("outputs_list") KeyError: 'outputs_list'

app.layout = html.Div([
    dcc.DatePickerSingle(id='date-picker-single', date=date(1997, 5, 10)),
    html.Div(id='output-container-date-picker-single')
])


@app.callback(
    Output('output-container-date-picker-single', 'children'),
    Input('my-date-picker-single', 'date'))
def update_output(date_value):
    if date_value is not None:
        date_object = date.fromisoformat(date_value)
        date_string = date_object.strftime('%B %d, %Y')
        return date_string, date_value #  Include date_value in function return


dates, datev = update_output() #  Assign date_value to the variable 

class Values:
    SLGordersAc = f"""SELECT COUNT(slg.id) AS slg_orders_accepted 
    FROM slg_failure slg 
    WHERE slg.slg_declined_reason_id = 0 
    AND slg.created_date = {datev}; """ #Insert variable into SQL query
    cursor.execute(SLGordersAc)
    resultSLGoA = cursor.fetchall()
    [resultSLGoA] = resultSLGoA[0]
    SLGo = dftab3.at[3, 'Value']
    SLGo_PR = SLGo / OO
    dftab3.loc[4, :] = 'SLG Orders %', round(SLGo_PR, 2)
    dftab3.loc[5, :] = 'SLG Orders Accepted', resultSLGoA
    SLGoA = dftab3.at[5, 'Value']
    SLGoA_PR = SLGoA / OO
    dftab3.loc[6, :] = 'SLG Orders Accepted %', round(SLGoA_PR, 2)
    


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source