CrateDB Overview
TheCRATEDB route stores MQTT messages in CrateDB, a distributed SQL database optimized for time-series and machine data. It combines the familiarity of SQL with the scalability needed for IoT workloads.
CrateDB excels at high-volume time-series data with fast ingestion and SQL query capabilities. Use it when you need real-time analytics on sensor data at scale.
Basic Syntax
Connection Configuration
CRATEDB_CONFIG Parameters
CrateDB server hostname or IP address.
Database username.
Database password.
Writing Data
- Basic Time-Series
- High-Volume Metrics
- Multiple Tables
- UPSERT
- UPDATE
- DELETE
Store sensor readings with timestamps:
Alternative: STORE IN with Models — Instead of writing EVENT queries, you can bind a model directly to this route. Every See Data Storage Overview for the full STORE IN workflow.
PUBLISH MODEL call automatically inserts a row — no query needed:Reading Data
EVENTs also support SELECT queries to read data back from the database. Publish a message to the event’sSOURCE_TOPIC, and the query result is published to DESTINATION_TOPIC:
db/result/latest, where your actions or external clients can consume it.
Timed Polling
EVENTs can also run SELECT queries on a fixed schedule usingWITH EVERY. This is especially powerful with CrateDB’s fast aggregations:
Table Schema Examples
Create tables optimized for time-series:Troubleshooting
Connection Failed
Connection Failed
- Verify HOST and PORT are correct
- Check CrateDB is running and accepting connections
- Verify firewall allows connections on port 5432
Authentication Failed
Authentication Failed
- Verify USERNAME and PASSWORD are correct
- Check user has permissions on the DATABASE
Query Errors
Query Errors
- Verify table exists and has correct schema
- Check column types match inserted data
Next Steps
Data Storage Routes Overview
Compare all storage options.
Snowflake Route
Configure Snowflake cloud data warehouse.

