'Creates a new query, copying the query text from an existing one.
:param query_id: ID of query to fork
Responds with created :ref:`query <query-response-label>` object.'

@require_permission('edit_query')
def post(self, query_id):

    query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
    forked_query = query.fork(self.current_user)
    models.db.session.commit()
    return forked_query.to_dict(with_visualizations=True)
