@brobridge/atomic-postgresql 0.0.1

PostgreSQL Database module for Brobridge Atomic

npm install @brobridge/atomic-postgresql

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: Uses msg.query if present; otherwise uses the built-in SQL Command.
    • static: Uses only the built-in SQL Command, ignoring msg.query.
    • dynamic: Uses only the SQL string provided in msg.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:

  1. Simulating input using an inject node
  2. Processing fields using a function node into msg.payloadBak
  3. Executing CREATE, INSERT, SELECT, and DROP operations with the PostgreSQL Execute node
  4. 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]>

Node Info

Version: 0.0.1
Updated 5 hours ago
License: APL
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • PostgreSQL Connection
  • PostgreSQL Execute

Keywords

  • postgresql
  • node-red
  • atomic

Maintainers