Limits on SQL query statements

更新时间:
复制 MD 格式

Cloud Config imposes limits on SQL query statements for resource search. Review these limits before you write SQL statements to search for resources.

Limits on the search scope

  • SQL query statements can search only for existing resources. Deleted resources cannot be searched.

  • For statements that use the SELECT * syntax, the following properties are returned by default:

    • AccountId

    • RegionId

    • ResourceId

    • ResourceType

    • ResourceName

    • ResourceCreationTime

    • ResourceGroupId

Unsupported query keywords

The following SQL keywords are not supported. The NULL keyword is supported.

  • ALL

  • DISTINCT

  • FROM

  • HAVING

  • JOIN

  • UNION

Limits on wildcards

  • Wildcards are supported only for property values. Example: WHERE ResourceId LIKE 'Value%'.

  • Wildcards are not supported for property keys. For example, WHERE 'ResourceId%' LIKE 'Value' is not supported.

  • Wildcards can be used only as suffixes. Examples:

    • ResourceType LIKE 'ACS::ECS::%'

    • ResourceType LIKE 'ACS::ECS::_'

Limits on aggregate functions

Cloud Config supports aggregate functions with the following limits.

  • Supported aggregate functions:

    • AVG

    • COUNT

    • MAX

    • MIN

    • SUM

  • Limits on supported aggregate functions:

    • Each aggregate function accepts only one parameter or property.

    • Aggregate functions cannot be nested.

    • If you use the GROUP BY clause together with the ORDER BY clause, the aggregate function can contain only one property.

    • The HAVING clause is not supported for aggregate functions.

Example of the query on multiple properties

{
  "configTagList": [
    {"configTagName": "A", "tagType": "ecs"},
    {"configTagName": "B", "tagType": "sls"}
  ]
}

The following statement retrieves Resource R:

SELECT * WHERE configTagList.configTagName = 'A' AND configTagList.tagType = 'sls'

Description:

  • The condition configTagList.configTagName = 'A' is evaluated for all elements in the configTagList array and returns true because Resource R has Tag A.

  • The condition configTagList.tagType = 'sls' is evaluated for all elements in the configTagList array and returns true because Resource R has Tag B whose type is sls.

  • Because Resource R meets both conditions, Resource R is returned.