Skip to main content

Real-time Data Storage

Purpose

This target writes the latest value of each variable in the forwarding group to a database. Use it to provide current data for dashboards, API queries, or reports. The real-time table keeps the latest record rather than a change history.

Configure the forwarding group range, trigger, and runtime state through Data Forwarding. This page covers only the database properties and debug panel specific to real-time storage.

Open the plugin

Open Development Configuration → Data Forwarding and:

  1. Configure and save the forwarding group range, trigger, interval, online filter, and batching.
  2. Add a target, choose Real-time Data Storage, and fill in the basic target information.
  3. Open Target properties and configure the relational database, table, time-zone offset, and offline filter.
  4. Optionally select a saved real-time-table Dynamic SQL expression; leave it empty for the standard table.
  5. Save and enable the target, then update a test variable and query the real-time table.

Basic target information

SettingDefaultConfiguration
Group-Select a saved forwarding group.
Target name-Required and unique within the group.
EnableEnabledDisable to stop initialization and writes.
Log levelInfoTemporarily use Debug for connection or write diagnostics.
Start timeout60 secondsValid range is 1 to 3600 seconds.

Target properties

SettingDefaultConfiguration
Database typeSqlServerSupports SqlServer, MySql, Sqlite, and PostgreSql. Use the matching connection-string syntax.
Connection stringDevelopment SQL Server exampleReplace with the actual endpoint, database, account, and password; the account must create, query, and write tables.
Real-time table namerealValueStandard table storing one latest row per variable. Use a different table or database for each target.
Real-time table scriptEmptySelect a saved Dynamic SQL expression to own table creation and writes; empty uses the standard table.
Time-zone offset+08:00Enter a fixed offset such as +08:00 or -05:00; empty means UTC. Use the same convention when querying.
Filter offline dataDisabledExcludes offline variables from writes; the forwarding-group online filter also applies.

Relational connection strings

DatabaseExample
SQL ServerServer=127.0.0.1,1433;Database=thingsgateway_realtime;User Id=history_user;Password=<password>;TrustServerCertificate=True;
MySQLServer=127.0.0.1;Port=3306;Database=thingsgateway_realtime;Uid=history_user;Pwd=<password>;
SQLiteData Source=DB/realtime.db;journal mode=WAL
PostgreSQLHost=127.0.0.1;Port=5432;Database=thingsgateway_realtime;Username=history_user;Password=<password>;

Real-time storage supports only these four relational databases. It upserts by variable ID rather than appending history events, and a write failure waits for the next snapshot or value change instead of using the history target's CacheDB outbox.

Target-variable properties

This plugin has no target-variable properties. Variable membership and trigger behavior come from the forwarding group.

Target debug

Open Development Configuration → Data Forwarding, select the forwarding group and target, and open Debug.

FeaturePurpose
Forwarding pipelineShows the variable range, trigger, and data entering the real-time table.

Forwarding pipeline

Real-time Data Storage forwarding pipeline

The pipeline shows the variable range, trigger, variable count, and a summary of data entering the target. Real-time storage updates the latest values directly and does not provide a cache-outbox panel.

Verify the target

  1. Enable the forwarding group and target, then confirm that the target is online.
  2. Update one variable included in the forwarding group.
  3. Query the real-time table and confirm variable ID, value, collection time, update time, and online state.
  4. Update the same variable again and confirm that its row is overwritten rather than appended.

Troubleshooting

SymptomCheck
Target does not startDatabase type, connection string, network access, and database permissions.
Latest value is not updatedForwarding group range, target state, and whether Filter offline data excluded the variable.
The table still shows an old valueConfirm the configured table name and variable identifier.
Data disappears during a database outageReal-time storage does not use the history target's CacheDB retry queue. Restore the database and trigger a new snapshot or value change.
  • Data Forwarding: Forwarding groups, ranges, triggers, cache, redundancy, and target runtime operations.
  • Plugin Manual Index: Other collection and data-forwarding plugins.