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
File details
Details for the file polars_cli-0.8.0.tar.gz
.
File metadata
- Download URL: polars_cli-0.8.0.tar.gz
- Upload date:
- Size: 35.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 217b9c7601b93c07147c93c50490311a254210af0867bdee766f92725377a901 |
|
MD5 | ea9b2fc3b0b92eaebb37b5f4cfd18312 |
|
BLAKE2b-256 | 912e7398eb771e740663ed79d800288264fa47896bc5aad4bc35c2f3a840a4af |
File details
Details for the file polars_cli-0.8.0-py3-none-win_amd64.whl
.
File metadata
- Download URL: polars_cli-0.8.0-py3-none-win_amd64.whl
- Upload date:
- Size: 10.5 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05b75d65f202b0ba95f871a92093d2db9cc5440e3314ec41ea09b0dfa4982f34 |
|
MD5 | f10d781ba92436f9bec0f7e7258f04f6 |
|
BLAKE2b-256 | 5e2bfdcb580b3a73711c109f9c8a552c063466e836c555f2fcd6a4379d2595ee |
File details
Details for the file polars_cli-0.8.0-py3-none-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: polars_cli-0.8.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.8 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a727fb50f9c98340c324052f9ed6657459902917fddc52b49b74888fac2c1bcb |
|
MD5 | 606550eabb7d51bf951de0b0c71d693a |
|
BLAKE2b-256 | 0a4eaf4895e87ab98fa0c38910de78f750c5ee20ecbf4106d70442f1ae8b585c |
File details
Details for the file polars_cli-0.8.0-py3-none-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: polars_cli-0.8.0-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 10.3 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ced29af5b5420335c660933e2fe773976e0ba64c7e01a02f16b73897bcbc179c |
|
MD5 | 9b1bfc4ce9c49255493b15271ad3ac33 |
|
BLAKE2b-256 | 3ae882b4201855b67b166e9333a73612cac97cbf2f70fdb514c279ee70585f7e |
File details
Details for the file polars_cli-0.8.0-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: polars_cli-0.8.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 9.0 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2d8e2c303d2129a4ee5b6891ab10b8b0d43456a683ece877abca87694e7b3f0 |
|
MD5 | 699496dbc0c8b7e73bff4811554149eb |
|
BLAKE2b-256 | 754883b41815126909970871d04e0f53c36a3ff6c7f5c74505ed53927a803fdc |
File details
Details for the file polars_cli-0.8.0-py3-none-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: polars_cli-0.8.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 10.6 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a74c9a1068443e0b4c395e6cf86859b2c5ffbb52d8db49d49cf9f561bff43c88 |
|
MD5 | 8525de3faacf33bc4a7e1f3bfe938f49 |
|
BLAKE2b-256 | cc918c65a02ff6fdf8e9b5d83eb85a883ec8e6014e6a89923aeda435c19e1d1f |