Code Monkey home page Code Monkey logo

csvql's Introduction

CSVql - A query language for CSV files

Synopsis

> cat people.csv
# These are just some sample data. Lines with comments start
# with a hash or with semicolon
; The first non-empty line that is not a comment contains names
; of the columns in the file. The other non-empty lines contain
; the data.
id,name,age,sallary,department
1,John Doe,52,2500,sales
2,Jane Doe,49,2300,marketing
3,Foo Bar,35,3000,it
4,Enoch Root,70,4000,it

> cat departments.csv:
# These are some sample departments
id,name
sales,Sales department
marketing,Marketing guys and girls
it,IT Crowd

> cat data.csv | where 'age < 50' | join departments.csv as dep | select name, sallary, dep.name
Jane Doe,2300,Marketing guys and girls
Foo Bar,3000,IT Crows

> cat data.csv | aggregate department, avg(sallary)
sales,2500
marketing,2300
it,3500

Why CVSql?

Do you use CVS files as a part of your workflow? If your workflow is automated, you probably know that any changed to the source of the data is a nightmare. Adding or removing columns leads to updating all scripts.

Why not use a SQL database?

CSVql is designed for situations, where you only need one-time processing, such as when the data being processed are not the final data and need not to be stored. The queries are performed only once, for example to generate reports. In this case, the benefits of using a databse do not apply, as most of the processing is only done once. However, using a database makes the workflow dependent on the database server being installed and configured properly wherever the workflow is used.

Why not use cut, sed, grep, and other standard Unix tools?

While CSVql replicates some functionality of standard Unix tools such as grep, cut or paste, CSVql-bases scripts are easier to use and maintain thanks to its column-based design. All the standard Unix tools use numbers to address the columns. This is fine, until you change the columns in the original source of data.

Requirements

  • Perl 5.8

  • Text::CSV

  • Natural Docs for building documentation

csvql's People

Stargazers

 avatar Mordechai Meisels avatar Dustin avatar Tiago Cunha avatar Gabriel Aires Guedes avatar  avatar David Luu avatar Charles Wang avatar Nazeeruddin Ikram avatar Antonio Lima avatar Michael McEniry avatar Ondřej Sýkora avatar

Watchers

Ondřej Sýkora avatar

Forkers

hderms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.