Skip to content

Commit

Permalink
feat: add a default SQL view for easy Grafana querying (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeal authored Dec 21, 2024
1 parent 336a800 commit a76f793
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 a76f793

Please sign in to comment.