docstr: Create a new view
docstr_tok: ["Create","a","new","view"]
code: def post(self, project_name):
      """Create a new view"""
      if "view" not in request.json:
          abort(
              HTTPStatus.BAD_REQUEST,
              'Must provide "view" parameter in POST body',
          )
      session = SessionController()
      view_obj = request.json["view"]
      if "name" not in view_obj:
          abort(HTTPStatus.BAD_REQUEST, 'Missing "name" field for view')
      if "query" not in view_obj:
          abort(
              HTTPStatus.BAD_REQUEST, 'Missing "query" field for view'
          )
      name = view_obj["name"]
      query = view_obj["query"]
  
      try:
          project = session.database_controller.get_project(
              project_name
          )
      except NoResultFound:
          abort(
              HTTPStatus.NOT_FOUND,
              f"Project name {project_name} does not exist",
          )
  
      if project.get_view(name) is not None:
          abort(
              HTTPStatus.CONFLICT,
              f"View with name {name} already exists.",
          )
  
      project.create_view(name, query)
      created_view = project.get_view(name)
      # Only want to return relevant fields to the user.
      return {
          "id": created_view["metadata"]["id"],
          "name": created_view["name"],
          "query": created_view["query"],
      }, HTTPStatus.CREATED
  
file_path: mindsdb/mindsdb/api/http/namespaces/views.py
imports: from http import HTTPStatus
  from flask import request
  from flask_restx import Resource, abort
  from sqlalchemy.exc import NoResultFound
  from mindsdb.api.http.namespaces.configs.projects import ns_conf
  from mindsdb.api.executor.controllers.session_controller import SessionController
label_desc: Use image node_id 2 for calling the ViewsList obj's underlying member method code with example usage: obj.post(project_name) and returns: dict,  HTTPStatus