Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
Describa la consulta programada
Puede usar los siguientes fragmentos de código para describir una consulta programada.
- Java
-
public void describeScheduledQueries(String scheduledQueryArn) { System.out.println("Describing Scheduled Query"); try { DescribeScheduledQueryResult describeScheduledQueryResult = queryClient.describeScheduledQuery(new DescribeScheduledQueryRequest().withScheduledQueryArn(scheduledQueryArn)); System.out.println(describeScheduledQueryResult); } catch (ResourceNotFoundException e) { System.out.println("Scheduled Query doesn't exist"); throw e; } catch (Exception e) { System.out.println("Describe Scheduled Query failed: " + e); throw e; } }
- Java v2
-
public void describeScheduledQueries(String scheduledQueryArn) { System.out.println("Describing Scheduled Query"); try { DescribeScheduledQueryResponse describeScheduledQueryResult = queryClient.describeScheduledQuery(DescribeScheduledQueryRequest.builder() .scheduledQueryArn(scheduledQueryArn) .build()); System.out.println(describeScheduledQueryResult); } catch (ResourceNotFoundException e) { System.out.println("Scheduled Query doesn't exist"); throw e; } catch (Exception e) { System.out.println("Describe Scheduled Query failed: " + e); throw e; } }
- Go
-
func (timestreamBuilder TimestreamBuilder) DescribeScheduledQuery(scheduledQueryArn string) error { describeScheduledQueryInput := ×treamquery.DescribeScheduledQueryInput{ ScheduledQueryArn: aws.String(scheduledQueryArn), } describeScheduledQueryOutput, err := timestreamBuilder.QuerySvc.DescribeScheduledQuery(describeScheduledQueryInput) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case timestreamquery.ErrCodeResourceNotFoundException: fmt.Println(timestreamquery.ErrCodeResourceNotFoundException, aerr.Error()) default: fmt.Printf("Error: %s", err.Error()) } } else { fmt.Printf("Error: %s", aerr.Error()) } return err } else { fmt.Println("DescribeScheduledQuery is successful, below is the output:") fmt.Println(describeScheduledQueryOutput.ScheduledQuery) return nil } }
- Python
-
def describe_scheduled_query(self, scheduled_query_arn): print("\nDescribing Scheduled Query") try: response = self.query_client.describe_scheduled_query(ScheduledQueryArn=scheduled_query_arn) if 'ScheduledQuery' in response: response = response['ScheduledQuery'] for key in response: print("{} :{}".format(key, response[key])) except self.query_client.exceptions.ResourceNotFoundException as err: print("Scheduled Query doesn't exist") raise err except Exception as err: print("Scheduled Query describe failed:", err) raise err
- Node.js
-
En el siguiente fragmento se utiliza el estilo for V2. AWS SDK JavaScript Se basa en la aplicación de ejemplo de Node.js, ejemplo de Amazon Timestream LiveAnalytics
para su aplicación en. GitHub async function describeScheduledQuery(scheduledQueryArn) { console.log("Describing Scheduled Query"); var params = { ScheduledQueryArn: scheduledQueryArn } try { const data = await queryClient.describeScheduledQuery(params).promise(); console.log(data.ScheduledQuery); } catch (err) { console.log("Describe Scheduled Query failed: ", err); throw err; } }
- .NET
-
private async Task DescribeScheduledQuery(string scheduledQueryArn) { try { Console.WriteLine("Describing Scheduled Query"); DescribeScheduledQueryResponse response = await _amazonTimestreamQuery.DescribeScheduledQueryAsync( new DescribeScheduledQueryRequest() { ScheduledQueryArn = scheduledQueryArn }); Console.WriteLine($"{JsonConvert.SerializeObject(response.ScheduledQuery)}"); } catch (ResourceNotFoundException e) { Console.WriteLine($"Scheduled Query doesn't exist: {e}"); throw; } catch (Exception e) { Console.WriteLine($"Describe Scheduled Query failed: {e}"); throw; } }
Listar la consulta programada
Ejecute la consulta programada