PackagePackagetypeA library you install and call yourself.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →

SAP-samples/hana-hdbext-promisfied-example

Promise-based wrappers around the SAP HANA client libraries for Node.js, Go and Python, replacing nested callbacks with a single async call.

The standard @sap/hdbext client chains a callback through prepare, then exec, then a callback for the result; a promisified wrapper compresses that into one async/await call, with the same shape carried through stored procedure calls, batch execution and connection setup from environment configuration. The repository holds four packages across three languages: hdb and hdbext for Node.js, published to npm as sap-hdb-promisfied and sap-hdbext-promisfied, hdbhelper for Go, tagged in the repository and fetched through the Go module proxy, and hdbhelper-py for Python, published to PyPI. It wraps connection handling and querying. Which client library to wrap is the caller's choice, and so are the credentials, which the class reads from a default-env.json in the working directory rather than from code.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Provides
Database connectorsBTPDatabase connectorscapabilityConnecting an application’s data model and queries to a database, including the differences in supported queries, types and schema management between database implementations. Changing an existing schema belongs to [schema evolution](capability:schema-evolution).

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Brian BernardPersonContributes to this
In the atlas: contributes to 64
@btbernard
Thomas JungPersonContributes to this
Developer Advocate
In the atlas: contributes to 15, wrote 6
@jung-thomas
Lars HvamPersonContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1
@larshp
mmicciolo-sapPersonContributes to this
In the atlas: contributes to 1
@mmicciolo-sap
5 contributors

What it declares

Every artifact

Type
Package
Origin
By SAP
Runtime
Node.js

As a package

Where it runs
In your own program
Distributed through
npmPyPI

Connections1

Install

npm add SAP-samples/hana-hdbext-promisfied-example

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from SAP-samples/hana-hdbext-promisfied-example under Apache-2.0, read
SAP-samples/hana-hdbext-promisfied-example/README.mdOn GitHub

SAP HANA Client Helpers — Node.js, Go & Python

REUSE status

Description

This repository contains high-level wrappers for SAP HANA client libraries, simplifying connection management, query execution, and stored procedure invocation in Node.js, Go, and Python:

PackageLanguageWrapsRuntime
hdb/Node.jshdb^20 || ^22 || ^24
hdbext/Node.js@sap/hdbext>=18.18.0
hdbhelper/GoSAP/go-hdbGo 1.22+
hdbhelper-py/PythonhdbcliPython 3.12+

The Node.js packages expose an ES6 class API (dbClass) with dual ESM/CJS entry points (index.js / index.cjs). The Go package provides an equivalent API surface using idiomatic Go patterns. The Python package wraps hdbcli with the same connection-from-environment and stored procedure patterns.

Motivation

With the standard @sap/hdbext you use nested callbacks like this:

let client = req.db;
client.prepare(
 `SELECT SESSION_USER, CURRENT_SCHEMA FROM "DUMMY"`,
 (err, statement) => {
  if (err) return res.status(500).send(`ERROR: ${err.toString()}`);
  statement.exec([], (err, results) => {
   if (err) return res.status(500).send(`ERROR: ${err.toString()}`);
   return res.status(200).json({ Objects: results });
  });
 });

With sap-hdbext-promisfied the same code becomes:

try {
 const dbClass = require("sap-hdbext-promisfied")
 let db = new dbClass(req.db);
 const statement = await db.preparePromisified(`SELECT SESSION_USER, CURRENT_SCHEMA FROM "DUMMY"`)
 const results = await db.statementExecPromisified(statement, [])
 return res.status(200).json({ Objects: results })
} catch (e) {
 return res.status(500).send(`ERROR: ${e.toString()}`)
}

Installation

# hdbext variant
npm install sap-hdbext-promisfied

# hdb variant (no @sap/hana-client dependency)
npm install sap-hdb-promisfied

Both packages are published to the default npm registry (https://registry.npmjs.org).

Note: If you previously configured a custom @sap:registry, remove it:

npm config delete @sap:registry

Usage

Creating a connection

Pass an existing HANA client instance directly:

import dbClass from 'sap-hdbext-promisfied'
const db = new dbClass(req.db)           // req.db from Express middleware

Or let the class create and manage the connection from environment configuration:

import dbClass from 'sap-hdbext-promisfied'
const db = new dbClass(await dbClass.createConnectionFromEnv(dbClass.resolveEnv(null)))

For sap-hdb-promisfied, call db.destroyClient() when done to close the connection:

import dbClass from 'sap-hdb-promisfied'
const db = new dbClass(await dbClass.createConnectionFromEnv(dbClass.resolveEnv(null)))
try {
    const results = await db.execSQL(`SELECT CURRENT_USER FROM DUMMY`)
    console.table(results)
} finally {
    db.destroyClient()
}
Querying
// Convenience: prepare + exec in one call
const results = await db.execSQL(`SELECT SESSION_USER, CURRENT_SCHEMA FROM "DUMMY"`)

// Or step by step for parameterised queries
const statement = await db.preparePromisified(`SELECT * FROM "MY_TABLE" WHERE ID = ?`)
const results = await db.statementExecPromisified(statement, [42])

// Batch execution
await db.statementExecBatchPromisified(statement, [[1], [2], [3]])
Stored procedures

hdbext package — uses hdbext.loadProcedure:

import * as hdbext from '@sap/hdbext'
const sp = await db.loadProcedurePromisified(hdbext, 'SYS', 'IS_VALID_PASSWORD')
const { outputScalar, results } = await db.callProcedurePromisified(sp, { PASSWORD: 'MyPass1234' })

hdb package — resolves procedure metadata via SQL, no hdbext dependency:

const sp = await db.loadProcedurePromisified('SYS', 'IS_VALID_PASSWORD')
const { outputScalar, results } = await db.callProcedurePromisified(sp, [])

Procedure output shape:

  • Single result set → { outputScalar, results }
  • Multiple result sets → { outputScalar, results0, results1, ... }

API Reference

Instance methods
MethodDescription
preparePromisified(query)Prepare a SQL statement; returns a statement object
statementExecPromisified(statement, params)Execute a prepared statement
statementExecBatchPromisified(statement, params)Execute a prepared statement in batch
loadProcedurePromisified(...)Load a stored procedure (signature differs by package — see above)
callProcedurePromisified(storedProc, inputParams)Call a loaded stored procedure
execSQL(sql)Prepare + execute a statement and return the result set
destroyClient()(hdb only) Close the underlying connection
validateClient()(hdb only) Returns true if the connection is open and healthy
Static helpers
MethodDescription
createConnectionFromEnv(envFile)Load connection config from env files and open a connection
createConnection(options)Open a connection with explicit options
resolveEnv(options)Resolve path to default-env.json; pass { admin: true } for default-env-admin.json
schemaCalc(options, db)Resolve schema: **CURRENT_SCHEMA** → live value, * → %
objectName(name)Expand * / null / undefined → %; otherwise append %
fetchSPMetadata(db, procInfo)(hdb only) Fetch stored procedure parameter metadata from SYS.PROCEDURE_PARAMETERS

Environment Configuration

Connection credentials are never stored in code. Create a default-env.json file in the working directory (git-ignored):

{
  "VCAP_SERVICES": {
    "hana": [{
      "name": "my-hana-service",
      "tags": ["hana"],
      "credentials": {
        "host": "...",
        "port": 443,
        "user": "...",
        "password": "...",
        "encrypt": true
      }
    }]
  }
}
  • Use default-env-admin.json for admin-level connections (pass { admin: true } to resolveEnv).
  • Set TARGET_CONTAINER environment variable to select a specific service binding by name rather than by tag.
  • The hdb package automatically enables TLS (useTLS: true) when encrypt: true is present in the credentials.

CI / CD

Continuous Integration

Every push to main and every pull request runs four parallel jobs via GitHub Actions (.github/workflows/ci.yml):

JobWhat it checksMatrix
test-hdbnpm install → npm test → npm run typesNode.js 20, 22
test-hdbextnpm install → npm test → npm run typesNode.js 20, 22
test-hdbhelpergo build → go vet → go test -vGo 1.25
test-hdbhelper-pypip install → pytest -vPython 3.12, 3.13

All test suites include integration tests that require a live SAP HANA instance. When HANA is unreachable (as in CI), these tests auto-skip — the suite still passes. Unit tests always run.

Releasing the Go module

Go modules are distributed directly from the Git repository — there is no registry to publish to. The Go module proxy (proxy.golang.org) caches modules automatically when users run go get.

To release a new version of hdbhelper:

  1. Go to Actions → Release Go Module → Run workflow
  2. Enter a semver version (e.g. 0.1.0)
  3. The workflow validates, builds, tests, then creates a hdbhelper/v0.1.0 tag and pushes it

The subdirectory prefix on the tag (hdbhelper/v...) is required by Go for modules that live in a subdirectory of a repository. After the tag is pushed, anyone can install the module:

go get github.com/SAP-samples/hana-hdbext-promisfied-example/hdbhelper@v0.1.0
Releasing the Python package

The Python package (sap-hdbhelper-py) is published to PyPI using GitHub Actions with trusted publishers (OIDC — no stored API tokens).

To release a new version of hdbhelper-py:

  1. Go to Actions → Release Python Package → Run workflow
  2. Enter a semver version (e.g. 0.1.0)
  3. The workflow validates, tests, bumps pyproject.toml, builds sdist + wheel, commits, creates a hdbhelper-py/v0.1.0 tag, and publishes to PyPI

After publishing, anyone can install the package:

pip install sap-hdbhelper-py

First-time setup: Before the first release, configure a pending trusted publisher on PyPI for project sap-hdbhelper-py, owner SAP-samples, repo hana-hdbext-promisfied-example, workflow release-python.yml, environment pypi. Also create a GitHub Environment named pypi in repo Settings → Environments.

Releasing the Node.js packages

The Node.js packages (sap-hdb-promisfied, sap-hdbext-promisfied) are published to npm using GitHub Actions with provenance attestation.

To release:

  1. Go to Actions → Release Node.js Package → Run workflow
  2. Select a package (hdb, hdbext, or both)
  3. Enter a semver version (e.g. 2.202604.1)
  4. The workflow tests, generates type declarations, bumps package.json + npm-shrinkwrap.json, publishes with provenance, commits, creates hdb/vX.Y.Z and/or hdbext/vX.Y.Z tags, and pushes

Setup: Add an npm automation access token as the NPM_TOKEN secret in repo Settings → Secrets and variables → Actions.

Known Issues

None

How to obtain support

This project is provided "as-is": there is no guarantee that raised issues will be answered or addressed in future releases.

License

Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

Apache-2.0, read
Database connectors
  1. SAP ASE ServiceManaged SAP ASE databases on BTP for Java applicationsfrom BTP/BAIP
  2. SAP HANA CloudManaged SAP HANA database service on BTPfrom BTP/BAIP
  3. SAP HANA Service (SAP Regions) for SAP BTPManaged SAP HANA 2.0 databases in fixed sizes on SAP BTPfrom BTP/BAIP
  4. PostgreSQL on SAP BTP, hyperscaler optionManaged PostgreSQL from the hyperscaler via a BTP service bindingfrom BTP/BAIP
  5. com.sap.cds:cds-feature-hanaSAP HANA Cloud datasource for CAP Java applicationsfrom CAP
  6. com.sap.cds:cds-feature-jdbcJDBC runtime for H2 and SQLite in CAP Javafrom CAP
  7. com.sap.cds:cds-feature-postgresqlPostgreSQL datasource for CAP Java applicationsfrom CAP
  8. com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versionsfrom CAP
  9. @cap-js/db-serviceBase service shared by CAP's SQLite, PostgreSQL and HANA servicesfrom CAP
  10. @cap-js/hanaSAP HANA database service for CAPfrom CAP
  11. @cap-js/postgresPostgreSQL database service for CAPfrom CAP
  12. @cap-js/sqliteSQLite database service for CAP, in memory during developmentfrom CAP
  13. cap-postgres-btp-connectivityTunnels CAP Node.js to a private PostgreSQL via Cloud Connectorfrom CAP
  14. cds-mongodbMongoDB as a CAP database service through Mongoosefrom CAP
  15. @cds-pgroll/postgresCLI for DROP and RENAME schema changes beside @cap-js/postgresfrom CAP
  16. hdbPure JavaScript SAP HANA driver for Node.jsfrom BTP/BAIP
  17. @neoimpulse/cap-js-restore-model-defined-typesCAP plugin casting read values back to CDS model typesfrom CAP
  18. @quadrio/cds-db2DB2 adapter for CDSfrom CAP
  19. @sap/cds-hanaDatabase adapter for SAP HANA in CAPfrom CAP
  20. @sap/cdsCAP Node.js runtimefrom CAP
  21. @sap/hana-clientSAP's Node.js driver for SAP HANAfrom BTP/BAIP
  22. SAP HANASAP's relational database platform, on-premise and in HANA Cloudfrom BTP/BAIP
  23. cds-pgPostgreSQL adapter for SAP CDS from the SAP Mentors communityfrom CAP
  24. cap-snowflakeCAP database adapter for Snowflake with OData V4 supportfrom CAP
  25. cds-mysqlMySQL and MariaDB database adapter for CAPfrom CAP

Details

Sources4
Added by handdiscovered herechecked
npm registry, SAP-samples/hana-hdbext-promisfied-exampleversion, releases, installschecked
github.com/SAP-samples/hana-hdbext-promisfied-exampletree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesnode
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, data-and-persistence
Contributors5

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-hana-hdbext-promisfied-example
JSON
/artifacts/sap-samples-hana-hdbext-promisfied-example.json
MCP
Connecting an agent