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.6.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c8b0e01619f513382ff19571a5ff9b5ab4fa59be6b6019377c71eae3dfbfcff |
|
MD5 | 68e5291879504dd88e0eab644bde8ad7 |
|
BLAKE2b-256 | db9e121df430fec528aee6d4067d1bda42b40c6342a329031fdf1a744213668f |
Hashes for polars_cli-0.6.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9267c100cca752d1c4d9dbcce5f1ad882d4a398282de7cbdb781a9abff4ade8d |
|
MD5 | addbd0ca1b3b173b68bb48d1843e59a9 |
|
BLAKE2b-256 | 9164fb0b8e7f15f1a67c72b1a40beeea6d6d8a1c3628219ef71d7144e0b07ce9 |
Hashes for polars_cli-0.6.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 275dddc18c8043cff2d91add0178db3f3211f2e214680d398ad85ad008419e18 |
|
MD5 | c80e3208a6366db86cac0181aa70fe56 |
|
BLAKE2b-256 | 845620b730a4fd91fc94c3f4066a9485afea479ed928d92120851a38c3be31e3 |
Hashes for polars_cli-0.6.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 110c855d8a4648030c0e2f61bee01038eaf819ad0f37d01d5dff4d300a3579df |
|
MD5 | d85697787d7fe4d85d0edda1874fc897 |
|
BLAKE2b-256 | 1d43681a80daccecdafd4e862ed9939fe136622077d7bd7cd3aea5d356fe7ee0 |
Hashes for polars_cli-0.6.0-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ca38e1132fda58fcac24ec41b9f1ef689d28595a00196e65b30b479e74d3323 |
|
MD5 | 3403e5030592e452e0fbaf960d4e6de3 |
|
BLAKE2b-256 | 43d89143cdf92e391600c76d7b73b5a7b79fa1ccc2e2653dbc4e950c87b5769b |