npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

loopback-connector-saphana

v0.7.2

Published

SAP HANA connector for loopback-datasource-juggler

Downloads

332

Readme

loopback-connector-saphana

loopback-connector-saphana is the SAP HANA connector module for loopback-datasource-juggler.

Connector settings

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.

Discovering Models

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

    {"name": "Inventory", "options": {
      "idInjection": false,
      "hdb": {
        "schema": "strongloop",
        "table": "inventory"
      }
    }, "properties": {
      "id": {
        "type": "String",
        "required": false,
        "length": 64,
        "precision": null,
        "scale": null,
        "hdb": {
          "columnName": "id",
          "dataType": "varchar",
          "dataLength": 64,
          "dataPrecision": null,
          "dataScale": null,
          "nullable": "NO"
        }
      },
      "productId": {
        "type": "String",
        "required": false,
        "length": 20,
        "precision": null,
        "scale": null,
        "id": 1,
        "hdb": {
          "columnName": "product_id",
          "dataType": "varchar",
          "dataLength": 20,
          "dataPrecision": null,
          "dataScale": null,
          "nullable": "YES"
        }
      },
      "locationId": {
        "type": "String",
        "required": false,
        "length": 20,
        "precision": null,
        "scale": null,
        "id": 1,
        "hdb": {
          "columnName": "location_id",
          "dataType": "varchar",
          "dataLength": 20,
          "dataPrecision": null,
          "dataScale": null,
          "nullable": "YES"
        }
      },
      "available": {
        "type": "Number",
        "required": false,
        "length": null,
        "precision": 32,
        "scale": 0,
        "hdb": {
          "columnName": "available",
          "dataType": "integer",
          "dataLength": null,
          "dataPrecision": 32,
          "dataScale": 0,
          "nullable": "YES"
        }
      },
      "total": {
        "type": "Number",
        "required": false,
        "length": null,
        "precision": 32,
        "scale": 0,
        "hdb": {
          "columnName": "total",
          "dataType": "integer",
          "dataLength": null,
          "dataPrecision": 32,
          "dataScale": 0,
          "nullable": "YES"
        }
      }
    }}

Type Mapping

  • Number
  • Boolean
  • String
  • Object
  • Date
  • Array

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

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.automigrate() or 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

Running tests

npm test
  • Prerequisites for saphana.discover.test.js: execute tables.sql in SAP HANA Studio