@module.route('/sqlalchemy/sql_select', methods=['GET', 'POST'])
@module.route('/sqlalchemy/sql_explain', methods=['GET', 'POST'], defaults=dict(explain=True))
def sql_select(explain=False):
    statement, params = load_query(request.args['query'])
    database = current_app.extensions.get('peewee').database.obj

    if explain:
        if isinstance(database, SqliteDatabase):
            statement = statement % 'EXPLAIN QUERY PLAN\n%s'
        else:
            statement = 'EXPLAIN\n%s' % statement

    result = database.execute_sql(statement, params)
    headers = []
    data = list(result.fetchall())
    if data:
        headers = ['' for _ in range(len(data[0]))]
    return g.debug_toolbar.render('panels/sqlalchemy_select.html', {
        'result': data,
        'headers': headers,
        'sql': format_sql(statement, params),
        'duration': float(request.args['duration']),
    })
dataset/ETHPy150Open klen/flask-pw/flask_pw/debugtoolbar.py/sql_select/swapped operands of `%`