sqlcli

A command line interface (CLI) for interacting with SQLModel.


Keywords
sql, cli, typer, python, sqlmodel, rich, sqlalchemy
License
MIT
Install
pip install sqlcli==0.1.0

Documentation

sqlcli

PyPI version PyPI - Downloads

A command line interface (CLI) for interacting with SQLModel.


Source code: https://github.com/SamEdwardes/sqlcli

Docs: https://samedwardes.github.io/sqlcli/

PyPi: https://pypi.org/project/sqlcli/


Features

The key features are:

  • Read data using the sqlcli select command.
  • Insert data using the sqlcli insert command.
  • Interactive console powered by typer, rich, and sqlmodel.
  • Pretty terminal outputs generated by rich.
  • Multiple output formats including rich, json, and python dictionaries.

Installation

You can install sqlcli using pip:

pip install sqlcli

This will make the sqlcli command available in your python environment.

Usage

The quickest way to get started with sqlcli is to create a demo sqlite database:

sqlcli init-demo

This will create a small sqlite database on your computer. The you can use sqlcli to explore your database. View your table by using the select command.

sqlcli select athlete -d "sqlite:///sqlcli_demo/database.db" -m "sqlcli_demo/models.py"
โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ id โ”ƒ name     โ”ƒ sport_id โ”ƒ
โ”กโ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ 1  โ”‚ Ronaldo  โ”‚ 1        โ”‚
โ”‚ 2  โ”‚ Messi    โ”‚ 1        โ”‚
โ”‚ 3  โ”‚ Beckham  โ”‚ 1        โ”‚
โ”‚ 4  โ”‚ Gretzky  โ”‚ 2        โ”‚
โ”‚ 5  โ”‚ Crosby   โ”‚ 2        โ”‚
โ”‚ 6  โ”‚ Ovechkin โ”‚ 2        โ”‚
โ”‚ 7  โ”‚ Sundin   โ”‚ 2        โ”‚
โ”‚ 8  โ”‚ Domi     โ”‚ 2        โ”‚
โ”‚ 9  โ”‚ Carter   โ”‚ 1        โ”‚
โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜