@vladimir-nussem/abis-lazy-cube
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Lazy Loading Olap CUBE that loads as the user requests the combination of dimensions/measures

Installation

npm install --save @vladimir-nussem/abis-lazy-cube

Running the app

.env -- for postgres
DB_TYPE=postgres 
DB_NAME=cube
DB_USER_NAME=u0
DB_PASSWORD=
DB_HOST=localhost
DB_PORT=5432
DB_SYNCHRONIZE=true -- creates cube tables on startup
DB_LOGGING=true
.env -- for oracle (< 11)
DB_TYPE=oracle
DB_USER_NAME=<user name>
DB_PASSWORD=<password>
DB_HOST=localhost
DB_PORT=5432
DB_CONNECTION_STRING=
DB_SYNCHRONIZE=false -- does not work for oracle :( -- wip
DB_LOGGING=true

app.module.ts

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { LazyOlapModule, LazyQueryService, LazyQueryModule } from "@vladimir-nussem/abis-lazy-cube";

@Module({
    imports: [
        LazyOlapModule,
        LazyQueryModule        
    ],
    controllers: [AppController],
    providers: [AppService],
})
export class AppModule {}

app.controller

import { Body, Controller, Get, Put } from '@nestjs/common';
import { LazyQueryService } from "@vladimir-nussem/abis-lazy-cube";

@Controller()
export class AppController {
  constructor(
    private queryService: LazyQueryService
  ) {}
  
  @Post()
  query(@Body() body) {
    this.queryService.query(body.dimentions, body.measures, body.tableName, body.tableAlias, body.cubeName, body.where);
  }
}

http request

POST http://localhost:3000
Content-Type: application/json

{
	  "cubeName": "<name>",
    "tableName": "<table name>",
    "tableAlias": "<table alias>",    
    "where": "optional sql where prefilter condition", 
    "dimensions": [
        {
            "alias": "dimension name",
            "name": "<column name>",
            "values": [value1, value2],
            "aggregate": boolean                  
        },
        {
            "alias": "name of resulted column",
            "name": "table_field",
            "values": [value1, value2],
            "aggregate": boolean      
            "ignore": optional boolean
        }        
    ],  
    "measures": [
        {
            "alias": "measured name",
            "value": "aggregate function on column sum(table_field), count(*)"
        },
        {
            "alias": "measured name",
            "value": "aggregate function on column sum(table_field), count(*)"
        }
    ]
}

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

Readme

Keywords

none

Package Sidebar

Install

npm i @vladimir-nussem/abis-lazy-cube

Weekly Downloads

7

Version

0.1.2

License

MIT

Unpacked Size

300 kB

Total Files

114

Last publish

Collaborators

  • vladimir-nussem