Running SQL-like queries on files.

Related tags

Database filesql
Overview

filesql

Running SQL-like queries on files.

Features

Supported:

  • REPL
  • Basic SQL expressions.
  • INSERT clause. (which inserts data into another file)
  • WHERE clause.
  • ORDER BY clause. (Only in-memory sorting)
  • LIMIT clause.

Todo:

  • GROUP BY clause. (in-memory)
  • GROUP BY clause. (external storage)
  • ORDER BY clause. (external storage)
  • Optimization.
  • ...

Sample

Query countries list top rated by Covid-19 infected cases:

$ target/release/filesql -f testcases/select-top-10-infected-and-calc-death-rate.sql

Outputs:

+---------+--------------+----------------+-----------------+-------------+---------------------+
| country | infected_new | infected_total | recovered_total | death_total | death_rate          |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 美国    | 92226        | 47314139       | 37311667        | 775104      | 1.638207978380416   |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 印度    | 11210        | 34355184       | 33741010        | 460788      | 1.341247364589868   |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 巴西    | 13321        | 21874324       | 21062218        | 609417      | 2.785992380838832   |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 英国    | 33697        | 9272066        | 7560948         | 141743      | 1.5287099983973367  |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 乌干达  | 85           | 9126570        | 96878           | 3227        | 0.03535829999660332 |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 俄罗斯  | 41335        | 8795095        | 7561978         | 246814      | 2.806268721372538   |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 土耳其  | 28193        | 8206375        | 7680152         | 71927       | 0.8764771290612481  |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 法国    | 8998         | 7208937        | 6971152         | 117900      | 1.6354699728961426  |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 伊朗    | 6803         | 5987814        | 5601764         | 127299      | 2.1259678406844302  |
+---------+--------------+----------------+-----------------+-------------+---------------------+
| 阿根廷  | 1271         | 5296188        | 5162713         | 116091      | 2.1919727925066104  |
+---------+--------------+----------------+-----------------+-------------+---------------------+
10 rows selected.

Supported file formats

  • CSV/TSV
You might also like...
fast & easy CLI and vscode extension specialized to format MySQL INSERT queries.
fast & easy CLI and vscode extension specialized to format MySQL INSERT queries.

insertfmt fast & easy CLI specialized to format MySQL INSERT queries. format queries so that they look like a table. NOTE: If you wanna use the VSCode

TDS 7.2+ (mssql / Microsoft SQL Server) async driver for rust

Tiberius A native Microsoft SQL Server (TDS) client for Rust. Supported SQL Server versions Version Support level Notes 2019 Tested on CI 2017 Tested

Query LDAP and AD with SQL

SQLDAP Ever wanted to query AD or LDAP with SQL like queries ? I'm going to answer this question myself: yes ! Why ? Because I never could remember al

FeOphant - A SQL database server written in Rust and inspired by PostreSQL.

A PostgreSQL inspired SQL database written in Rust.

GlueSQL is a SQL database library written in Rust

GlueSQL is a SQL database library written in Rust. It provides a parser (sqlparser-rs), execution layer, and optional storage (sled) packaged into a single library.

Tool to automate the visualisation of UML dependencies from a SQL file
Tool to automate the visualisation of UML dependencies from a SQL file

Doteur A simple tool to draw your mysql relations from exports. Help us If you use the tool, and like it, don't forget to add a star to the project on

Fully typed SQL query builder for Rust [deprecated]

What is Deuterium? Deuterium is a fancy SQL builder for Rust. It's designed to provide a DSL to easily build SQL queries in safe and typed way. Like R

Ormlite - An ORM in Rust for developers that love SQL.

ormlite ormlite is an ORM in Rust for developers that love SQL. It provides the following, while staying close to SQL, both in syntax and performance:

Distributed SQL database in Rust, written as a learning project

toyDB Distributed SQL database in Rust, written as a learning project. Most components are built from scratch, including: Raft-based distributed conse

Owner
Zhang Li
Zhang Li
An object-relational in-memory cache, supports queries with an SQL-like query language.

qlcache An object-relational in-memory cache, supports queries with an SQL-like query language. Warning This is a rather low-level library, and only p

null 3 Nov 14, 2021
Run SQL queries on CSV files

zsql run SQL queries on csv files A terminal utility to easily run SQL queries on CSV files. zsql is shipped as a small single binary powered by rust

Zizaco 9 Jul 9, 2022
Distributed, version controlled, SQL database with cryptographically verifiable storage, queries and results. Think git for postgres.

SDB - SignatureDB Distributed, version controlled, SQL database with cryptographically verifiable storage, queries and results. Think git for postgres

Fremantle Industries 5 Apr 26, 2022
Rust library to parse, deparse and normalize SQL queries using the PostgreSQL query parser

This Rust library uses the actual PostgreSQL server source to parse SQL queries and return the internal PostgreSQL parse tree.

pganalyze 37 Dec 18, 2022
A Rust SQL query builder with a pleasant fluent API closely imitating actual SQL

Scooby An SQL query builder with a pleasant fluent API closely imitating actual SQL. Meant to comfortably build dynamic queries with a little bit of s

Aleksei Voronov 100 Nov 11, 2022
Gh-sql - Query GitHub Projects (beta) with SQL

gh-sql: Query GitHub Projects (beta) with SQL Installation gh extension install KOBA789/gh-sql Features SELECT items DELETE items UPDATE item fields

Hidekazu Kobayashi 108 Dec 7, 2022
SQL validator tool for BigQuery standard SQL.

bqvalid What bqvalid does bqvalid is the SQL validator tool for BigQuery standard SQL. bqvalid fails with error message if there's the expression that

null 10 Dec 25, 2022
A query builder that builds and typechecks queries at compile time

typed-qb: a compile-time typed "query builder" typed-qb is a compile-time, typed, query builder. The goal of this crate is to explore the gap between

ferrouille 3 Jan 22, 2022
This crate allows you to send cypher queries to the REST endpoint of a neo4j database

rusted_cypher Rust crate for accessing the cypher endpoint of a neo4j server This crate allows you to send cypher queries to the REST endpoint of a ne

Livio Ribeiro 68 Dec 1, 2022
Implementation of generic IBC queries in CosmWasm.

CosmWasm IBC Queries Implements generic IBC queries in CosmWasm. This implementation requires the same contract to be deployed on both chains wishing

Jake Hartnell 17 Oct 6, 2022