Giter Site home page Giter Site logo

node-red-contrib-postgres's Introduction

Node-red Postgres Suite

RedConnect Approved

Install

Run the following command in the root directory of your Node-RED install

npm install node-red-contrib-postgres

Overview

This add-on, includes a suite of nodes to work with Postgres :

  • PG Connection
  • PG Insert
  • PG Update
  • PG Select

The first node accepts a string that represents the query to be executed.

The last 3 nodes accept an Object and outputs a Postgres query that can be used with the PG Connection node.

PG Connection

The PG Connection node accepts as a parameters an ​postgresdb​ config node, the parameter ​*Receive query output ?*​ needs to be used in the case the query produces results (like a Select).

PG Insert

The parameters for the Insert node are the name of table in which data is inserted.

The ​msg.payload​ is the data that will be inserted, this data is filtered using the ​Accepted columns​ param, in the case the param is empty - are used all the columns available on ​msg.payload​. Enabling the ​All columns required ?​ parameter, if in the ​msg.payload​ aren't available all the columns accepted by the node, the query is rejected (This param is ignored in the case the param ​Accepted columns​ is empty).

PG Update

Like the PG Insert, this node has the parameters table name and accepted column. These are the columns where the data will be updated. The parameter ​Where Columns​ works exactly like the parameter ​Accepted Columns​, the values for the where needs to be specified on the ​msg.where

Example Input

{
   "payload" : {
       "foo" : 1,
       "bar" : "xD",
       "test": 2
   },
   "where" : {
       "foo" : 4
   }
}

PG Select

Like the ​PG Update​ node, this node accept the parameter ​Where Columns​, in that case the where clause is specified in the ​msg.payload​, in the case the ​Ignore the where clause ?​ parameter is enabled, the ​msg.payload​ and every time the node is triggered the input isn't checked.

The ​columns​ parameter are the columns that you want to select from the table, in the case a ​msg.group​ is passed to the node, the ​Group by​ parameter is overwritten, same thing for ​msg.order

For each of the ​limit​, ​offset​ parameters, in the case the value set is different from 0, the ​msg.limit​ / ​msg.offset​ is ignored

node-red-contrib-postgres's People

Contributors

dhartveld avatar krisdaniels avatar mcarboni-redant avatar mk-2001 avatar retailos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.