CLICLItypeA command you run, rather than a dependency you import.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

@saptools/sqltools

A command line that turns the HANA service binding of a Cloud Foundry app into a connection for the SQLTools extension in VS Code, written to the workspace's .vscode/settings.json.

Connecting the SQLTools extension in VS Code to an app's database otherwise means copying host, user, password and schema out of VCAP_SERVICES by hand. sqltools-export reads the bindings from a live app (from-app logs in with SAP_EMAIL and SAP_PASSWORD, from-cf uses the current cf target), from a saved JSON file or from stdin, and writes a SAPHana connection named <app> (<region>) together with a hana-credentials.json backup of every binding, both holding live credentials. It writes the connection and stops there: queries run in the SQLTools extension and the SQLTools SAP HANA driver, which have to be installed. Only bindings under the hana service label are read, the default for SAP HANA Cloud and HDI bindings on BTP.

Facts

Latestv0.2.1ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
Editor supportBTPEditor supportcapabilityWorking in source code with the editor helping rather than treating it as text — completion, go-to-definition, inline errors, refactoring and preview.
Runs
Cloud Foundry
Requires
SAP HANA CloudSAP HANA CloudartifactThe database whose service binding it converts; the parser reads bindings under the hana label only.Node.jsNode.jsoutside the atlasIt is a Node command line and library, and the README names the Node version it needs.

Who is behind it

Đông TrầnĐông TrầnPersonMaintains this
In the atlas: maintains 18, contributes to 18
@dongitran
maintainer

What it declares

Every artifact

Type
CLI
Origin
Independently maintained
Runs on
Cloud Foundry

As a CLI

Distributed through
npm

Connections3

Install

npm add @saptools/sqltools

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

Where @saptools/sqltools runsYour SAP BTP subaccountBy its type: a CLI is run from a terminalcallsdocumentedrequiresdocumentedrequiresYour terminal, actorYour terminalNode.js, systemNode.jssystem@saptools/sqltools, module@saptools/sqltoolsSAP HANA Cloud, service instanceSAP HANA Cloud
SAPnot SAP's, or the project's ownstated in the documentdocumented only

README

quoted from dongitran/saptools under MIT, read
dongitran/saptools/packages/sqltools/README.mdOn GitHub

🗄️ @saptools/sqltools

Stop copy-pasting HANA credentials out of VCAP_SERVICES.

One command turns a SAP BTP Cloud Foundry HANA service binding into a ready-to-use VS Code SQLTools connection — no cockpit clicking, no JSON surgery.

npm version license node install size types

Install • Quick Start • CLI • FAQ


✨ Features

  • 🔌 One-shot export — pulls VCAP_SERVICES from any CF app and writes .vscode/settings.json with a valid SAPHana connection
  • 🪄 Four input paths — read from a real CF app, a saved JSON file, stdin, or an already-targeted CF session
  • 🧷 Non-destructive — preserves unrelated VS Code settings and, with --merge, unrelated SQLTools connections too
  • 💾 Backup JSON — drops a hana-credentials.json beside the settings so HDI users / URLs / certificates stay within reach
  • 🔒 Type-safe — shipped with full TypeScript definitions for every input and output shape
  • 🪶 Tiny — two runtime deps (@saptools/cf-sync, commander) and zero runtime magic

📦 Install

# Global CLI
npm install -g @saptools/sqltools

# Or as a dependency
npm install @saptools/sqltools
# pnpm add @saptools/sqltools
# yarn add @saptools/sqltools

Note

Requires Node.js ≥ 20. The from-cf / from-app commands also need the cf CLI on PATH. For from-app, set SAP_EMAIL and SAP_PASSWORD so the tool can authenticate and target the org/space for you.


Updates

Every command first checks npm for a newer @saptools/sqltools (at most once an hour, one small request with a 2-second timeout) and, when one exists, installs that exact version with the package manager that owns the running binary and re-runs the command you typed on the new version. Both steps are announced on stderr; nothing is printed when the install is already current:

sqltools-export: updating 0.2.0 -> 0.3.0 ...
sqltools-export: updated to 0.3.0; re-running the command

If the install cannot complete, one stderr line gives the manual command and the command runs on the installed version; that version is not retried for a day. sqltools-export self-update forces the check and install now; sqltools-export self-update --check only reports.

ControlEffect
SAPTOOLS_AUTO_UPDATE=on|notify|offon (default) installs and re-runs; notify prints the manual command once per version; off never checks. Applies to every @saptools CLI.
SQLTOOLS_AUTO_UPDATEsame values, this CLI only; wins over the global variable
SAPTOOLS_UPDATE_INTERVAL_MINUTESminutes between checks (default 60; 0 checks on every run)
SAPTOOLS_NPM_REGISTRYregistry to check and install from (default: npm's configured registry, then npmjs)
SAPTOOLS_UPDATE_DEBUG=1explain on stderr why nothing happened

The updater switches itself off in CI (CI set), under NODE_ENV=test or NO_UPDATE_NOTIFIER, when the binary runs from a source checkout, an npm link or an npx cache, and inside the re-run itself. It never writes to stdout, never asks for input, never uses sudo, and never moves onto a prerelease. Its state lives in ~/.saptools/updates/.

🚀 Quick Start

# Already logged in and targeted with `cf login`? One command is enough.
sqltools-export from-cf \
  --app my-srv --region eu10 --org my-org --space dev

Result:

✔ Updated SQLTools connections (1) → /workspace/.vscode/settings.json
  Credentials JSON saved → /workspace/hana-credentials.json
  • my-srv (eu10) host.hana.ondemand.com:443 schema=SCHEMA_MY_SRV

Open the workspace in VS Code, install the SQLTools + SQLTools SAP HANA driver extensions, and the new connection is already wired up.


🧰 CLI

Every command identifies an app with the same four labels — they are written into the SQLTools connection name as "<app> (<region>)".

FlagDescriptionExample
--app <name>CF app name (also the label)my-srv
--region <key>CF region keyap10, eu10, us10
--org <name>CF org namemy-org
--space <name>CF space namedev

Common output options:

FlagDescription
--cwd <dir>Workspace root that owns .vscode/settings.json (default: cwd)
--mergeMerge with existing connections by name (default: overwrite)
--credentials-out <path>Custom path for the backup JSON
--no-credentials-fileSkip writing hana-credentials.json
🌐 sqltools-export from-app

Full end-to-end: cf api → cf auth → cf target → cf env → write settings. Great for CI and fresh machines.

export SAP_EMAIL="you@company.com"
export SAP_PASSWORD="your-sap-password"

sqltools-export from-app \
  --app my-srv --region eu10 --org my-org --space dev
📡 sqltools-export from-cf

Assumes you are already targeted (cf login && cf target -o ... -s ...). Shells out to cf env <app> and writes the settings.

sqltools-export from-cf --app my-srv --region eu10 --org my-org --space dev
📄 sqltools-export from-file

Already have a VCAP_SERVICES JSON saved somewhere? Point to it.

sqltools-export from-file --input ./vcap.json \
  --app my-srv --region eu10 --org my-org --space dev
📥 sqltools-export from-stdin

Classic pipe:

cf env my-srv | jq '."VCAP_SERVICES"' | sqltools-export from-stdin \
  --app my-srv --region eu10 --org my-org --space dev
🔁 sqltools-export convert

Print a single SQLTools connection JSON to stdout — no files written. Perfect for scripting.

sqltools-export convert --input ./vcap.json \
  --app my-srv --region eu10 --org my-org --space dev

Tip

Use --merge to keep hand-crafted connections in .vscode/settings.json untouched while only overwriting the one matching <app> (<region>).


📁 Output Files

After a successful export you get two files in the workspace root:

.vscode/settings.json     # SQLTools connections + sqltools.useNodeRuntime
hana-credentials.json     # Backup of every extracted binding (HDI user, URL, cert…)
🔬 Shape of the SQLTools connection entry
{
  "sqltools.useNodeRuntime": true,
  "sqltools.connections": [
    {
      "name": "my-srv (eu10)",
      "driver": "SAPHana",
      "server": "host.hana.ondemand.com",
      "port": 443,
      "username": "USER_1",
      "password": "…",
      "database": "SCHEMA_MY_SRV",
      "connectionTimeout": 30,
      "previewLimit": 50,
      "hanaOptions": {
        "encrypt": true,
        "sslValidateCertificate": true,
        "sslCryptoProvider": "openssl"
      }
    }
  ]
}

Important

Both files contain live HANA credentials. They live inside your workspace, not under ~ — keep them out of git (add to .gitignore if your repo doesn't already exclude hana-credentials.json).


❓ FAQ

Do I still need the SQLTools SAP HANA driver extension?

Yes. @saptools/sqltools only writes the connection definition. You still need the SQLTools extension and the SQLTools SAP HANA driver to actually run queries.

Will this overwrite my other connections in settings.json?

By default, yes — sqltools.connections is replaced with the newly-exported entries, while every other key in settings.json is preserved. Pass --merge to keep existing connections whose name does not match <app> (<region>).

Is the backup file safe to commit?

No. hana-credentials.json contains the HANA password, schema, HDI user, and the certificate payload. Add it to .gitignore.

What does the CLI do with SAP_EMAIL / SAP_PASSWORD?

They are only read by from-app. The tool forwards them directly to cf auth — no storage, no logging. from-cf assumes you are already targeted and ignores both env vars.

My binding is not called hana in VCAP_SERVICES. Does this still work?

Not yet. The parser looks for the hana service label (the default for SAP HANA Cloud / HDI service bindings on BTP). If you have a bespoke label, open an issue and we'll add support.


🛠️ Development

From the monorepo root:

pnpm install
pnpm --filter @saptools/sqltools... build
pnpm --filter @saptools/sqltools typecheck
pnpm --filter @saptools/sqltools lint
pnpm --filter @saptools/sqltools test:unit
pnpm --filter @saptools/sqltools test:e2e:fake
pnpm --filter @saptools/sqltools test:e2e:live   # needs SAP_EMAIL / SAP_PASSWORD

The live e2e suite auto-discovers a real CF app with a hana service binding by scoring candidates from ~/.saptools/cf-structure.json (populated by cf-sync). To pin a specific target:

export E2E_TARGET="eu10/my-org/my-space/my-srv"

Live e2e only performs read-only CF operations (cf api, cf auth, cf target, cf env) — nothing is created, updated, or deleted in Cloud Foundry.



👨‍💻 Author

dongtran ✨

📄 License

MIT


Made with ❤️ to make your work life easier!

MIT, read

History

Latest

v0.2.1

  1. v0.2.0

  2. v0.1.6

  3. v0.1.5

  4. v0.1.4

  5. v0.1.3

  6. v0.1.2

On npm
6downloads per week, npm
Weekly downloads for @saptools/sqltools26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 6.27 Apr – 3 May: 1474 May – 10 May: 3511 May – 17 May: 2218 May – 24 May: 4825 May – 31 May: 321 Jun – 7 Jun: 128 Jun – 14 Jun: 1515 Jun – 21 Jun: 1522 Jun – 28 Jun: 1929 Jun – 5 Jul: 3476 Jul – 12 Jul: 2413 Jul – 19 Jul: 2220 Jul – 26 Jul: 2327 Jul – 2 Aug: 273 Aug – 9 Aug: 3010 Aug – 16 Aug: 3217 Aug – 23 Aug: 4024 Aug – 30 Aug: 1331 Aug – 6 Sept: 2647 Sept – 13 Sept: 1514 Sept – 20 Sept: 2321 Sept – 27 Sept: 4928 Sept – 4 Oct: 435 Oct – 11 Oct: 9112 Oct – 18 Oct: 2719 Oct – 25 Oct: 6
Editor support
  1. SAP Build CodeDevelopment environment on BTP for UI5, Fiori, mobile and CAP
  2. SAP Business Application StudioBrowser-based development environment with dev spaces
  3. SAP Web IDE Full-StackIDE service on SAP BTP for SAPUI5, Fiori and full-stack apps

Details

Sources4
Added by handdiscovered herechecked
npm registry, @saptools/sqltoolsversion, releases, installschecked
github.com/git+https://github.com/dongitran/saptools.gittree, pushes, contributors, CIchecked
packages/sqltools/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
deploymentCloud Foundry
latestv0.2.1
first release
releases and cadence7, ~10d median
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, developer-experience
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:saptools-sqltools
JSON
/artifacts/saptools-sqltools.json
MCP
Connecting an agent