Giter Site home page Giter Site logo

radu103 / node-red-contrib-sap-hana Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 4.0 44 KB

Node-RED flow nodes to execute commands, queries and do other often used operations with SAP HANA database

HTML 39.85% JavaScript 60.15%
nodejs node-red node-red-contrib node-red-flow sap saphana

node-red-contrib-sap-hana's Introduction

node-red-contrib-sap-hana

Node-RED nodes to work with a SAP HANA database

Change Log

v1.2.3 - Split the node in separate files & readme updates

v1.2.2 - Bugfix : removed node type that is not used

v1.2.1

  • Feature added : New node type table_insert for inserts receiving an array of objects (from http-in node)
  • BIG CHANGE/INCOMPATIBILITY : Node type names have changed/simplified and may be found in different group sap hana now.

v1.1.1 - Feature added : New node type saphanatablemonitor with configurable interval and query that may be used to monitor when #no-of-records in a table is changing

v1.0.5 & v1.0.6- Readme update : User has to be SCHEMA OWNER or to have HDI ADMIN user priviledges (not the users seen in XSA Environment *_RT, *_DT)

v1.0.4 - Readme fix

v1.0.2 - Feature added : Insert in msg.payload an Array of sql script commands (Example flows updated also)

v1.0.1 - INSERT, UPDATE, DELETE and other SQL script sql commands work

Install

Configure SAP Node.Js repository : npm set @sap:registry=https://npm.sap.com

Install from npm or install from Manage Pallete in Node-RED

cd $HOME/.node-red/
npm install node-red-contrib-sap-hana

Do not forget to edit /etc/hosts for default hxehost replacing X.Y or whole IP address if you're using hxehost as hostname

192.168.X.Y hxehost

Usage

This package contains one node to run a sql command, call a procedure or a select statement for SAP HANA database using the office @sap/hana-client Node.JS driver.

Example flows here :

1. sap_hana_config node

Create a new SAP HANA user from SAP Hana Studio and you'll get a schema with the same name created by the system.

Use this new user and all the content will be saved in his schema as he's the owner.

Node config parameters :

  • Database host name
  • Database host port
  • User name to access the database
  • Password for the user name above

2. run_query node

To run a command or a query input to saphana node the folowing message :

msg.topic = "SQL"; // or lower case 'sql'
msg.payload = "SELECT * FROM DUMMY";
return msg;

Also it works with an array of queries

msg.topic = "SQL"; // or lower case 'sql'
msg.payload = [
	'SELECT * FROM DUMMY', 
	'INDERT INTO "table_name" ("col1", "col2") VALUES (\'val1\', \'val2\')'
];
return msg;

The returned data will be stored in msg.payload and it will contain the @sap/hana-client response.

As an OK response you'll receive on the run_query response:

{
	topic : "RESULT_IN_PAYLOAD",
	payload : [{"DUMMY":"X"}];
}

Error response example :

{
	topic : "ERROR",
	payload : {
	
	};
}

3. table_monitor node

Node config parameters :

  • query to run at each iteration with setInterval function
  • interval delay time (in seconds)

At each interval Error response example :

{
	"topic":"RESPONSE_IN_PAYLOAD",
	"payload":{
		"lastCount":1,
		"newCount":1,
		"trigger":false
	}
}

4. table_insert node

For input : forward from an http-in node or from another node type an array of objects

Node config parameters :

  • Table Name
  • Columns (property names from the js objects found in array) to be used in the SQL INSERt query

Other Informations

Currently, only SAP HANA Express has been tested.

Please let me know if you have any issue.

Authors

node-red-contrib-sap-hana's People

Contributors

radu103 avatar

Watchers

 avatar

node-red-contrib-sap-hana's Issues

The node reset entire msg

Hi,
The node set the query result in msg.payload[0] object, but the entire msg object is emptied.
If i define a msg.data object in the input message of the node, in the output message msg.data is not present.
The topic is overvritten too (with the fixed string "RESULTS_IN_PAYLOAD").
Actually there are no way to use payload (or topic) data defined before use the node.

node-red-contrib-sap-node node installation Fail from manage palette

What are the steps to reproduce?

  • try to install node-red-contrib-sap-node from manage palette in node-red .

What happens?

If we try to install the sap hana node from manage palette it is failing to install.

  1. Tested Node-Red Image using

docker run command using proxy network able to install SAP Hana node in the specified UserDir.
but same image using docker compose file with proxy network installation of SAP node is failing in specified UserDir.
docker run Command :
docker run -it -p 1880:1880 nodered:latest
Please find the attached compose file.
docker-compose.txt

2.Tried with root user using docker compose file Node installation is failed.

Error:

node_modules/@sap/hana-client/prebuilt/linuxx86_64-gcc48/hana-client.node: failed to map segment from shared object
TypeError: Cannot read property '__stopAllWork' of null
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! @sap/[email protected] install: node checkbuild.js
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the @sap/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-04-21T06_57_45_674Z-debug.log

What do you expect to happen?

-it should install the sap hana node with docker compose also in the specified UserDir.

Please tell us about your environment:

  • Node-RED version: 1.2.5
  • Node.js version: v10.19.0
  • npm version: 6.13.4
  • Platform/OS: Docker / Debian OS
  • Browser: Mozilla firefox/ Google Chrome

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.