The connector can be configured using the following settings from the data source.
- host (default to 'localhost'): The host name or ip address of the SAP HANA server
- port (default to 30015): The port number of the SAP HANA server
- username: The user name to connect to the SAP HANA server
- password: The password
- debug (default to false)
NOTE: By default, the default schema of the user is used for all tables which is the same as the username.
The SAP HANA connector uses node-hdb as the driver. See more information about configuration parameters, check https://github.com/SAP/node-hdb/blob/master/README.md.
SAP HANA data sources allow you to discover model definition information from existing SAP HANA databases. See the following APIs:
- [dataSource.discoverModelDefinitions([username], fn)]
- [dataSource.discoverSchema([owner], name, fn)]
Model definition for SAP HANA
The model definition consists of the following properties:
- name: Name of the model, by default, it's the camel case of the table
- options: Model level operations and mapping to SAP HANA schema/table
- properties: Property definitions, including mapping to SAP HANA column
JSON to SAP HANA Types
- String|JSON|Text|default: VARCHAR, default length is 1024
- Number: INTEGER
- Date: TIMESTAMP
- Timestamp: TIMESTAMP
- Boolean: VARCHAR(1)
SAP HANA Types to JSON
- VARCHAR(1): Boolean
- VARCHAR|NVARCHAR|ALPHANUM|SHORTTEXT: String
- VARBINARY: Binary;
- TINYINT|SMALLINT|INTEGER|BIGINT|SMALLDECIMAL|DECIMAL|REAL|DOUBLE: Number
- DATE|TIME|SECONDDATE|TIMESTAMP: Date
Destroying models may result in errors due to foreign key integrity. Make sure to delete any related models first before calling delete on model's with relationships.
Auto Migrate / Auto Update
After making changes to your model properties you must call
Model.autoupdate(). Only call
Model.automigrate() on new models
as it will drop existing tables.
LoopBack SAP HANA connector creates the following schema objects for a given model:
- A table, for example, "product" under the default schema of the user
- A sequence with name "product_seq" if the primary key "id" is auto-increment
- Prerequisites for saphana.discover.test.js: execute tables.sql in SAP HANA Studio