Details
-
Type: Monitor
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: FIWARE-TECH-HELP
-
Labels:
Description
Created question in FIWARE Q/A platform on 10-10-2024 at 23:10
Please, ANSWER this question AT https://stackoverflow.com/questions/79076178/how-do-fiware-scorpio-temporal-entities-are-stored-and-work
Question:
How do FIWARE Scorpio temporal entities are stored and work?
Description:
I deploy a basic FIWARE Scorpio stack with a docker compose :
services:
postgres:
image: postgis/postgis
ports:
- "5432"
environment:
POSTGRES_USER: ngb
POSTGRES_PASSWORD: ngb
POSTGRES_DB: ngb
scorpio:
image: scorpiobroker/all-in-one-runner:java-latest
environment:
DBHOST: postgres
ports:
- "9090:9090"
depends_on: - postgres
I also have a .sh code to add entities, a part of it is :
SCORPIO_URL="http://localhost:9090/ngsi-ld/v1/temporal/entities"
NGSI_LD_CONTEXT="https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
FIWARE_SERVICE="test_service"
FIWARE_SERVICEPATH="/weather"
create_weather_entity() {
response=$(curl -X POST "$SCORPIO_URL" \
-H "Content-Type: application/ld+json" \
-H "fiware-service: $FIWARE_SERVICE" \
-H "fiware-servicepath: $FIWARE_SERVICEPATH" \
-d '{
"id": "urn:ngsi-ld:WeatherObserved:001",
"type": "WeatherObserved",
"temperature":
,
"barometricPressure":
,
"dateObserved":
,
"source":
,
"@context": [
,
"'$NGSI_LD_CONTEXT'"
]
}')
echo "Create WeatherObserved Response: $response"
}
And a code to simulate the sending of measurements :
SCORPIO_URL="http://localhost:9090/ngsi-ld/v1/temporal/entities/"
NGSI_LD_CONTEXT="https://fiware.github.io/data-models/context.jsonld"
FIWARE_SERVICE="test_service"
FIWARE_SERVICEPATH="/weather"
send_weather_measurements() {
local temperature=$(shuf -i 15-35 -n 1)
local pressure=$(shuf -i 700-750 -n 1)
local timestamp=$(date u +"%Y%m-%dT%H:%M:%S.%3NZ")
echo "Sending WeatherObserved measurement:"
echo " Temperature: $
°C"
echo " Barometric Pressure: $
hPa"
echo " Observed At: $
"
curl -X PATCH "$
{SCORPIO_URL}urn:ngsi-ld:WeatherObserved:001/attrs" \
-H "Content-Type: application/ld+json" \
-H "fiware-service: $FIWARE_SERVICE" \
-H "fiware-servicepath: $FIWARE_SERVICEPATH" \
-d '{
"temperature":
,
"barometricPressure":
,
"dateObserved":
,
"@context": "'$NGSI_LD_CONTEXT'"
}'
}
I would like to store these historical contexts into the postgres sql db (not ok), and then connect it to Grafana (this part should be ok).
When I do :
curl -X GET "http://localhost:9090/ngsi-ld/v1/temporal/entities/urn:ngsi-ld:WeatherObserved:001"
-H "Content-Type: application/ld+json"
-H "fiware-service: test_service"
-H "fiware-servicepath: /weather"
It works so the entity is saved. But when I check inside the postgres db, I only see these tables and can't find the ones corresponding to my entities :
tiger | faces | table | ngb
tiger | featnames | table | ngb
tiger | geocode_settings | table | ngb
tiger | geocode_settings_default | table | ngb
tiger | loader_lookuptables | table | ngb
tiger | loader_platform | table | ngb
tiger | loader_variables | table | ngb
tiger | pagc_gaz | table | ngb
tiger | pagc_lex | table | ngb
tiger | pagc_rules | table | ngb
tiger | place | table | ngb
tiger | place_lookup | table | ngb
tiger | secondary_unit_lookup | table | ngb
tiger | state | table | ngb
tiger | state_lookup | table | ngb
tiger | street_type_lookup | table | ngb
tiger | tabblock | table | ngb
tiger | tabblock20 | table | ngb
tiger | tract | table | ngb
tiger | zcta5 | table | ngb
tiger | zip_lookup | table | ngb
tiger | zip_lookup_all | table | ngb
tiger | zip_lookup_base | table | ngb
tiger | zip_state | table | ngb
tiger | zip_state_loc | table | ngb
topology | layer | table | ngb
topology | topology | table | ngb
How should I do to store the historical values into a postgres SQL database?
Thank you in advance for any help!