Data Storage Integration
Data storage routes enable automatic persistence of MQTT messages to databases and files. Store sensor data for analytics, create historical archives, aggregate logs, and build time-series datasets—all configured through LoT syntax.Supported Databases
PostgreSQL
Open-source relational database for structured data storage.
MySQL
Popular relational database with wide ecosystem support.
MariaDB
MySQL-compatible database with enhanced features.
SQL Server
Microsoft SQL Server for enterprise environments.
MongoDB
Document database for flexible JSON storage.
OpenSearch
Real-time analytics, search, and visualization.
CrateDB
Distributed SQL optimized for time-series data.
Snowflake
Cloud data warehouse for large-scale analytics.
File Storage
CSV and JSON file storage for simple persistence.
Database Comparison
| Database | Type | Best For | Query Format |
|---|---|---|---|
| PostgreSQL | Relational | Structured data, complex queries | SQL |
| MySQL | Relational | Web applications, general purpose | SQL |
| MariaDB | Relational | MySQL compatibility with extras | SQL |
| SQL Server | Relational | Enterprise, Windows environments | SQL |
| MongoDB | Document | Flexible schemas, JSON data | CLEAN |
| OpenSearch | Search/Analytics | Full-text search, dashboards | CLEAN |
| CrateDB | Time-Series | High-volume sensor data | SQL |
| Snowflake | Cloud Warehouse | Large-scale analytics | SQL |
| File Storage | File | Simple logging, backups | CLEAN |
Common Architecture
All data storage routes share a common architecture with two key components:1. Connection Configuration
Each database has specific connection parameters:2. EVENT Definitions
EVENTs define what data to store and where:Common Query Placeholders
These placeholders work across all database routes:| Placeholder | Description |
|---|---|
{value} | Full MQTT payload as string |
{value.json} | Parsed JSON payload |
{value.json.field} | Specific field from JSON |
{timestamp} | Message timestamp |
{source_topic} | Original MQTT topic |
{field} | Field extracted from topic path |
Extracting Fields from Topics
For topicsensors/temp001/reading, use these placeholders:
| Placeholder | Value |
|---|---|
{source_topic} | sensors/temp001/reading |
{sensor_id} | temp001 (position 2 in topic) |
Query Formats
SQL Format
For relational databases (PostgreSQL, MySQL, MariaDB, SQL Server, CrateDB, Snowflake):CLEAN Format
For document databases and search engines (MongoDB, OpenSearch, File Storage):Common EVENT Parameters
Trigger & Routing
Trigger & Routing
Query
Query
SQL statement or CLEAN format query with placeholders.
Best Practices
Use SSL in Production
Use SSL in Production
Always enable SSL for database connections:
Separate Read and Write Credentials
Separate Read and Write Credentials
Create dedicated database users with minimal permissions for the route.
Monitor Database Size
Monitor Database Size
Implement data retention policies:
- Index lifecycle management
- Time-based partitioning
- Automatic cleanup jobs
Structure Data with Models
Structure Data with Models
Use LoT Models to structure data before storage:
Use Connection Pooling
Use Connection Pooling
For high-throughput scenarios, configure connection pools where supported.

