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

json-hana-sql

v1.0.4

Published

JSON HANA SQL mapper for analytical queries

Downloads

6

Readme

JSON-HANA-SQL

JSON-HANA-SQL library converts JSON parameters into HANA SQL for easily building custom analytics query from the UI

Functionality

| Feature | Available | | ------------- |:-------------:| | Grouping | Yes | | Join | Yes | | Filter | Yes | | Sorter | Yes | | Top | Yes | | Skip | Yes | | Union | No |

Samples

const JSON2HANASQL = require('json-hana-sql');
let jsonql = {
    "table":[
        {
            name:"IBI.CLVStandard_CUS",
            column:[
                {name:"CustomerCategory",groupOperator:"",alias:"Customer Category"},
                {name:"CustomerID",groupOperator:"COUNT",alias:"Customer ID"},
                {name:"TotalSales",groupOperator:"SUM",alias:"Total Sales"},
                {name:"SalesFrequency",groupOperator:"AVG",alias:"Average Sales Frequency"}
            ]
        },
        {
            name:"IBI.Project",
            column:[
                {name:"Name",groupOperator:"",alias:"Project Name"}
            ]
        }
    ],
    "filters":[
        {table:"IBI.CLVStandard_CUS",columnName:"ProjectID",operator:"in",value:"('3C6802B0B2AB4AE31700BA3AF0A68918','0')"}
    ],
    "sorters":[
        {columnAlias:"Total Sales",desc:false}
    ],
    "join":[
        {fromTable:"IBI.CLVStandard_CUS",fromColumn:"ProjectID",toTable:"IBI.Project",toColumn:"ID",joinType:"inner join"}
    ],
    "top":3,
    "skip":0
}

console.log(JSON2HANASQL(jsonql));

Output

select
        "IBI.CLVStandard_CUS"."CustomerCategory" as "Customer Category" , COUNT("IBI.CLVStandard_CUS"."CustomerID") as "Customer ID" , SUM("IBI.CLVStandard_CUS"."TotalSales") as "Total Sales" , AVG("IBI.CLVStandard_CUS"."SalesFrequency") as "Average Sales Frequency" , "IBI.Project"."Name" as "Project Name"
         from "IBI.CLVStandard_CUS"   inner join  "IBI.Project" on 
            "IBI.CLVStandard_CUS"."ProjectID" = "IBI.Project"."ID"
        
         where "IBI.CLVStandard_CUS"."ProjectID"  in  ('3C6802B0B2AB4AE31700BA3AF0A68918','0') 
         group by "IBI.CLVStandard_CUS"."CustomerCategory","IBI.Project"."Name"
        order by "Total Sales"
        limit 3 offset 0
    ;

Samples

jsonql = {
    "table":[
        {
            name:"IBI.CLVStandard_CUS",
            column:[
                {name:"CustomerCategory",groupOperator:"",alias:"Customer Category"},
                {name:"CustomerID",groupOperator:"COUNT",alias:"Customer ID"},
                {name:"TotalSales",groupOperator:"Max",alias:"Total Sales"},
                {name:"SalesFrequency",groupOperator:"AVG",alias:"Average Sales Frequency"}
            ]
        }
    ]
}

console.log(JSON2HANASQL(jsonql));

Output

    select
        "IBI.CLVStandard_CUS"."CustomerCategory" as "Customer Category" , COUNT("IBI.CLVStandard_CUS"."CustomerID") as "Customer ID" , Max("IBI.CLVStandard_CUS"."TotalSales") as "Total Sales" , AVG("IBI.CLVStandard_CUS"."SalesFrequency") as "Average Sales Frequency"
         from "IBI.CLVStandard_CUS"
        
         group by "IBI.CLVStandard_CUS"."CustomerCategory"
        
        limit 99999 offset 0
    ;