@app.route('/query', methods=('GET', 'POST'), defaults={'env': app.config['DEFAULT_ENVIRONMENT']})
@app.route('/<env>/query', methods=('GET', 'POST'))
def query(env):
    if app.config['ENABLE_QUERY']:
        envs = environments()
        check_env(env, envs)

        form = QueryForm(csrf_enabled=False)
        if form.validate_on_submit():
            if form.query.data[0] == '[':
                query = form.query.data
            else:
                query = '[{0}]'.format(form.query.data)
            result = get_or_abort(
                puppetdb._query,
                form.endpoints.data,
                query=query)
            return render_template('query.html',
                form=form,
                result=result,
                envs=envs,
                current_env=env)
        return render_template('query.html',
            form=form,
            envs=envs,
            current_env=env)
    else:
        log.warn('Access to query interface disabled by administrator..')
        abort(403)
Allows to execute raw, user created querries against PuppetDB. This is
dataset/ETHPy150Open voxpupuli/puppetboard/puppetboard/app.py/query