All Products
Search
Document Center

Resource Management:Use a sample query template to query resources

Last Updated:Oct 31, 2023

This topic describes how to use a sample query template provided by Resource Center to query resources.

Background information

To facilitate the query process, Resource Center provides multiple sample query templates. For more information, see Supported sample query templates.

Step 1: Select a query scope

You can select a query scope for resources. This can help reduce unnecessary searches and data redundancy and help you quickly obtain the desired query result.

  1. Log on to the Resource Management console.

  2. In the left-side navigation pane, choose Resource Center > Advanced.

  3. On the Advanced page, click Change Query Scope.

  4. Select a query scope.

    • If the current logon account is an Alibaba Cloud account for which cross-account resource search is not enabled, you can choose to perform a query within the current logon account or within a specified resource group.

    • If the current logon account is the management account of a resource directory and cross-account resource search is enabled for the account, you can choose to perform a query within the current logon account or across accounts.

      • Current logon account: You can specify the current logon account or a specific resource group as the query scope.

      • Cross accounts: You can specify the entire resource directory, a specific folder, a specific member, or a specific resource group as the query scope.

Step 2: Execute a sample query template

  1. On the Advanced page, click the Quick Start tab. In the Sample Query Template section of the Quick Start tab, view the sample query templates that are provided by Resource Center.

  2. Find the sample query template that you want to use and click Open.

  3. In the code editor in the upper part of the Advanced page, view the query statement contained in the sample query template.

    Note

    If the query statement cannot meet your business requirements, you can modify the statement based on your business requirements before you click Run.

  4. Click Run.

Step 3: View the query result

Click the Query Result tab and view the query result.

View the query result in a list

Click the List subtab and view the query result in a list. You can turn on the Format switch in the upper-right corner of the List subtab. This way, the values of specific property fields are converted from IDs into names.

结果列表.jpg

View the query result in a chart

If the query result contains only two columns: a column whose values are strings and a column whose values are numeric values, you can click the Chart subtab of the Query Result tab to view the query result in a chart. Click the 设置.jpg icon in the upper-right corner of the Chart subtab. In the List Settings dialog box, select Pie or Bar for the Chart Type parameter.

Pie chart

image.png

Bar chart

image.png

Download the query result

You can download the query result that is displayed in a list as a CSV file and save the CSV file to your on-premises machine.

You can choose to download the query result that is converted or is not converted.

  • If you download the query result that is converted, you can obtain a file that contains converted data. The conversion makes specific data easier to read.

  • If you download the query result that is not converted, you can obtain a data file that contains the raw query result.

You can use a data analysis tool to process the downloaded query result and gain in-depth insights into the data.