I need to add a dashboard query that is simple to write with SQL but seems to be complex to write with the CDF API.
Input parameters:
- start and end timestamp range
- List of time series to query
Query steps:
- For each time series in the list, sum all values that are in the user provided range
- Order time series by the sum
- Return metadata from the top 10 of this ordered list
Maybe something equivalent to this:
-- Likely SLOW in a SQL DB with many datapoints
-- This is a conceptual example, so simplifying by combining Time Series and
-- Data Points to single entity.
Select TOP 10 TimeSeries.Name, SUM(TimeSeries.Value)
FROM TimeSeries
WHERE TimeSeries.Id IN (@ListOfTimeSeries)
AND TimeSeries.Timestamp >= @StartTimestamp
AND TimeSeries.Timestamp < @EndTimestamp
GROUP BY TimeSeries.Id, TimeSeries.Name
ORDER BY SUM(TimeSeries.Value)
What’s the simplest way to get to this data with the tools provided to a software developer interacting with CDF?