SAP HANA Cloud
SAP HANA Cloud is a modern database as a service (DBaaS) powering the next generation of intelligent data applications and analytics across all enterprise data.
Tagssaphanadatabase
- JavaScript
- Python
NodeJS packagehttps://www.npmjs.com/package/@sap/hana-client
Version2.16.26
Documentationhttps://help.sap.com/viewer/f1b440ded6144a54ada97ff95dac7adf/latest/en-US/f3b8fabf34324302b123297cdbe710f0.html
Pypi packagehttps://pypi.org/project/hdbcli/
Version2.16.26
Source Codehttps://pypi.org/project/hdbcli/
Network Connection needs
This integration needs network access to the server where the service is running.
See the Network access page for details about how to achieve that.
Credential configuration
There are two options to configure your credential for SAP HANA:
In option one, you just need to fill the field with your data from hdbuserstore. The second will require to fill all connection parameters directly.
Here is an example of a filled credential configuration form in YepCode:
SAP HANA Cloud Snippets available in Editor
note
The title is the triggering text for YepCode to autocomplete the script.
- JavaScript
- Python
Integration
New integration from credential
const connection = yepcode.integration.sapHana('credential-slug');
New integration from plain authentication data
const hana = require('@sap/hana-client');
const connection = hana.createConnection();
connection.connect({
serverNode: 'your-host-and-port',
uid: 'your-user',
pwd: 'your-password',
sslValidateCertificate: 'false'
});
Disconnect
Disconnect (callback)
connection.disconnect(function(err) {
if (err) throw err;
console.log('Disconnected');
});
DDL Statement
DDL Statement
connection.exec('CREATE TABLE Test (ID INTEGER PRIMARY KEY, msg VARCHAR(128))',
function (err, result) {
if (err) throw err;
console.log('Table Test created!', result);
});
DML Statement
DML Statement
connection.exec("INSERT INTO Test VALUES(1, 'Hello')", function (err, affectedRows) {
if (err) throw err;
console.log('Number of affected rows:', affectedRows);
});
Query
Query
connection.exec("SELECT * FROM Test WHERE ID < 5", function (err, rows) {
if (err) throw err;
console.log('Rows:', rows);
});
Query Parametrized
Query Parametrized
connection.exec("SELECT * FROM Test WHERE ID BETWEEN ? AND ?", [5, 8],
function (err, rows) {
if (err) throw err;
console.log('Rows:', rows);
});
Integration
New integration from credential
connection = yepcode.integration.sap_hana('credential-slug');
New integration from plain authentication data
const hana = require('@sap/hana-client');
const connection = hana.createConnection();
connection.connect({
serverNode: 'your-host-and-port',
uid: 'your-user',
pwd: 'your-password',
sslValidateCertificate: 'false'
});
Disconnect
Disconnect
connection.close()
DDL Statement
DDL Statement
cursor = connection.cursor()
cursor.execute('CREATE TABLE Test (ID INTEGER PRIMARY KEY, msg VARCHAR(128))')
cursor.close()
DML Statement
DML Statement
sql = 'INSERT INTO T1 (ID, C2) VALUES (?, ?)'
cursor = connection.cursor()
cursor.execute(sql, (1, 'hello'))
cursor.execute(sql, (2, 'hello again'))
cursor.close()
Query
Query
sql = 'SELECT * FROM T1'
cursor = connection.cursor()
cursor.execute(sql)
for row in cursor:
print(row)
Query Parametrized
Query Parametrized
cursor = connection.cursor()
cursor.execute("SELECT * FROM Test WHERE ID BETWEEN ? AND ?", (5, 8))
for row in cursor:
print(row)