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.7.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c6fac69251b0d0baf91dba1f8c2f81416ecad84c3b8420b2eb50f209f84bb90 |
|
MD5 | 2eeda6381b7cbbf7db71177fecfbecda |
|
BLAKE2b-256 | 636c1a00f96f4b2140381f63b6b8dd8ebf963d274c38484e8d1fa608a50b1052 |
Hashes for polars_cli-0.7.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b2f242b9d0c04e413c34002dd12a92cd1a9d88c833b0523042f2d4b14575160 |
|
MD5 | 8b439c69f4375c5fc2f834ec3a4d0d52 |
|
BLAKE2b-256 | 10580a5ff2d843c67bb69ec3d3fdbc1ab97fb9cca77fcc2fe431537d2c21f0a3 |
Hashes for polars_cli-0.7.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b35bbd2bba3839a2ed2bca72bf70af82019bbee8eeaa4f4e22a6ab29fe2c8a10 |
|
MD5 | 332f0dea75830fd585ea55dcd1c76615 |
|
BLAKE2b-256 | 7d1b19755dce19342d74c9888e804c8f602f9de17ed7eb65de6d7f5bfea1fa0d |
Hashes for polars_cli-0.7.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3074b8b30349cf2d2ef4ff2e1f6e0bc02fb887e80ceb9b6cb394bfde929fa1e6 |
|
MD5 | d3a7bbe7a2f35f02a31a302316b4760c |
|
BLAKE2b-256 | 7391cf4a7cff10374461a5a8ec9f4a8fdc66bb2c8d22a0dc8ddaf4d10d7aaec3 |
Hashes for polars_cli-0.7.0-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d04b4be1f013c5a22d0f92d6b9ce903c4762e145c35e9148226854e89f6d2e3 |
|
MD5 | a241265860afda921b3777136001d7cd |
|
BLAKE2b-256 | e40bf102c34f0c53f4321e66c3fb106703f2a2573d077f87233e8a91a1bb6528 |