This topic describes the limits on SQL query statements in Cloud Config.
- You can search for only existing resources.
- For statements that use the
SELECT *
syntax, only the following properties can be returned:AccountId
,RegionId
,ResourceId
,ResourceType
,ResourceName
,ResourceCreationTime
, andResourceGroupId
. - The
ALL
,DISTINCT
,FROM
,HAVING
,JOIN
, andUNION
keywords are not supported. TheNULL
keyword is supported. - Cloud Config imposes the following limits on wildcards:
- Wildcards are supported for only property values. Wildcards are not supported for
property keys. For example,
...WHERE ResourceId LIKE 'Value%'
is supported, but...WHERE 'ResourceId%' LIKE 'Value%'
is not supported. - A wildcard can be used as a suffix. Examples:
...ResourceType LIKE 'ACS::ECS::%'
and...ResourceType LIKE 'ACS::ECS::_'
.
- Wildcards are supported for only property values. Wildcards are not supported for
property keys. For example,
- Aggregate functions are supported, such as the
AVG
,COUNT
,MAX
,MIN
, andSUM
functions. Cloud Config imposes the following limits on aggregate functions:- You can specify only one parameter or property for an aggregate function.
- Aggregate functions cannot be nested.
- If you use the
GROUP BY
clause together with theORDER BY
clause, an aggregate function can contain only one property. - The
HAVING
clause is not supported for aggregation functions.
- If you query multiple properties in an array, all elements in the array are checked
to match the conditions. For example, Resource R has Tag A and Tag B, as shown in
the following code:
{ configTagList: [ { configTagName: 'A', tagType: 'ecs' }, { configTagName: 'B', tagType: 'sls' } ] }
In this case, the following statement can be used to retrieve Resource R:SELECT * WHERE configTagList.configTagName = 'A' AND configTagList.tagType = 'sls'
The first condition
configTagList.configTagName = 'A'
and the second conditionconfigTagList.tagType = 'sls'
are evaluated for all elements in theconfigTagList
array. The first condition is evaluated as true because Resource R has Tag A. The second condition is also evaluated as true because Resource R has Tag B. As a result, Resource R is returned.