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
SELECTquery. OnlySELECTstatements 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
SELECTaccess 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.
- Go to the Data Library and click New dataset.
- Choose Connectors.
- Search for SAP HANA and click its tile. The connection form opens.
- Fill in the fields below. A callout below the fields reminds you to whitelist Mammoth's IP address in your database settings.
- Click Connect. Mammoth checks the details and saves the connection. If the check fails, the error appears at the bottom of the form.
| Field | What to enter | Example |
|---|---|---|
| Host URL | Hostname or IP address of your SAP HANA server | hana-prod.example.com |
| Port | TCP port your HANA instance listens on | Confirm with your HANA admin (see above) |
| Username | HANA user with SELECT access | MAMMOTH_READER |
| Password | Password for the HANA user | |
| Database | Name of the HANA database to connect to | PROD |
| Display Name | Optional label for this connection in Mammoth | HANA Production |
Once connected, the connector workspace opens on your tables.
Query a SAP HANA table in the SQL view
- In Tables, click a table. Mammoth opens its rows with the
SELECT *query that read them, using double-quoted HANA identifiers, such asSELECT * FROM "schema"."table". - To change the query, click Edit SQL, edit it, and click Run (or press Ctrl+Enter).
- 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.
- Describe what you want, for example "all orders completed in the last 90 days".
- Click Write SQL. Mammoth writes the query from your table structure.
- 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
- Click Save as dataset.
- Enter a Name and choose a folder under Save in.
- Under Keep it up to date, choose Daily at 06:00 or Only when I ask.
- Under On each refresh, click Change and choose Replace all rows (see below).
- 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
| Symptom | Likely cause | Fix |
|---|---|---|
| Connection fails | Wrong port | Confirm the port with your HANA administrator (see Confirm your SAP HANA port first) |
| Connection fails | Mammoth's IP address isn't allowed | Whitelist it in your HANA network settings |
| Connection fails | Wrong credentials | Check the username and password for the target database |
| A message that starts "HANA Error Code" | An error passed straight through from the HANA driver | Look up the code and description in SAP's HANA documentation, or ask your HANA administrator |
| No tables appear for a schema | The user lacks SELECT on that schema | Ask your HANA administrator to grant access to the schema and tables |
| Column ambiguity error | A join uses unqualified column names | Qualify 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.
Related
- Connect a database or app: the shared connector workspace steps and the full SQL view.
- Allow Mammoth through your firewall: the IP address to allow.
- Manage saved connections: edit, reuse or delete this connection.
- Refresh a dataset: change when the dataset refreshes.
- Connector reference: every source Mammoth connects to.
Something wrong? support@mammoth.io