https://github.com/badihio/querify
CLI tool that provides SQL interface for data sources
https://github.com/badihio/querify
cli sql
Last synced: 5 months ago
JSON representation
CLI tool that provides SQL interface for data sources
- Host: GitHub
- URL: https://github.com/badihio/querify
- Owner: badihio
- License: gpl-3.0
- Created: 2024-03-07T19:34:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-21T14:08:32.000Z (almost 2 years ago)
- Last Synced: 2025-08-25T02:16:34.358Z (10 months ago)
- Topics: cli, sql
- Language: Python
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Querify

Querify is a CLI tool that provides SQL interface for data sources.
It is useful for data manipulation using a standard interface for various data sources, and provides an SQL features that allows to query the data in a more convenient way, like `WHERE`, `GROUP BY`, `ORDER BY` and `LIMIT`.
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install foobar.
```bash
pip install sql-querify
```
## Usage
```bash
qy
```
## Examples
#### List all tables
```bash
qy "SHOW tables"
```
| table_name |
| ------ |
| dirs |
| files |
| processes |
#### Describe a table
```bash
qy "DESC processes"
```
| field_name | data_type |
| ------ | ------ |
| pid| int |
| name| str|
| cmdline| str|
| status| str|
| username | str |
| cpu_pct | float|
| memory_pct | float |
| create_time| datetime |
#### Count processes by username
```bash
qy "SELECT username, COUNT(1) AS count FROM processes GROUP BY username ORDER BY count DESC"
```
| username | count |
| ------ | ------ |
| user1 |443 |
| root|215 |
#### Top 5 directories by size
```bash
qy "SELECT name, size_in_bytes/1024/1024 AS size_mb FROM dirs ORDER BY size_mb DESC LIMIT 5"
```
| name | size_mb |
| ------ | ------ |
| pydantic_core|4 |
| chardet|1 |
| distlib|1 |
| _vendor/rich/__pycache__ |1 |
| pip/_vendor/chardet|1 |
## Contributing
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.