@brobridge/atomic-postgresql 0.0.1
PostgreSQL Database module for Brobridge Atomic
atomic-postgresql
A PostgreSQL module for Atomic, compatible with Node-RED.
Overview
@brobridge/atomic-postgresql
is a PostgreSQL database module designed specifically for Atomic, fully compatible with the Node-RED development environment. It provides two main nodes:
- PostgreSQL Connection: Configure database connection parameters.
- PostgreSQL Execute: Perform SQL queries and data operations.
Installation
npm install @brobridge/atomic-postgresql
After installation, the module is automatically registered in the Node-RED node palette.
PostgreSQL Connection Node
This node is used to configure the connection to the PostgreSQL database and can be shared across other nodes.
Configuration Options
- Name: Identifier for this connection
- Server: PostgreSQL host address
- Port: Port number (default: 5432)
- Username / Password: Database login credentials
- Database: Default database name
- Max Pool Size: Maximum number of connections in the pool
- Reconnect Interval: Time interval (in milliseconds) for retrying connections
PostgreSQL Execute Node
This node executes SQL queries. It supports both static and dynamic SQL sources, and includes a SQL Playground for interactive testing.
Configuration Options
- Name: Node name
- Connection: Choose a configured
PostgreSQL Connection
- Output Property: Where to store the execution result (e.g.,
msg.payload
) - Query Source: Determines the SQL query source:
auto
: Usesmsg.query
if present; otherwise uses the built-in SQL Command.static
: Uses only the built-in SQL Command, ignoringmsg.query
.dynamic
: Uses only the SQL string provided inmsg.query
; skips execution if missing.
- SQL Command: Default SQL statement. You can reference properties from the Node-RED message object using
${msg.payload.xxx}
.
Using Variables in SQL
You can insert values from the msg
object into the SQL statement using the ${}
syntax.
Example:
SELECT * FROM users WHERE id = ${msg.payload.id}
Execution Result Format
On Success:
msg.payload = {
results: [ /* Array of query results */ ]
}
On Failure:
msg.error = {
code,
message,
stack
}
SQL Playground
The PostgreSQL Execute
node includes a built-in SQL Playground, allowing you to write and run SQL queries interactively.
Example Flow: Full Data Type Coverage
The included example.json
demonstrates a complete flow that includes:
- Simulating input using an
inject
node - Processing fields using a
function
node intomsg.payloadBak
- Executing CREATE, INSERT, SELECT, and DROP operations with the
PostgreSQL Execute
node - Observing results with a
debug
node
Refer to the example.json
file to load and explore the complete flow.
Commercial Support
Brobridge provides the customer service which contains comprehensive technical and commercial support for the module.
License
This module is licensed under the Apache License.
Authors
Copyright(c) 2025 Jhe Sue <[email protected]>