:doc:`NeptuneGraph <../../neptune-graph>` / Client / execute_query

*************
execute_query
*************



.. py:method:: NeptuneGraph.Client.execute_query(**kwargs)

  

  Execute an openCypher query.

   

  When invoking this operation in a Neptune Analytics cluster, the IAM user or role making the request must have a policy attached that allows one of the following IAM actions in that cluster, depending on the query:

   

  
  * neptune-graph:ReadDataViaQuery
   
  * neptune-graph:WriteDataViaQuery
   
  * neptune-graph:DeleteDataViaQuery
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/neptune-graph-2023-11-29/ExecuteQuery>`_  


  **Request Syntax**
  ::

    response = client.execute_query(
        graphIdentifier='string',
        queryString='string',
        language='OPEN_CYPHER',
        parameters={
            'string': {...}|[...]|123|123.4|'string'|True|None
        },
        planCache='ENABLED'|'DISABLED'|'AUTO',
        explainMode='STATIC'|'DETAILS',
        queryTimeoutMilliseconds=123
    )
    
  :type graphIdentifier: string
  :param graphIdentifier: **[REQUIRED]** 

    The unique identifier of the Neptune Analytics graph.

    

  
  :type queryString: string
  :param queryString: **[REQUIRED]** 

    The query string to be executed.

    

  
  :type language: string
  :param language: **[REQUIRED]** 

    The query language the query is written in. Currently only openCypher is supported.

    

  
  :type parameters: dict
  :param parameters: 

    The data parameters the query can use in JSON format. For example: {"name": "john", "age": 20}. (optional)

    

  
    - *(string) --* 

    
      - (:ref:`document<document>`) -- 

      


  :type planCache: string
  :param planCache: 

    Query plan cache is a feature that saves the query plan and reuses it on successive executions of the same query. This reduces query latency, and works for both ``READ`` and ``UPDATE`` queries. The plan cache is an LRU cache with a 5 minute TTL and a capacity of 1000.

    

  
  :type explainMode: string
  :param explainMode: 

    The explain mode parameter returns a query explain instead of the actual query results. A query explain can be used to gather insights about the query execution such as planning decisions, time spent on each operator, solutions flowing etc.

    

  
  :type queryTimeoutMilliseconds: integer
  :param queryTimeoutMilliseconds: 

    Specifies the query timeout duration, in milliseconds. (optional)

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'payload': StreamingBody()
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **payload** (:class:`.StreamingBody`) -- 

        The query results.

        
  
  **Exceptions**
  
  *   :py:class:`NeptuneGraph.Client.exceptions.ThrottlingException`

  
  *   :py:class:`NeptuneGraph.Client.exceptions.UnprocessableException`

  
  *   :py:class:`NeptuneGraph.Client.exceptions.ValidationException`

  
  *   :py:class:`NeptuneGraph.Client.exceptions.ConflictException`

  
  *   :py:class:`NeptuneGraph.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`NeptuneGraph.Client.exceptions.InternalServerException`

  