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.1-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f09c9811c8bd22740e51adddc08afdaf945aa2c271273f4dea62ddd2e867244d |
|
MD5 | 8496c5d47862b4032a4829972f111607 |
|
BLAKE2b-256 | eed6e77d3be5135de074341daad4c997975f477a013c2a0ba4620010dc5e3044 |
Hashes for polars_cli-0.5.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93873e19dd022ef559db6fef69435cd8966ba66ffb63ddb6b2eb9a12ac479bc3 |
|
MD5 | f610b30a3ebb7ada3feee6e25e482fd1 |
|
BLAKE2b-256 | bbbf9dc61f837a255cbea49352e432890221436b5d65af2802b250aea8ed662d |
Hashes for polars_cli-0.5.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d59dce98ac53e2b0d4ebb0ff2f5cba8ed6a53c6af6aba05707f620b376dfc4b |
|
MD5 | f9bb59031043cb120085dc0f34bd929c |
|
BLAKE2b-256 | bf35fc633a6eac4526f78dc6ea53a21048a77de6b533dab306951538e507d880 |
Hashes for polars_cli-0.5.1-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6248afa1f243c873b33cd90c5397e0974320126bb1ef3fd67d5cd4f0832dfae6 |
|
MD5 | fb6ebd82edac5f4c447feab42c847ca1 |
|
BLAKE2b-256 | cb1d2c9b331bf1394263b9b19d0ae4135b3711a13f7a38b1c64e7ee464e6dcc8 |
Hashes for polars_cli-0.5.1-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 540ca7f241cd2da6cbc0bc6ab6f4619a056b906949d59985c22e79adec0f61a8 |
|
MD5 | f1093af6077e4279f0af6c67dc9d36cb |
|
BLAKE2b-256 | fd0db2bf85defe9219bc3d2e4c153c0727f406439397a67e8639a532a2c3239a |