CLI for SQLite Databases with auto-completion and syntax highlighting

Overview

litecli

Build Status

Docs

A command-line client for SQLite databases that has auto-completion and syntax highlighting.

Completion CompletionGif

Installation

If you already know how to install python packages, then you can install it via pip:

You might need sudo on linux.

$ pip install -U litecli

The package is also available on Arch Linux through AUR in two versions: litecli is based the latest release (git tag) and litecli-git is based on the master branch of the git repo. You can install them manually or with an AUR helper such as yay:

$ yay -S litecli

or

$ yay -S litecli-git

For MacOS users, you can also use Homebrew to install it:

$ brew install litecli

Usage

$ litecli --help

Usage: litecli [OPTIONS] [DATABASE]

Examples:
  - litecli sqlite_db_name

A config file is automatically created at ~/.config/litecli/config at first launch. See the file itself for a description of all available options.

Docs

Visit: litecli.com/features

Comments
  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi dbcli/litecli!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by lgtm-com[bot] 0
  • “python_requires” should be set with “>=3.6”, as litecli 1.9.0 is not compatible with all Python versions

    “python_requires” should be set with “>=3.6”, as litecli 1.9.0 is not compatible with all Python versions

    Currently, the keyword argument python_requires of setup() is not set, and thus it is assumed that this distribution is compatible with all Python versions. However, I found it is not compatible with Python<3.6. My local Python version is 3.5, and I encounter the following error when executing “pip install litecli==1.9.0”

    Collecting litecli==1.9.0
      Downloading litecli-1.9.0-py2.py3-none-any.whl (47 kB)
         |████████████████████████████████| 47 kB 415 kB/s 
    Collecting Pygments>=1.6
      Downloading Pygments-2.11.2-py3-none-any.whl (1.1 MB)
         |████████████████████████████████| 1.1 MB 639 kB/s 
    Collecting click>=4.1
      Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
         |████████████████████████████████| 82 kB 417 kB/s 
    ERROR: Could not find a version that satisfies the requirement prompt-toolkit<4.0.0,>=3.0.3 (from litecli==1.9.0) (from versions: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.25, 0.26, 0.28, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.0.13, 1.0.14, 1.0.15, 1.0.16, 1.0.17, 1.0.18, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10)
    ERROR: No matching distribution found for prompt-toolkit<4.0.0,>=3.0.3 (from litecli==1.9.0)
    
    

    Dependencies of this distribution are listed as follows:

        "click >= 4.1",
        "Pygments>=1.6",
        "prompt_toolkit>=3.0.3,<4.0.0",
        "sqlparse",
        "configobj >= 5.0.5",
        "cli_helpers[styles] >= 2.2.1",
    

    I found that prompt_toolkit>=3.0.3,<4.0.0 requires Python>=3.6.2, which results in installation failure of litecli in Python3.5.

    Way to fix: modify setup() in setup.py, add python_requires keyword argument:

    setup(…
         python_requires='>=3.6.2'
         …)
    

    Thanks for your attention. Best regrads, PyVCEchecker

    opened by PyVCEchecker 0
  • .schema: line breaks and missing index information

    .schema: line breaks and missing index information

    sqlite:

    → sqlite3 imdb-cmudb2022.db
    SQLite version 3.37.2 2022-01-06 13:25:41
    Enter ".help" for usage hints.
    sqlite> .schema people
    CREATE TABLE people (
      person_id VARCHAR PRIMARY KEY,
      name VARCHAR,
      born INTEGER,
      died INTEGER
    );
    CREATE INDEX ix_people_name ON people (name);
    sqlite>
    

    litecli:

    → litecli imdb-cmudb2022.db
    Version: 1.9.0
    Mail: https://groups.google.com/forum/#!forum/litecli-users
    GitHub: https://github.com/dbcli/litecli
    imdb-cmudb2022.db> .schema people
    +--------------------------------------------------------------------------------------------------------------+
    | sql                                                                                                          |
    +--------------------------------------------------------------------------------------------------------------+
    | CREATE TABLE people (\n  person_id VARCHAR PRIMARY KEY,\n  name VARCHAR,\n  born INTEGER,\n  died INTEGER\n) |
    +--------------------------------------------------------------------------------------------------------------+
    Time: 0.012s
    imdb-cmudb2022.db>
    
    opened by balta2ar 0
  • When using .once -o, only last line remains

    When using .once -o, only last line remains

    When using .once -o ..., only the last line of the next output remains in the file once that command has completed.

    That's because the write_once() function is executed for each individual output line, and each time the output file is opened with a new open(**once_file) call. Because the -o sets the file mode to "w", the output file is truncated for each line, and so all preceding output is lost.

    Either the write_once() should execute once_file["mode"] = "a" so further lines are appended instead of replacing the file, or the code should be refactored to work like the tee() command and keep a reference to the opened file for re-use until unset_once_if_written() is called (which would then close the file). With that second option, you could then also drop the written_to_once_file flag variable, because the opened file object would only exist if there had been output to write.

    opened by mjpieters 1
  • Support `.eqp` like in sqlite3

    Support `.eqp` like in sqlite3

    There is an awesome .eqp on command in the default sqlite3 shell. It works like this:

    sqlite> .eqp on
    sqlite> select distinct book.id, (select coalesce(json_group_array(json_array(v0, v1, v2, v3, v4, v5, v6, v7)), json_array()) from (select b.id as v0, b.path as v1, b.name as v2, b.date as v3, b.added as v4, b.sequence as v5, b.sequence_number as v6, b.lang as v7 from book as b where b.id = book.id) as t) as book, (select coalesce(json_group_array(json_array(v0, v1, v2, v3, v4, v5, v6)), json_array()) from (select distinct author.id as v0, author.fb2id as v1, author.first_name as v2, author.middle_name as v3, author.last_name as v4, author.nickname as v5, author.added as v6 from author join book_author on book_author.author_id = author.id where book_author.book_id = book.id) as t) as authors, (select coalesce(json_group_array(json_array(v0)), json_array()) from (select distinct genre.name as v0 from genre join book_genre on book_genre.genre_id = genre.id where book_genre.book_id = book.id) as t) as genres from book join book_author on book_author.book_id = book.id where (book.sequence = 'Звёздные войны' and book_author.author_id = 45826) order by book.sequence_number asc nulls last, book.name
       ...> ;
    QUERY PLAN
    |--SEARCH book_author USING INDEX book_author_author_id (author_id=?)
    |--SEARCH book USING INTEGER PRIMARY KEY (rowid=?)
    |--CORRELATED SCALAR SUBQUERY 2
    |  `--SEARCH b USING INTEGER PRIMARY KEY (rowid=?)
    |--CORRELATED SCALAR SUBQUERY 4
    |  |--CO-ROUTINE t
    |  |  |--SEARCH book_author USING COVERING INDEX sqlite_autoindex_book_author_1 (book_id=?)
    |  |  |--SEARCH author USING INTEGER PRIMARY KEY (rowid=?)
    |  |  `--USE TEMP B-TREE FOR DISTINCT
    |  `--SCAN t
    |--CORRELATED SCALAR SUBQUERY 6
    |  |--CO-ROUTINE t
    |  |  |--SEARCH book_genre USING COVERING INDEX sqlite_autoindex_book_genre_1 (book_id=?)
    |  |  |--SEARCH genre USING INTEGER PRIMARY KEY (rowid=?)
    |  |  `--USE TEMP B-TREE FOR DISTINCT
    |  `--SCAN t
    |--USE TEMP B-TREE FOR DISTINCT
    `--USE TEMP B-TREE FOR ORDER BY
    122718|[[122718,"/media/sda3/Books/native/439383.fb2","Заря джедаев: В пустоту","","2022-06-19 23:10:14.992363471","Звёздные войны",1,"ru"]]|[[45826,null,"Тим",null,"Леббон",null,"2022-06-19 20:51:32.016737954"]]|[["sf_space"]]
    264789|[[264789,"/media/sda3/Books/native/577219.fb2","Заря джедаев: В бесконечность","","2022-06-20 09:48:50.7587699","Звёздные войны",null,"ru"]]|[[45826,null,"Тим",null,"Леббон",null,"2022-06-19 20:51:32.016737954"]]|[["sf_space"]]
    173283|[[173283,"/media/sda3/Books/native/439488.fb2","Заря джедаев: В пустоту","","2022-06-20 03:09:41.412632853","Звёздные войны",null,"ru"]]|[[45826,null,"Тим",null,"Леббон",null,"2022-06-19 20:51:32.016737954"]]|[["sf_space"]]
    

    As you can see it outputs the execution plan tree on each request. Would be nice to support it in litecli too

    opened by asm0dey 3
Owner
dbcli
Better CLIs for Databases
dbcli
Postgres CLI with autocompletion and syntax highlighting

A REPL for Postgres This is a postgres client that does auto-completion and syntax highlighting. Home Page: http://pgcli.com MySQL Equivalent: http://

dbcli 10.8k Jan 2, 2023
Python CLI utility and library for manipulating SQLite databases

sqlite-utils Python CLI utility and library for manipulating SQLite databases. Some feature highlights Pipe JSON (or CSV or TSV) directly into a new S

Simon Willison 1.1k Jan 4, 2023
Interactive Redis: A Terminal Client for Redis with AutoCompletion and Syntax Highlighting.

Interactive Redis: A Cli for Redis with AutoCompletion and Syntax Highlighting. IRedis is a terminal client for redis with auto-completion and syntax

null 2.2k Dec 29, 2022
A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.

mycli A command line client for MySQL that can do auto-completion and syntax highlighting. HomePage: http://mycli.net Documentation: http://mycli.net/

dbcli 10.7k Jan 7, 2023
Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.

i love my dog 2.8k Jan 5, 2023
Python Library and CLI for exporting MySQL databases

expdb Python library and CLI for exporting MySQL databases Installation Pre-requisites MySQL server Python 3.9+ Using git Clone the repository to your

Devansh Singh 1 Nov 29, 2021
Pymongo based CLI client, to run operation on existing databases and collections

Mongodb-Operations-Console Pymongo based CLI client, to run operation on existing databases and collections Program developed by Gustavo Wydler Azuaga

Gus 1 Dec 1, 2021
Simple CLI for managing Postgres databases in Flask.

Overview Simple CLI that provides the following commands: flask psql create flask psql init flask psql drop flask psql setup: create → init flask psql

Daniel Reeves 21 Oct 3, 2022
Notion-cli-list-manager - A simple command-line tool for managing Notion databases

A simple command-line tool for managing Notion List databases. ✨

Giacomo Salici 75 Dec 4, 2022
🦎 A NeoVim plugin for highlighting visual selections like in a normal document editor!

?? HighStr.nvim A NeoVim plugin for highlighting visual selections like in a normal document editor! Demo TL;DR HighStr.nvim is a NeoVim plugin writte

Pocco81 222 Jan 3, 2023
Sink is a CLI tool that allows users to synchronize their local folders to their Google Drives. It is similar to the Git CLI and allows fast and reliable syncs with the drive.

Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git C

Yash Thakre 16 May 29, 2022
A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool

Privateer A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool How

Shreyash Chavan 2 Apr 4, 2022
[WIP]An ani-cli like cli tool for movies and webseries

mov-cli A cli to browse and watch movies. Installation This project is a work in progress. However, you can try it out python git clone https://github

null 166 Dec 30, 2022
gget is a free and open-source command-line tool and Python package that enables efficient querying of genomic databases.

gget is a free and open-source command-line tool and Python package that enables efficient querying of genomic databases. gget consists of a collection of separate but interoperable modules, each designed to facilitate one type of database querying in a single line of code.

Pachter Lab 570 Dec 29, 2022
flora-dev-cli (fd-cli) is command line interface software to interact with flora blockchain.

Install git clone https://github.com/Flora-Network/fd-cli.git cd fd-cli python3 -m venv venv source venv/bin/activate pip install -e . --extra-index-u

null 14 Sep 11, 2022
AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

Rafael Torres 2 Dec 10, 2021
Python-Stock-Info-CLI: Get stock info through CLI by passing stock ticker.

Python-Stock-Info-CLI Get stock info through CLI by passing stock ticker. Installation Use the following command to install the required modules at on

Ayush Soni 1 Nov 5, 2021
Yts-cli-streamer - A CLI movie streaming client which works on yts.mx API written in python

YTSP It is a CLI movie streaming client which works on yts.mx API written in pyt

null 1 Feb 5, 2022