Adding measurements to an SQL collector
Measurements can be added to an SQL collector by:
- Manually adding measurements
- Bulk importing measurements
- Adding measurements using the APIAdding measurements using the API
Manually add a measurement
Follow the guide on Creating a measurement for general instructions on how to create a measurement.
Once the collector is successfully configured, you can add one or more measurements. A measurement defines which results from your SQL query map into Historian.
To create a new measurement manually, open the Measurements page in the Factry Historian web interface and click + Create Measurement.
Basic settings
- MeasurementKey: Maps the measurement_key column from the query result. (Required)
For example, looking at this query from the SQL collector configuration:
SELECT
s.id AS measurement_key,
s.value AS value,
s.timestamp AS ts,
s.updated AS updated,
'Good' AS quality,
t.line_nr AS tag_line_nr
FROM sensors s
INNER JOIN tags t ON s.pk = t.sensor_pk
WHERE updated > ?;The output might look like this:
measurement_key | value | ts | updated | quality | tag_line_nr |
|---|---|---|---|---|---|
sensor_temp | 14 | 2025-09-10 00:00:30Z | 2025-09-10 02:00:42Z | Good | 45 |
sensor_volume | 100 | 2025-09-10 00:13:45Z | 2025-09-10 00:15:30Z | Good | 6 |
sensor_weight | 66 | 2025-09-10 00:21:40Z | 2025-09-10 00:33:30Z | Good | 2 |
In this case, you would enter sensor_temp, sensor_volume, or sensor_weight as the MeasurementKey when creating a measurement in Historian.
Please take into account the warning about tag cardinality in our Data modelData model.