Home Applications node-red-contrib-iris

node-red-contrib-iris

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
0
0 reviews
0
Awards
116
Views
0
IPM installs
0
0
Details
Releases
Reviews
Issues
Pull requests
Articles
An Interface for Node-Red to InterSystems IRIS Data Platform.

What's new in this version

initial realease


node-red-contrib-irisLogo

node-red-contrib-iris

An interface for Node-RED to InterSystems IRIS Data Platform.



Requirements


Installation

Install the Node-RED package

Either use the Node-RED Menu - Manage Palette - Install menu, or run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-contrib-iris

Import Native API

In the ~/.node-red/settings.js file add module in (already existing) functionGlobalContext:

functionGlobalContext: {
    // os:require('os'),
    iris: require('./node_modules/node-red-contrib-iris/intersystems-iris-native'),
}

You can find the API package under .node-red/node_modules/node-red-contrib-iris/intersystems-iris-native. Please check the README file for supported operating systems. If your OS is not supported you can get the API from your Intersystems IRIS instance under: ~/IRIS/dev/nodejs/intersystems-iris-native.

See the documentation for how to load additional modules into Node-RED.

Download Node.IRISInterface

Go to raw.githubusercontent. Do a right click on the page and choose Save Page As… . Afterwards go to the InterSystems Management Portal and navigate to System Explorer > Classes and click on Import. There you select the file you just downloaded and click Import.
When you only operate in one namespace, import the class into this namespace. When you have multiple namespaces you want to have access to, map the class to namespace %ALL.


Connect to IRIS

Set connection properties via the node properties. The Node will build a connection when you deploy and will hold that connection up until you redeploy or disconnect manually.

NodeProperties

You can set the default properties in ~/.node-red/node_modules/node-red-contrib-iris/ServerProperties.json. Or use the SetServerProperties flow under Import > Examples > node-red-contrib-iris > SetServerProperties.


Usage

The nodes are secure against SQL injection by parametrize the statements.
Pass the SQL statement as a string in the msg.data field and the node will parameterize the statement itself.

msg.data = "SELECT * FROM NodeRed.Person WHERE Age >= 42 AND Name = 'Max' ";

Or a parameterized statement:

msg.data = {
    sql: 'SELECT * FROM NodeRed.Person WHERE Age >= ? AND Name = ? ',
    values: [42, 'Max'],
};

Nodes

  • IRIS - A Node for executing DML statements such as SELECT, UPDATE, INSERT and DELETE and DDL statements such as CREATE, ALTER and DROP in Intersystems IRIS.
  • IRIS_CREATE - Creates a class in Intersystems IRIS.
  • IRIS_DELETE_CLASS - Deletes a class in Intersystems IRIS.
  • IRIS_INSERT - A Node for only SQL-INSERT-Statements. Can also generate the class, if it does not already exists, based on the statement.
  • IRIS_OO - Can insert a hierarchical JSON-Object.
  • IRIS_CALL - Call Intersystems IRIS classmethods.

See Node description for further informations.


Bugs

  • Currently does not work in Docker Container!
  • The statement will be parametrized wrong if whitespaces and commas used in strings. Please parametrize the Statement before. Example:

Does not work:

msg.data = "SELECT * FROM NodeRed.Person WHERE Name = 'Smith, John'";

But this will work:

msg.data = {
    "sql":"SELECT * FROM NodeRed.Person WHERE Name = ?,
    "values":["Smith, John"]
    }


npm
GitHub
nodered.org
CHANGELOG
InterSystems Developer Community


by Philipp B.
Powered by InterSystems.

Read more
Version
1.0.030 Nov, 2023
Category
Integration
Works with
InterSystems IRIS
First published
20 Oct, 2022