Delete scheduled query
You can use the following code snippets to delete a scheduled query.
- Java
-
public void deleteScheduledQuery(String scheduledQueryArn) { System.out.println("Deleting Scheduled Query"); try { queryClient.deleteScheduledQuery(new DeleteScheduledQueryRequest().withScheduledQueryArn(scheduledQueryArn)); System.out.println("Successfully deleted scheduled query"); } catch (Exception e) { System.out.println("Scheduled Query deletion failed: " + e); } }
- Java v2
-
public void deleteScheduledQuery(String scheduledQueryArn) { System.out.println("Deleting Scheduled Query"); try { queryClient.deleteScheduledQuery(DeleteScheduledQueryRequest.builder() .scheduledQueryArn(scheduledQueryArn).build()); System.out.println("Successfully deleted scheduled query"); } catch (Exception e) { System.out.println("Scheduled Query deletion failed: " + e); } }
- Go
-
func (timestreamBuilder TimestreamBuilder) DeleteScheduledQuery(scheduledQueryArn string) error { deleteScheduledQueryInput := ×treamquery.DeleteScheduledQueryInput{ ScheduledQueryArn: aws.String(scheduledQueryArn), } _, err := timestreamBuilder.QuerySvc.DeleteScheduledQuery(deleteScheduledQueryInput) if err != nil { fmt.Println("Error:") if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case timestreamquery.ErrCodeResourceNotFoundException: fmt.Println(timestreamquery.ErrCodeResourceNotFoundException, aerr.Error()) default: fmt.Printf("Error: %s", aerr.Error()) } } else { fmt.Printf("Error: %s", err.Error()) } return err } else { fmt.Println("DeleteScheduledQuery is successful") return nil } }
- Python
-
def delete_scheduled_query(self, scheduled_query_arn): print("\nDeleting Scheduled Query") try: self.query_client.delete_scheduled_query(ScheduledQueryArn=scheduled_query_arn) print("Successfully deleted scheduled query :", scheduled_query_arn) except Exception as err: print("Scheduled Query deletion failed:", err) raise err
- Node.js
-
The following snippet uses the AWS SDK for JavaScript V2 style. It is based on the sample application at Node.js sample Amazon Timestream for LiveAnalytics application on GitHub
. async function deleteScheduleQuery(scheduledQueryArn) { console.log("Deleting Scheduled Query"); const params = { ScheduledQueryArn: scheduledQueryArn } try { await queryClient.deleteScheduledQuery(params).promise(); console.log("Successfully deleted scheduled query"); } catch (err) { console.log("Scheduled Query deletion failed: ", err); } }
- .NET
-
private async Task DeleteScheduledQuery(string scheduledQueryArn) { try { Console.WriteLine("Deleting Scheduled Query"); await _amazonTimestreamQuery.DeleteScheduledQueryAsync(new DeleteScheduledQueryRequest() { ScheduledQueryArn = scheduledQueryArn }); Console.WriteLine($"Successfully deleted scheduled query : {scheduledQueryArn}"); } catch (Exception e) { Console.WriteLine($"Scheduled Query deletion failed: {e}"); throw; } }
Update scheduled query
Using batch load