@app.callback(ServersideOutput('store', 'data'), Input('query-button', 'n_clicks'), State('querystr', 'data'), memoize=True)
def query(n_clicks, query_data):
    if (query_data is None):
        return no_update
    qdata = json.loads(query_data)
    try:
        dat = pd.read_sql(qdata['querystr'].replace('%', '%%'), con=engine)
        return dat
    except:
        logging.exception('SQL query failed\n')
@app.callback(ServersideOutput('store', 'data'), Input('query-button', 'n_clicks'), State('querystr', 'data'), memoize=True)
def query(n_clicks, query_data):
    if (query_data is None):
        return no_update
    qdata = json.loads(query_data)
    try:
        dat = pd.read_sql(qdata['querystr'].replace('%', '%%'), con=engine)
        return dat
    except:
        logging.exception('SQL query failed\n')