Skip to content

Commit

Permalink
feat: add a default SQL view for easy Grafana querying
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeal committed Dec 18, 2024
1 parent 54678fd commit 4e151fc
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE VIEW flattened_entities_attributes_values AS (
SELECT entity_payload.entity_id,
TRIM(JSONB_PATH_QUERY_FIRST(entity_payload.payload, '$."https://schema.org/name"[0]."https://uri.etsi.org/ngsi-ld/hasValue"[0]."@value"')::TEXT, '"') AS "entity_name",
attribute_name,
dataset_id,
time,
measured_value AS value
FROM attribute_instance
LEFT JOIN temporal_entity_attribute ON temporal_entity_attribute.id = attribute_instance.temporal_entity_attribute
LEFT JOIN entity_payload ON entity_payload.entity_id = temporal_entity_attribute.entity_id
);

0 comments on commit 4e151fc

Please sign in to comment.