Welcome SQLDB and dashDB nodes to Node-RED family!

5 min read

Welcome SQLDB and dashDB nodes to Node-RED family!

The Node-RED starter community boilerplate in Bluemix has been an extremely popular service as it allows developers to simplify the coding of apps that wire things together using visual tools. The Node-RED flow editor allows developers to bring sensors, devices and apps together and facilitates collection of data for “if this then that” application. With its rich set of nodes, it always attracted variety of developers from all walks of programming. However, if a developer wanted to pump data into a relational database and use SQL for analytic queries or R models for statistical analysis, he had a little choice—until now.

I am happy to announce that my colleagues Steven Chamberlin and Nicholas Vargas in IBM Cloud data services team have developed a pair of nodes for SQLDB and dashDB services and contributed to the Node-RED community. As of last week, you can create a Node-RED app in Bluemix that will give you the four extra nodes, two each for SQLDB and dashDB.

Node-RED app

SQLDB Output Node:

This node stores elements from the msg.payload into your SQLDB service. The msg.payload should include a value for each column in your table. If you put a ‘TIMESTAMP’ string as one of the values, the node will replace it with the current timestamp in DB2 format.

  • Service should point to your SQLDB service.

  • Table should point to the table you wish to insert the values into. This table needs to exist already in the database and needs to contain the same columns and datatypes that you are inserting through this node. The data needs to be in the format accepted by DB2 and within the appropriate ranges/parameters for that datatype.

  • Name Optionally give your node a name, otherwise the default will be the table name.

SQLDB Query Node:

This node executes a query on your SQLDB service database and passes along the result set in the msgobject, as msg.payload.

  • Service should point to your SQLDB service

  • Query is the query you wish to execute on your SQLDB service database. If it is empty, it will look for the query in the msg.payload.

  • Parameter Markers is a comma delimited set of JSON paths. These will replace any question marks that you place in your query, in the order that they appear.

  • Name Optionally give your node a name, otherwise the default will be the table name.

dashDB Output Node:

This node stores elements from the msg.payload into your dashDB service. The msg.payload should include a value for each column in your table. If you put a ‘TIMESTAMP’ string as one of the values, the node will replace it with the current timestamp in DB2 format.

  • Service should point to your dashDB service.

  • Table should point to the table you wish to insert the values into. This table needs to exist already in the database and needs to contain the same columns and datatypes that you are inserting through this node. The data needs to be in the format accepted by DB2 and within the appropriate ranges/parameters for that datatype.

  • Name Optionally give your node a name, otherwise the default will be the table name.

dashDB Query Node:

This node executes a query on your dashDB service database and passes along the result set in the msgobject, as msg.payload.

  • Service should point to your dashDB service.

  • Query is the query you wish to execute on your dashDB service database. If it is empty, it will look for the query in the msg.payload.

  • Parameter Markers is a comma delimited set of JSON paths. These will replace any question marks that you place in your query, in the order that they appear.

  • Name Optionally give your node a name, otherwise the default will be the table name.

Go, try these nodes in Node-RED in Bluemix and build your cool analytic app. In my next post I will discuss how to use dashDB’s integrated R capability to develop models and generate graphs.

Be the first to hear about news, product updates, and innovation from IBM Cloud