:doc:`TimestreamQuery <../../timestream-query>` / Client / execute_scheduled_query

***********************
execute_scheduled_query
***********************



.. py:method:: TimestreamQuery.Client.execute_scheduled_query(**kwargs)

  

  You can use this API to run a scheduled query manually.

   

  If you enabled ``QueryInsights``, this API also returns insights and metrics related to the query that you executed as part of an Amazon SNS notification. ``QueryInsights`` helps with performance tuning of your query. For more information about ``QueryInsights``, see `Using query insights to optimize queries in Amazon Timestream <https://docs.aws.amazon.com/timestream/latest/developerguide/using-query-insights.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/timestream-query-2018-11-01/ExecuteScheduledQuery>`_  


  **Request Syntax**
  ::

    response = client.execute_scheduled_query(
        ScheduledQueryArn='string',
        InvocationTime=datetime(2015, 1, 1),
        ClientToken='string',
        QueryInsights={
            'Mode': 'ENABLED_WITH_RATE_CONTROL'|'DISABLED'
        }
    )
    
  :type ScheduledQueryArn: string
  :param ScheduledQueryArn: **[REQUIRED]** 

    ARN of the scheduled query.

    

  
  :type InvocationTime: datetime
  :param InvocationTime: **[REQUIRED]** 

    The timestamp in UTC. Query will be run as if it was invoked at this timestamp.

    

  
  :type ClientToken: string
  :param ClientToken: 

    Not used.

    This field is autopopulated if not provided.

  
  :type QueryInsights: dict
  :param QueryInsights: 

    Encapsulates settings for enabling ``QueryInsights``.

     

    Enabling ``QueryInsights`` returns insights and metrics as a part of the Amazon SNS notification for the query that you executed. You can use ``QueryInsights`` to tune your query performance and cost.

    

  
    - **Mode** *(string) --* **[REQUIRED]** 

      Provides the following modes to enable ``ScheduledQueryInsights``:

       

      
      * ``ENABLED_WITH_RATE_CONTROL`` – Enables ``ScheduledQueryInsights`` for the queries being processed. This mode also includes a rate control mechanism, which limits the ``QueryInsights`` feature to 1 query per second (QPS).
       
      * ``DISABLED`` – Disables ``ScheduledQueryInsights``.
      

      

    
  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`TimestreamQuery.Client.exceptions.AccessDeniedException`

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

  
  *   :py:class:`TimestreamQuery.Client.exceptions.ResourceNotFoundException`

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

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

  
  *   :py:class:`TimestreamQuery.Client.exceptions.InvalidEndpointException`

  