n8n-nodes-sap-hana-2
v1.0.3
Published
N8N node for reading data from SAP HANA databases and HDI containers
Maintainers
Readme
n8n-nodes-sap-hana-data
This is an n8n community node for reading data from SAP HANA databases and HDI containers.
Features
- Connect to SAP HANA Cloud HDI containers
- Connect to regular SAP HANA databases
- Read all records from tables
- Filter records with WHERE conditions
- Specify columns to retrieve
- Sort and limit results
- Flexible output formats
Installation
⚠️ Important: This node is designed for self-hosted n8n installations only. It cannot be used with n8n Cloud due to dependency requirements.
Option 1: npm Installation (Recommended)
- Create the community nodes folder and navigate to it:
mkdir -p ~/.n8n/nodes cd ~/.n8n/nodes - Install the package:
test -f package.json || npm init -y npm install n8n-nodes-sap-hana-data@^1.0.2 - Restart your n8n instance
Troubleshooting: __strdup: symbol not found
If you see an install error like __strdup: symbol not found coming from @sap/hana-client, you are installing an older package version (≤ 1.0.1) that depends on the native SAP driver. This fails on Alpine/musl-based n8n images.
- Use
n8n-nodes-sap-hana-data@^1.0.2(this repo switches to the pure-JShdbdriver). - If
npmreportsNo match found for version 1.0.2, install from a local.tgzvia Option 3B below, or switch to a glibc-based n8n image.
Option 2: Development Setup
Clone this repository:
git clone https://github.com/pondev1/n8n-nodes-sap-hana-data.git cd n8n-nodes-sap-hana-dataInstall dependencies:
npm installBuild the node:
npm run buildLink the package locally:
npm pack mkdir -p ~/.n8n/nodes cd ~/.n8n/nodes test -f package.json || npm init -y npm install /path/to/n8n-nodes-sap-hana-data-*.tgzRestart your n8n instance
After installing the node, you can use it like any other node in n8n.
Option 3: Docker (Manual Installation)
This option is for self-hosted n8n instances running in Docker (including Docker Compose). The key is to use a persistent volume for the n8n user folder so the installed node survives container restarts/recreates.
Default paths (official n8n image):
- User folder:
/home/node/.n8n(or$N8N_USER_FOLDERif you override it) - Community nodes folder:
/home/node/.n8n/nodes
Replace <n8n_container> in the commands below with your container name/ID (check with docker ps). If you use Docker Compose, you can usually replace docker exec/docker restart with docker compose exec n8n/docker compose restart n8n.
3A) Install from npm inside the running container
Ensure your container uses a persistent volume for
/home/node/.n8n.- Docker Compose example (snippet):
services: n8n: image: n8nio/n8n:latest ports: - "5678:5678" volumes: - n8n_data:/home/node/.n8n volumes: n8n_data:
- Docker Compose example (snippet):
Open a shell inside the container:
docker exec -it <n8n_container> shInside the container, install the node:
mkdir -p /home/node/.n8n/nodes cd /home/node/.n8n/nodes test -f package.json || npm init -y npm install n8n-nodes-sap-hana-data@^1.0.2 exitRestart n8n:
docker restart <n8n_container>
3B) Install from a local .tgz (no internet access in the container)
On your host machine, build and pack this repository:
npm ci npm run build npm packCopy the generated tarball into the container:
docker cp n8n-nodes-sap-hana-data-*.tgz <n8n_container>:/tmp/Open a shell inside the container:
docker exec -it <n8n_container> shInside the container, install it and exit:
mkdir -p /home/node/.n8n/nodes cd /home/node/.n8n/nodes test -f package.json || npm init -y npm install /tmp/n8n-nodes-sap-hana-data-*.tgz exitRestart n8n:
docker restart <n8n_container>
Troubleshooting (Docker)
- If you bind-mount a host folder to
/home/node/.n8nandnpm installfails withEACCES, fix the ownership/permissions of the mounted directory (the container runs as usernode, often UID1000):sudo chown -R 1000:1000 ./n8n_data - If the node does not show up after restarting, verify the install inside the container:
ls -la /home/node/.n8n/nodes/node_modules/n8n-nodes-sap-hana-data
Configuration
Credentials
- Create new credentials of type "SAP HANA API"
- Choose connection type:
- HDI Container: Use service key credentials from SAP BTP
- Database: Use direct database connection details
- Fill in the connection details:
- Host: Database hostname (from service key "host" field)
- Port: Database port (from service key "port" field, typically 443 for HANA Cloud)
- Username: Database username (from service key "user" field)
- Use _DT suffix user for design-time operations (creating/modifying database objects)
- Use _RT suffix user for runtime operations (reading data, SELECT queries) - Recommended for this node
- Password: Database password (from service key "password" field)
- Database: Database name (from service key "database" field, optional)
- Schema: Schema name (from service key "schema" field or your specific schema)
Node Usage
- Add "SAP HANA Data" node to your workflow
- Select your credentials
- Choose operation:
- Get All Records: Retrieve all records from a table
- Get Records with Filter: Retrieve records with WHERE conditions
- Custom API Call (Custom SQL Query): Run a custom SQL query with optional parameters
- Configure table name and options
- Execute the node
Operations
Get All Records
- Retrieves all records from specified table
- Optional column selection
- Optional sorting and limiting
Get Records with Filter
- Retrieves records matching WHERE condition
- All features from "Get All Records"
- Flexible WHERE clause support
Custom API Call (Custom SQL Query)
- Runs a custom SQL query (SELECT statements recommended)
- Supports positional parameters with
?placeholders - Use
LIMIT/OFFSETor keyset pagination in your SQL
Examples
Basic Usage
Table Name: CUSTOMERS
Limit: 100With Filtering
Table Name: ORDERS
WHERE Condition: STATUS = 'COMPLETED' AND ORDER_DATE > '2024-01-01'
Limit: 50Custom Columns
Table Name: PRODUCTS
Columns: ID, NAME, PRICE, CATEGORY
Order By: PRICE DESCCustom SQL with Pagination
SQL Query: SELECT * FROM "SBO_TUEMPRESA"."JDT1" WHERE "TransId" > {{ $json.last_trans_id }} ORDER BY "TransId", "Line_ID" LIMIT {{ $json.batch_size }}Custom SQL with Parameters
SQL Query: SELECT * FROM "SBO_TUEMPRESA"."JDT1" WHERE "TransId" > ? ORDER BY "TransId", "Line_ID" LIMIT ?
Query Parameters: 1000, 500Requirements
- n8n version 0.87.0 or later
- Access to SAP HANA database or HDI container
- Appropriate database permissions for SELECT operations
- Note for n8n
2.xDocker users: newer images may be based on Alpine (musl). This package uses the pure-JShdbdriver to avoid native binary loading issues (for example,__strdup: symbol not found).
Sample Workflows
Ready-to-use n8n workflow examples are available in the workflows/ directory:
1. Get Data from SAP HANA DB Tables Workflow
File: workflows/Get Data from SAP Hana DB tables.json
Comprehensive workflow demonstrating data retrieval from SAP HANA database tables with various query options and data processing capabilities.
Features:
- Table data retrieval with filtering
- Column selection and sorting
- Result limiting and pagination
- Data transformation and processing
- Error handling and validation
How to Use Sample Workflows
- Download the desired workflow JSON file
- In n8n, go to Workflows > Import from File
- Select the downloaded JSON file
- Configure your SAP HANA credentials (use _RT user for read operations)
- Update table names to match your database schema
- Customize WHERE conditions and column names as needed
- Activate and test the workflow
Support
For issues and feature requests, please create an issue in the GitHub repository.
License
MIT License
