qsv - Performant CLI tool to query CSVs through SQL

Related tags

Command-line qsv
Overview

qsv

Performant CLI tool to query CSVs through SQL

Installation

After cloning the repository, you can install a binary locally using cargo install --path .

Features

Usage/Features

The intention is for all SQLite syntax to be supported with CSVs as the data source including: joins, subqueries, CTEs, unions, etc...

Simple queries

qsv supports syntactically valid SQLite queries run on CSV data:

qsv query "SELECT * FROM foo.csv AS foo INNER JOIN bar.csv AS bar ON (foo.id = bar.foo_id);"

qsv query "WITH ages(age) AS (SELECT age FROM testdata/people.csv) SELECT * FROM testdata/people.csv AS people INNER JOIN ages ON (people.age = ages.age);"

you can escape spaces in a filename like so (you may have to escape backticks depending on shell):

qsv query "select * from `testdata/occupations with spaces.csv`"

you can load from gzipped CSV data:

qsv query "select * from testdata/people.csv.gz"

Statistical analysis

qsv can run some limited statistical analyses on a CSV given to it, returning things like the mean, standard deviation, top 10 most common values for each column:

qsv stats testdata/statistical.csv

SQLite user defined functions

In order to make some common data analysis tasks simpler, qsv has a number of user defined functions added to SQLite. If there's something you'd like added, please request it as a Github Issue.

  • md5(text)
  • sqrt(real)
  • stddev(real)
  • mean(real)

Options

  • --delimiter= to set a custom delimiter in the CSVs. Only set globally on the query
  • --textonly force all columns to be inferred as strings/text
  • --trim trim fields in CSVs in case there is additional whitespace. Will not remove whitespace from the middle of a string
  • --output-header outputs the header alongside the results of the query. Off by default to make the output more in line with SQL
You might also like...
An interactive Bayesian Probability Calculator CLI that guides users through updating beliefs based on new evidence.

Bayesian Probability Calculator CLI Welcome to the Bayesian Probability Calculator CLI! This command-line tool is designed to help you update your bel

Rust Imaging Library's Python binding: A performant and high-level image processing library for Python written in Rust

ril-py Rust Imaging Library for Python: Python bindings for ril, a performant and high-level image processing library written in Rust. What's this? Th

A performant terminal-based project editor with extensive shortcuts
A performant terminal-based project editor with extensive shortcuts

omega A performant and extensive terminal-based project editor with a wide variety of modern shortcuts. How to use omega [path] This section will guid

Terminal based, feature rich, interactive SQL tool

datafusion-tui (dft) DataFusion-tui provides a feature rich terminal application, built with tui-rs, for using DataFusion (and eventually Ballista). I

Command line tool to query the Oxford Dictionaries API.
Command line tool to query the Oxford Dictionaries API.

oxd Oxd is a client library for the Oxford Dictionary API. It provides a series of structs modeling entries returned from the API, a function [get_ent

Koi is a simple tool built to let you use ChatGPT through the command line

Koi is a simple tool built to let you use ChatGPT through the command line. It adds the ability to let ChatGPT run commands on your computer in order to help you out, or to help you out with complicated tasks.

Burrow is a tool for burrowing through firewalls, built by teenagers at Hack Club.

Burrow Burrow is a tool for burrowing through firewalls, built by teenagers at Hack Club. At its core, burrow is a command line utility written in Rus

A CLI tool to get help with CLI tools 🐙
A CLI tool to get help with CLI tools 🐙

A CLI tool to get help with CLI tools 🐙 halp aims to help find the correct arguments for command-line tools by checking the predefined list of common

AskBend: SQL-based Knowledge Base Search and Completion using Databend

AskBend: SQL-based Knowledge Base Search and Completion using Databend AskBend is a Rust project that utilizes the power of Databend and OpenAI to cre

Comments
  • add more user defined functions

    add more user defined functions

    Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi.

    String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter.

    Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile

    opened by hderms 0
  • figure out how we want to alert if a filename couldn't be loaded.

    figure out how we want to alert if a filename couldn't be loaded.

    We should probably only warn if the table identifier looked like a CSV filename, or just a filename in general. Also, when failing, we should print out the failed query

    opened by hderms 0
Releases(0.1.0)
Owner
Dermot Haughey
Dermot Haughey
qsv: Ultra-fast CSV data-wrangling toolkit

qsv is a command line program for indexing, slicing, analyzing, splitting, enriching, validating & joining CSV files. Commands are simple, fast & composable

Joel Natividad 398 Jan 3, 2023
A tool that allow you to run SQL-like query on local files instead of database files using the GitQL SDK.

FileQL - File Query Language FileQL is a tool that allow you to run SQL-like query on local files instead of database files using the GitQL SDK. Sampl

Amr Hesham 39 Mar 12, 2024
ClangQL is a tool that allow you to run SQL-like query on C/C++ Code instead of database files using the GitQL SDK

ClangQL - Clang AST Query Language ClangQL is a tool that allow you to run SQL-like query on C/C++ Code instead of database files using the GitQL SDK.

Amr Hesham 490 Oct 23, 2024
Fgr - Find & Grep utility with SQL-like query language

fgr Find & Grep utility with SQL-like query language. Examples # Find all files with name equal to sample under the current directory: fgr -e name=sam

Igor 3 Dec 22, 2022
A SQL query parser written using nom.

sqlparser-nom A SQL query parser written using nom. Query Select From Where Order by Limit CTE Group by Having Aggregate Window Pratt Parsing Friendly

SystemX Labs 27 Sep 28, 2023
A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

Andrew Vitale 2 Apr 25, 2022
A Rust CLI tool that helps you enforce Git policies through Git hooks both server and client side

GitPolicyEnforcer This is a command line utility written in Rust, that helps you utilize Git hooks, to enforce various policies. It currently supports

Vagelis Prokopiou 4 Aug 14, 2022
Voila is a domain-specific language launched through CLI tool for operating with files and directories in massive amounts in a fast & reliable way.

Voila is a domain-specific language designed for doing complex operations to folders & files. It is based on a CLI tool, although you can write your V

Guillem Jara 86 Dec 12, 2022
A rust library + CLI tool that tells you when swas will upload new video through complex calculations

A rust library + CLI tool that tells you when swas will upload new video through complex calculations. It also lets you search and play youtube videos of swas and other channels. Searching about youtube channels is also an option. Basically it's a youtube search cli tool written in rust.

midnightFirefly 4 Jun 10, 2022
CLI to query for public transport connections in switzerland

Swiss Public Transport CLI This is a simple tool to search public transport connections from one station to another, possible with a via. It uses the

Sandro Covo 4 Apr 2, 2022