Skip to content
Learn › Get data in › Connectors: open the docs menu

Connect SAP HANA to Mammoth and import tables or SQL

The SAP HANA connector imports a table, or the result of your own SQL query, from your SAP HANA database into Mammoth as a dataset. Open it from Data Library > New dataset > Connectors and search for SAP HANA. Project Admins create the connection; Project Editors can start datasets from a connection the project already has. Which connectors you can add depends on your plan.

What you can bring in from SAP HANA

  • Any table the HANA user can read, grouped by schema.
  • The result of your own SELECT query. Only SELECT statements are accepted.
  • A query Mammoth writes from a plain-language description, when AI query is on for your workspace.

Before you connect SAP HANA

You need:

  • An SAP HANA instance reachable from the internet.
  • A HANA user with SELECT access to the schemas and tables you want.
  • Your HANA server's Host URL, Port, Username, Password and Database name.
  • Mammoth's IP address added to your HANA instance's allowed inbound list. See Allow Mammoth through your firewall.

Confirm your SAP HANA port first

The connection form pre-fills Port with 443, but that's a generic default, not a HANA one. Many on-premises SAP HANA instances listen on a port in the 3<instance number>15 range instead, for example 30015 for instance 00. Ask your HANA administrator for the correct port.

Connect SAP HANA to Mammoth

These steps follow the shared flow in Connect a database or app.

  1. Go to the Data Library and click New dataset.
  2. Choose Connectors.
  3. Search for SAP HANA and click its tile. The connection form opens.
  4. Fill in the fields below. A callout below the fields reminds you to whitelist Mammoth's IP address in your database settings.
  5. Click Connect. Mammoth checks the details and saves the connection. If the check fails, the error appears at the bottom of the form.
FieldWhat to enterExample
Host URLHostname or IP address of your SAP HANA serverhana-prod.example.com
PortTCP port your HANA instance listens onConfirm with your HANA admin (see above)
UsernameHANA user with SELECT accessMAMMOTH_READER
PasswordPassword for the HANA user
DatabaseName of the HANA database to connect toPROD
Display NameOptional label for this connection in MammothHANA Production

Once connected, the connector workspace opens on your tables.

Query a SAP HANA table in the SQL view

  1. In Tables, click a table. Mammoth opens its rows with the SELECT * query that read them, using double-quoted HANA identifiers, such as SELECT * FROM "schema"."table".
  2. To change the query, click Edit SQL, edit it, and click Run (or press Ctrl+Enter).
  3. To keep only some columns, tick them in the table header.
SELECT "ORDER_ID", "CUSTOMER_ID", "AMOUNT", "ORDER_DATE"
FROM "SALES"."ORDERS"
WHERE "ORDER_DATE" >= ADD_DAYS(CURRENT_DATE, -90)
  AND "STATUS" = 'COMPLETED'

Write a SAP HANA query from a description

When AI query is on for your workspace, click Edit SQL to see the Describe the data you need... box above the editor.

  1. Describe what you want, for example "all orders completed in the last 90 days".
  2. Click Write SQL. Mammoth writes the query from your table structure.
  3. Check the query, then click Run.

If a query fails, click Fix with AI to ask the chat to correct it. Connect a database or app covers the full SQL view.

Save SAP HANA data as a dataset

  1. Click Save as dataset.
  2. Enter a Name and choose a folder under Save in.
  3. Under Keep it up to date, choose Daily at 06:00 or Only when I ask.
  4. Under On each refresh, click Change and choose Replace all rows (see below).
  5. Click Save as dataset. When the dataset is ready, click Open dataset.

The On each refresh list shows Replace all rows (the default), Add only new rows, Keep only the newest rows, or Add every row again when the query has no column that can serve as a key column. SAP HANA refreshes don't track a key column, so choose Replace all rows to keep the dataset matching the source.

Refresh SAP HANA data and choose an update method

Choosing Daily at 06:00 creates a Dataset Refresh automation for the dataset. To run it on another schedule, edit that automation. For a dataset saved with Only when I ask, create a Dataset Refresh automation yourself.

After you save, the dataset's Update method setting offers only Replace all data and Add to existing data, with no key column.

Allow Mammoth in your SAP HANA network settings

Add Mammoth's IP address to your SAP HANA instance's allowed inbound connections. Allow Mammoth through your firewall gives the current address and steps.

Troubleshoot SAP HANA connections and error codes

SymptomLikely causeFix
Connection failsWrong portConfirm the port with your HANA administrator (see Confirm your SAP HANA port first)
Connection failsMammoth's IP address isn't allowedWhitelist it in your HANA network settings
Connection failsWrong credentialsCheck the username and password for the target database
A message that starts "HANA Error Code"An error passed straight through from the HANA driverLook up the code and description in SAP's HANA documentation, or ask your HANA administrator
No tables appear for a schemaThe user lacks SELECT on that schemaAsk your HANA administrator to grant access to the schema and tables
Column ambiguity errorA join uses unqualified column namesQualify columns with their table or alias, for example "o"."ORDER_ID" instead of "ORDER_ID"

The message reads "HANA Error Code", then the HANA error number, a colon and HANA's description, such as an invalid object name or insufficient privileges. The number and description identify the HANA-side error.

Was this page helpful?

Something wrong? support@mammoth.io