:doc:`IoTSiteWise <../../iotsitewise>` / Client / execute_query

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



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

  

  Run SQL queries to retrieve metadata and time-series data from asset models, assets, measurements, metrics, transforms, and aggregates.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iotsitewise-2019-12-02/ExecuteQuery>`_  


  **Request Syntax**
  ::

    response = client.execute_query(
        queryStatement='string',
        nextToken='string',
        maxResults=123,
        clientToken='string'
    )
    
  :type queryStatement: string
  :param queryStatement: **[REQUIRED]** 

    The IoT SiteWise query statement.

    

  
  :type nextToken: string
  :param nextToken: 

    The string that specifies the next page of results.

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return at one time.

     

    
    * Minimum is 1
     
    * Maximum is 20000
     
    * Default is 20000
    

    

  
  :type clientToken: string
  :param clientToken: 

    A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

    This field is autopopulated if not provided.

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

    
    ::

      {
          'columns': [
              {
                  'name': 'string',
                  'type': {
                      'scalarType': 'BOOLEAN'|'INT'|'DOUBLE'|'TIMESTAMP'|'STRING'
                  }
              },
          ],
          'rows': [
              {
                  'data': [
                      {
                          'scalarValue': 'string',
                          'arrayValue': {'... recursive ...'},
                          'rowValue': {'... recursive ...'},
                          'nullValue': True|False
                      },
                  ]
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **columns** *(list) --* 

        Represents a single column in the query results.

        
        

        - *(dict) --* 

          A description of the column in the query results.

          
          

          - **name** *(string) --* 

            The name of the column description.

            
          

          - **type** *(dict) --* 

            The type of the column description.

            
            

            - **scalarType** *(string) --* 

              The allowed data types that the column has as it's value.

              
        
      
    
      

      - **rows** *(list) --* 

        Represents a single row in the query results.

        
        

        - *(dict) --* 

          Represents a single row in the query results.

          
          

          - **data** *(list) --* 

            List of data points in a single row of the result set.

            
            

            - *(dict) --* 

              Represents a single data point in a query result.

              
              

              - **scalarValue** *(string) --* 

                Indicates if the data point is a scalar value such as integer, string, double, or Boolean.

                
              

              - **arrayValue** *(list) --* 

                Indicates if the data point is an array.

                
              

              - **rowValue** *(dict) --* 

                Indicates if the data point is a row.

                
              

              - **nullValue** *(boolean) --* 

                Indicates if the data point is null.

                
          
        
      
    
      

      - **nextToken** *(string) --* 

        The string that specifies the next page of results.

        
  
  **Exceptions**
  
  *   :py:class:`IoTSiteWise.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.ThrottlingException`

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

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

  
  *   :py:class:`IoTSiteWise.Client.exceptions.QueryTimeoutException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.ServiceUnavailableException`

  