Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Bubble Hana Plugin - Notebook

node v14.20.1
version: 2.0.0
endpointsharetweet
const url = require('url'); exports.endpoint = function(request, response) { let {query} = url.parse(request.url, true); var hana = require("@sap/hana-client"); if (query.date) { var where = ' WHERE "UpdateDate" >= ' + "'" + query.date + "'"; if (query.time) { var and = ' AND "UpdateTS" > ' + "'" + query.time + "'"; } else { var and = ""; } } else { var where = ""; } switch (query.table.toUpperCase()) { case "TEST-OPRQ": var sql = process.env.hom_oprq + where + and; break; case "TEST-PRQ1": var sql = process.env.hom_prq1 + where + and; break; case "TEST-OPOR": var sql = process.env.hom_opor + where + and; break; case "TEST-POR1": var sql = process.env.hom_por1 + where + and; break; case "TEST-OCRD": var sql = process.env.hom_ocrd + where + and; break; case "TEST-OITM": var sql = process.env.hom_oitm + where + and; break; case "TEST-OUSR": var sql = process.env.hom_ousr + where + and; break; case "LIVE-OPRQ": var sql = process.env.oprq + where + and; break; case "LIVE-PRQ1": var sql = process.env.prq1 + where + and; break; case "LIVE-OPOR": var sql = process.env.opor + where + and; break; case "LIVE-POR1": var sql = process.env.por1 + where + and; break; case "LIVE-OCRD": var sql = process.env.ocrd + where + and; break; case "LIVE-OITM": var sql = process.env.oitm + where + and; break; case "LIVE-OUSR": var sql = process.env.ousr + where + and; break; default: var missing = 'X'; break; } var connOptions = { serverNode: process.env.serverNode, UID: process.env.user, PWD: process.env.password, }; var connection = hana.createConnection(); connection.connect(connOptions); var result = connection.exec(sql); connection.disconnect(); console.log (sql); var myjson = JSON.stringify(result); response.end(myjson) }
Loading…

no comments

    sign in to comment