CLI interface for running SQL queries with Polars as backend
Project description
Polars CLI
The Polars command line interface provides a convenient way to execute SQL commands using Polars as a backend.
Installation
The recommended way to install the Polars CLI is by using pip:
pip install polars-cli
This will install a pre-compiled binary and make it available on your path under polars
.
If you do not have Python available, you can download a suitable binary from the most recent GitHub release.
Alternatively, you can install the Polars CLI using cargo, which will compile the code from scratch:
cargo install --locked polars-cli
Usage
Running polars
without any arguments will start an interactive shell in which you can run SQL commands.
$ polars
Polars CLI version 0.4.0
Type .help for help.
>> select * FROM read_csv('examples/datasets/foods.csv');
┌────────────┬──────────┬────────┬──────────┐
│ category ┆ calories ┆ fats_g ┆ sugars_g │
│ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ i64 ┆ f64 ┆ i64 │
╞════════════╪══════════╪════════╪══════════╡
│ vegetables ┆ 45 ┆ 0.5 ┆ 2 │
│ seafood ┆ 150 ┆ 5.0 ┆ 0 │
│ meat ┆ 100 ┆ 5.0 ┆ 0 │
│ fruit ┆ 60 ┆ 0.0 ┆ 11 │
│ … ┆ … ┆ … ┆ … │
│ seafood ┆ 200 ┆ 10.0 ┆ 0 │
│ seafood ┆ 200 ┆ 7.0 ┆ 2 │
│ fruit ┆ 60 ┆ 0.0 ┆ 11 │
│ meat ┆ 110 ┆ 7.0 ┆ 0 │
└────────────┴──────────┴────────┴──────────┘
Alternatively, SQL commands can be piped directly into the Polars CLI.
$ echo "SELECT category FROM read_csv('examples/datasets/foods.csv')" | polars
┌────────────┐
│ category │
│ --- │
│ str │
╞════════════╡
│ vegetables │
│ seafood │
│ meat │
│ fruit │
│ … │
│ seafood │
│ seafood │
│ fruit │
│ meat │
└────────────┘
Features
When compiling the Polars CLI from source, the following features can be enabled:
Feature | Description |
---|---|
default | The default feature set that includes all other features. |
highlight | Provides syntax highlighting |
parquet | Enables reading and writing of Apache Parquet files. |
json | Enables reading and writing of JSON files. |
ipc | Enables reading and writing of IPC/Apache Arrow files |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for polars_cli-0.5.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff054efc8478c529e5e5ab025046740392512a37d0a8e4ca1fdf735fd9f3f278 |
|
MD5 | b6ed9358471a602d12cb5720a7fd7924 |
|
BLAKE2b-256 | 016c8c608c586b2d620e1da51108f71c2def4030a0f05b35388330e00f7c81cb |
Hashes for polars_cli-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4184dd521cad3f36abc1eba4a8d5adfdfb51f485560dd9b3d054f8ee68c95583 |
|
MD5 | c59f9113c97a627ca168dfa83b55dbe0 |
|
BLAKE2b-256 | a2740549c861ccd4a7f97a449e396a54b2815599e6eb2dc22f206591ba8ea004 |
Hashes for polars_cli-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d6ac1fbc7055e0648254968916b988144fa18e540241cd9d4eadb0cf373823a |
|
MD5 | 3abeed63c760ceb0c148c6da32644430 |
|
BLAKE2b-256 | b2c58d142c9288f3d19ca959358e5541b590d04b2b18feecc9101d35d90b9ad9 |
Hashes for polars_cli-0.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2ad2d01580fb5c20fdd1766dd0518a68943167d6286b9b6fc7a67f1ec8b787c |
|
MD5 | 95bfa3c0393405049796486443c7d307 |
|
BLAKE2b-256 | bea1bf79e78374803ab5377f61e3417134f43f97397291fced0b5c2051e30997 |
Hashes for polars_cli-0.5.0-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45d45992ebb309dccfefa4242788bdf53351960c97fa1f93489127d4f0b6df2e |
|
MD5 | 9006bd904a5020c97bd2d9a8fad922ef |
|
BLAKE2b-256 | bc645a6b7432e8bef3041a0e2ab17ec6e3bf39289c43e94e481767347cdfe5b2 |