This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This module provides a very simple command-line tool for running arbitrary SQL queries on CSV files. It’s useful for situations where you need to quickly explore and manipulate CSV files, where using a full database is often overkill.

Say we have the following two files:

employees.csv:

surname,department_id
Rafferty,31
Jones,33
Steinberg,33
Robinson,34
Smith,34
John,

departments.csv:

department_id,department_name
31,Sales
33,Engineering
34,Clerical
35,Marketing

Let’s load these two CSV files:

$ csvquery employees.csv departments.csv

At this point, you will be presented with an interactive SQL console:

* file 'employees.csv' loaded into table 'csv'
* file 'departments.csv' loaded into table 'csv2'
SQL Interactive Console
=>

You can see that the file employees.csv was loaded into an SQL table named csv and the file departments.csv into a table named csv2. From here, you can start running whatever SQL queries you want.

Let’s select all of the records from the employees table:

=> SELECT * FROM csv
surname,department_id
Rafferty,31
Jones,33
Steinberg,33
Robinson,34
Smith,34
John,None

And now let’s join the employees table to the departments table:

=> SELECT csv.surname, csv2.department_name FROM csv NATURAL JOIN csv2
surname,department_name
Rafferty,Sales
Jones,Engineering
Steinberg,Engineering
Robinson,Clerical
Smith,Clerical

Press ^D to exit the SQL console when you are done.

You can also specify an SQL query as an argument to csvquery (which is more useful for scripts, where you can’t use the interactive console):

$ csvquery -q "SELECT csv.surname, csv2.department_name FROM csv NATURAL JOIN csv2" departments.csv

The output of this command is CSV formatted, so it can be redirected to an output CSV file if required:

$ csvquery -q "SELECT csv.surname, csv2.department_name FROM csv NATURAL JOIN csv2" departments.csv > employee_departments.csv

Warning: All of the input CSV files are loaded into memory to perform the queries. This means that this module is not appropriate for processing very large CSV files.

Release History

Release History

0.0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
csvquerytool-0.0.3.tar.gz (5.5 kB) Copy SHA256 Checksum SHA256 Source Nov 19, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting