> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SAP HANA as a data source

> Bring data from a SAP HANA database to Nekt.

SAP HANA is SAP's in-memory, column-oriented relational database, used as the underlying database for SAP S/4HANA, SAP BW/4HANA, and many other SAP and custom applications. Nekt connects to both **on-premise SAP HANA** instances and **SAP HANA Cloud** using SAP's official client libraries.

## Configuring SAP HANA as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the SAP HANA option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

You'll need the connection credentials for your SAP HANA database.

<Warning>
  The database user must have **read access** (SELECT privilege) to the schemas, tables, and views you want to extract. We recommend using a dedicated read-only user.
</Warning>

<Note>
  Because Nekt runs in the cloud, it needs network access to the HANA SQL port. On-premise systems use port `3<instance>15` (for example `30015` for instance `00`); SAP HANA Cloud uses port `443`. If the database is on a private network, expose it securely, ideally through an **SSH tunnel** (see step 3), VPC peering, or a tightly firewalled port forward restricted to Nekt's egress IPs.
</Note>

### 2. Configuration Options

* **Host**: The hostname or IP address of your SAP HANA server. For SAP HANA Cloud, use the instance endpoint host. Use `127.0.0.1` when connecting through an SSH tunnel.
* **Port**: The SQL port of your SAP HANA server. On-premise systems use `3<instance>15` (for example `30015`); SAP HANA Cloud uses `443`. Leave empty to auto-select (`30013` when a tenant database is set, `30015` otherwise).
* **Tenant Database** (optional): The tenant database name for multitenant (MDC) systems. When set without an explicit port, the connection is routed through the system database.
* **User**: The username for authenticating with the database.
* **Password**: The password for the database user.
* **Encrypt Connection (TLS)**: Enables TLS encryption for the connection. **Required for SAP HANA Cloud.**

#### Advanced Settings

* **Validate TLS Certificate**: Validates the server's TLS certificate when encryption is enabled (default: enabled). Disable for servers with self-signed certificates.
* **Filter Schemas** (optional): An allowlist of schemas to discover (case-insensitive). When empty, all schemas except SAP HANA system schemas (`SYS`, `_SYS_*`) are discovered.
* **Filter Tables** (optional): An allowlist of table/view names to discover (case-insensitive). **Strongly recommended for large databases** — an SAP ERP schema can hold tens of thousands of tables, and discovering all of them is slow.
* **Filter Table Prefixes** (optional): A list of name prefixes to discover (case-insensitive), for example `VBAK`, `BKPF`, `MARA`. Combined with Filter Tables as a union.
* **Chunk Size**: The number of rows to fetch at a time. Default is `20000`. Set to `0` to fetch all rows at once (not recommended for large tables).
* **Use Batch Query**: Use keyset pagination with retry logic for large tables. Requires a primary key.

### 3. SSH Tunnel (optional)

If your SAP HANA database is behind a firewall or on a private network, you can connect through an SSH tunnel (bastion host).

<Accordion title="How to configure SSH Tunnel">
  <Steps>
    <Step title="Enable SSH Tunnel">
      Toggle the SSH Tunnel option to enabled.
    </Step>

    <Step title="Enter SSH Server Details">
      * **SSH Host**: The hostname of your bastion/jump server.
      * **SSH Port**: The SSH port (default: `22`).
      * **SSH Username**: Your SSH username.
    </Step>

    <Step title="Provide Authentication">
      Use either a password or a private key:

      * **SSH Password**: Password for the SSH server, OR
      * **SSH Private Key**: PEM-formatted private key for key-based authentication.
    </Step>
  </Steps>

  When tunneling, set **Host** to `127.0.0.1` so the connection is routed through the tunnel to the remote database.
</Accordion>

### 4. Select streams

After configuring your connection, Nekt will discover the available tables and views from your SAP HANA database (scoped by your schema and table filters). Select the tables you want to sync.

<Tip>
  Selecting only the columns you need significantly speeds up extraction, since each row is transferred over the wire.
</Tip>

### 5. Configure data streams

For each selected table, you can configure:

* **Replication method**: Choose between **Full Table** (complete sync each run) or **Incremental** (only new/updated rows based on a replication key column).
* **Replication key**: For incremental sync, select the column that tracks changes (typically a timestamp or auto-incrementing ID column).

### 6. Verify and save

Review your configuration and click **Save**. Nekt will begin syncing data from your SAP HANA database on the configured schedule.

## Supported Data Types

SAP HANA data types are automatically mapped to the appropriate types in Nekt's Catalog:

| SAP HANA Type                                                           | Nekt Type            |
| ----------------------------------------------------------------------- | -------------------- |
| `TINYINT`, `SMALLINT`, `INTEGER`, `BIGINT`                              | Integer              |
| `REAL`, `DOUBLE`, `FLOAT`, `DECIMAL`, `SMALLDECIMAL`                    | Number               |
| `VARCHAR`, `NVARCHAR`, `ALPHANUM`, `SHORTTEXT`, `CLOB`, `NCLOB`, `TEXT` | String               |
| `DATE`                                                                  | Date                 |
| `TIMESTAMP`, `SECONDDATE`                                               | DateTime             |
| `TIME`                                                                  | String               |
| `BOOLEAN`                                                               | Boolean              |
| `VARBINARY`, `BLOB`                                                     | String (hex-encoded) |

<Note>
  `ARRAY` columns are not supported by SAP's client driver and are skipped. Spatial types (`ST_GEOMETRY`, `ST_POINT`) are extracted in their string representation.
</Note>
