/rest/availableconstraint feature not working correctly
The NSIWS feature /rest/availableconstraint is not working correctly.
- The allowed constraints is not checked; not for dimensions nor for attributes.
- The allowed constraints should be applied in the creation of the available constraint if the configuration setting
applyContentConstraintsOnDataQueries
is set to true.
- The allowed constraints should be applied in the creation of the available constraint if the configuration setting
- SQL reserved words are not properly escaped on the queries for dimensions.
- This functionality does not work for PIT version (it allways queries the LIVE version).
-
TO BE DEFINED
by the PM team if this feature must be included.
-
Here are some findings based on a previous analysis:
- There are three type of SQL queries done during this request. Count, Dimensions (as many queries as there are dimenssions) and Time dimension.
- Count
SELECT COUNT(*)
FROM (SELECT [SID], [LOCATION],[SUBJECT],[MEASURE],[FREQUENCY],[TIME_PERIOD] AS [TIME_PERIOD],[PERIOD_START],[PERIOD_END],[OBS_VALUE],[OBS_STATUS],[TIME_FORMAT],[UNIT],[REFERENCEPERIOD],[POWERCODE] FROM [data].[VI_CurrentDataDataFlow_142_A]) virtualDataset
- Dimensions (one by one)
SELECT DISTINCT INDEX --This should be escaped
FROM (SELECT [SID], [MEASURE],[INDEX],[TSEST],[REGION],[FREQUENCY],[TIME_PERIOD] AS [TIME_PERIOD],[PERIOD_START],[PERIOD_END],[OBS_VALUE],[UNIT_MEASURE],[BASE_PERIOD],[OBS_STATUS],[OBS_COMMENT] FROM [data].[VI_CurrentDataDataFlow_24_A]) virtualDataset
ORDER BY INDEX
- Time dimension
SELECT DISTINCT TIME_PERIOD
FROM (SELECT [SID], [LOCATION],[SUBJECT],[MEASURE],[FREQUENCY],[TIME_PERIOD] AS [TIME_PERIOD],[PERIOD_START],[PERIOD_END],[OBS_VALUE],[OBS_STATUS],[TIME_FORMAT],[UNIT],[REFERENCEPERIOD],[POWERCODE] FROM [data].[VI_CurrentDataDataFlow_142_A]) virtualDataset
ORDER BY TIME_PERIOD
Addressed in #230 (closed):
In order for this feature to be used instead of the actual content constraint, the result when there is no data should be an empty available constraint with a value of 0 observations.
Edited by Jens Dossé