Database
About
In this section, the database is described, so you can use this knowledge to write queries in Grafana.
Structure
The database in NOA Portal that contains your device data is a PostgreSQL database. For each tenant, there is one database. This database consists of multiple tables depending on the number of devices in the tenant. The devices act as a schema in the database. For each device in the tenant, there are three tables:
- measurements: contains datatypes int, float
- logs: contains datatype string
- switches: contains datatype boolean
These tables contain the timestamp, parameter ID and value of the datapoints of the devices. The timestamp is a Unix timestamp in milliseconds,
the parameter ID is an identifier of the datapoint and value is the actual value of the datapoint.
The structure is visualized in the following image.
Example Query
In the image below, you can see how you can write a Grafana query based on the structure of the database explained above. The device ID, parameter ID and
table are highlighted, to show that you need to change these, when you want to retrieve another datapoint. Besides that, you can see that this query
contains the timestamp and values, which are also logged and are explained above. The visualized query below was automatically generated using the
feature Generate Grafana panel, which is described in Transferred Data.

