For the idea behind this repository check my blog post Using SQL to analyze data in JavaScript without a database
The implementation is based on the SQLLite parser written by Nick Wronski for Codeschool which parses SQL statements and generates an abstract syntax tree out of which the neccessary data can be extracted.
Please note that this is experimental and to be considered a case study.
If you would however like to use or build on this technique, feel free to do so.
You can find a nice collection of data to analyze in this github repo by Justin Dorfman
Currently supported statements:
- select *
- select column
- select column1, column2
- select sum(column)
- select avg(column)
- select min(column)
- select max(column)
- select count(*)
- where column = 3
- where column = 'str'
- where column like 'A%' (begins with A)
- where column like '%D' (ends with D)
- where column like 'DA' (contains DA)
- order by column asc
- order by column desc
since the where clause is eval'd you can do more advanced stuff e.g. on sub-objects in your dataset like:
- where "arrColumn[0].subObj" = 'something'
- where "arrColumn.every((cur) => {return cur.val > 3;})" = 'true'
Note that due to the fact that sqllite columns are case insensitive you have to put camelCase columns in quotation-marks:
Checking if a column is null only works like this: where "column == null" = 'true'
This project was generated with angular-cli version 1.0.0-beta.20-4.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive/pipe/service/class
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.
Run ng github-pages:deploy
to deploy to Github Pages.
To get more help on the angular-cli
use ng --help
or go check out the Angular-CLI README.