Generate and insert data into a Postgres database
Workflow preview
$20/month : Unlimited workflows
2500 executions/month
THE #1 IN WEB SCRAPING
Scrape any website without limits
HOSTINGER
Early Deal
DISCOUNT 20% Try free
DISCOUNT 20%
Self-hosted n8n
Unlimited workflows - from $4.99/mo
#1 hub for scraping, AI & automation
6000+ actors - $5 credits/mo
Important notice
This workflow is provided as-is. Please review and test before using in production.
Overview
This is Workflow 1 in the blog tutorial Database activity monitoring and alerting.
Prerequisites
- A Postgres database set up and credentials.
- Basic knowledge of JavaScript and SQL.
Nodes
- Cron node starts the workflow every minute.
- Function node generates sensor data (sensor id (preset), a randomly generated value, timestamp, and notification (preset as false) )
- Postgres node inserts the data into a Postgres database. You can create the database for this workflow with the following SQL statement:
CREATE TABLE n8n (id SERIAL, sensor_id VARCHAR, value INT, time_stamp TIMESTAMP, notification BOOLEAN);