0.1.2 • Published 2 years ago

sql-tools v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

sql-tools

olap for sql non-olap engines / and other tools

designing version downloads build coverage climate dependencies

language: English also available in: Spanish

Install

$ npm install sql-tools

Main goal

Transfor a SQL sentence in a SQL with totals.

Definitions

Uses a list of field definition with the form:

attributemandatoryuse
nameyesname of the field in the database
placeyes'data' if must be added, 'left' or 'top' if it must apear in the GROUP BY clausule
aggLabelfor pivottext to insert in the added rows
aggExpnothe expression when is different to SUM(x)

Example

var olap = require('sql-tools').olap;

var varsDef=[
  {name: "zone", place:"left", aggLabel:"=SUM="}, 
  {name: "kind", place:"left"},
  {name: "sales", place:"data"},
  {name: "calif", place:"data", aggExp:"min(calif)"}
];

var sql_total=olap.cube("select * from sales", 'zone', varsDef);

console.log(sql_total);
/*
WITH "olap cube" AS (
 select * from sales
) SELECT * FROM "olap cube"
UNION SELECT '=SUM=', kind, SUM(sales), min(calif)
  FROM "olap cube"
  GROUP BY kind
*/

License

MIT

.............................

0.1.2

2 years ago

0.1.0

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago