Clean CRATEDB table example

clean crate

This project showcases how to clean CRATEDB table every 24h using databases RESTful API.

Services Used

  • CRATEDB – Database

List of used nodes

  • Inject/Timestamp – Triggers flow execution

  • Function – Adds custom logic using JavaScript

  • HTTP Request – Sends HTTP requests to external services

  • JSON – Converts data between JSON and object format

  • Debug – Displays messages in the debug console

For details, see Node-RED Documentation

FLOW: SELECT 10 Latest Table Entries

This flow demonstrates how to execute SQL queries using CrateDB’s HTTP API. It is primarily used for testing whether recent entries are being properly removed or retained in the database. The flow sends an HTTP POST request containing a SQL SELECT query to fetch the 10 most recent records from a specific table.

FLOW: Clean CrateDB Table Every 24h

This flow demonstrates how to automatically delete old entries from a CrateDB table. It constructs and sends a DELETE SQL query to the CrateDB HTTP API once every 24 hours. An Inject node triggers the request daily at 12:00 noon, ensuring the table remains clean and avoids unbounded data growth.