:doc:`LakeFormation <../../lakeformation>` / Client / get_query_state

***************
get_query_state
***************



.. py:method:: LakeFormation.Client.get_query_state(**kwargs)

  

  Returns the state of a query previously submitted. Clients are expected to poll ``GetQueryState`` to monitor the current state of the planning before retrieving the work units. A query state is only visible to the principal that made the initial call to ``StartQueryPlanning``.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/lakeformation-2017-03-31/GetQueryState>`_  


  **Request Syntax**
  ::

    response = client.get_query_state(
        QueryId='string'
    )
    
  :type QueryId: string
  :param QueryId: **[REQUIRED]** 

    The ID of the plan query operation.

    

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

    
    ::

      {
          'Error': 'string',
          'State': 'PENDING'|'WORKUNITS_AVAILABLE'|'ERROR'|'FINISHED'|'EXPIRED'
      }
      
    **Response Structure**

    

    - *(dict) --* 

      A structure for the output.

      
      

      - **Error** *(string) --* 

        An error message when the operation fails.

        
      

      - **State** *(string) --* 

        The state of a query previously submitted. The possible states are:

         

        
        * PENDING: the query is pending.
         
        * WORKUNITS_AVAILABLE: some work units are ready for retrieval and execution.
         
        * FINISHED: the query planning finished successfully, and all work units are ready for retrieval and execution.
         
        * ERROR: an error occurred with the query, such as an invalid query ID or a backend error.
        

        
  
  **Exceptions**
  
  *   :py:class:`LakeFormation.Client.exceptions.InternalServiceException`

  
  *   :py:class:`LakeFormation.Client.exceptions.InvalidInputException`

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

  