HOW to get the dcc.Input value and use it as a parameter for sql sentence database?

image
option one:use callback
option two …I got stuck so confused
show the current code i have written:
import dash
import dash_core_components as dcc
import dash_html_components as html
from DBConnection import getData
from utils import make_dash_table
from dash.dependencies import Output, State, Input
import json

app = dash.Dash()
server=app.server
app.layout = html.Div([
dcc.Input(id=‘username’, value=‘Initial Value’, type=‘text’),
html.Button(id=‘submit-button’, type=‘submit’, children=‘Submit’),
html.Div(id=‘output_div’),
# 用于存储中间值的Hidden Div。
html.Div( id=‘intermediate-value’, style={‘display’: ‘none’} ),
html.Div(
[
html.H6(
[“检索结果表格”],
className=“subtitle padded”,
),
html.Table(
id=“table”,
className=“tiny-header”,
),
],)
])

@app.callback(Output(‘output_div’, ‘children’),
[Input(‘submit-button’, ‘n_clicks’)],
[State(‘username’, ‘value’)],
)
def update_output(clicks, input_value):
if clicks is not None:
return input_value

if name == ‘main’:
app.run_server(debug=True)

Looing forward the advanced programmer’s advice and help.