Skip to content

koenbok/tablet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tablet

Tablet is a data analysis toolkit that loads, transforms and writes data to different formats.

A typical example is loading an arbitrary csv file, converting it to sqlite, running a query and storing the result in another sqlite database. It is perfect for turning any messy csv data file into a structured sqlite database that you can work with.

Usage

import { Table } from "tabletjs"

const main = async () => {

    const tableA = await Table.import.csv("data.csv")
    const tableB = await tableA.query("SELECT name, age, city FROM data")

    tableB.export.sqlite("db.sqlite3")
}

main()

Tablet tries to accurately guess your data structure like dates, numbers, booleans and strings so you can query them directly. It is pretty good at guessing formats through sampling, including currency formats and odd date formats.

Getting Started

  • npm install --save-dev tabletjs

Documentation

For complete docs, see the generated documentation in dist/docs.

  • Tablet.import.csv(path: string) load a csv file and guess the structure.
  • tablet.export.csv(path: string) write the data to a csv file (including headers).
  • tablet.export.sqlite(path: string) write the data to an sqlite3 db.
  • tablet.export.sql(path: string) write the data to an sql server (using Sequelize).
  • tablet.query(sql: string) create a new Table with the resulting sql query.
  • tablet.map(f: Function) create a new Table with the transformed data.
  • tablet.merge(table: Table) create a new Table with the two merged tables.

About

Tablet – A data toolkit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published