Skip to main content

A minimal command line application for managing LanceDB databases

Project description

lancedb-cli

A minimal command line application for managing LanceDB databases. This CLI tool provides an easy interface to query, update, and manage data stored in LanceDB.

Features

  • Query Tables: Retrieve data from LanceDB tables with filtering and column selection
  • Interactive Mode: Interactive SQL shell with command history and completion
  • Direct SQL Execution: Run complex SQL queries against LanceDB databases
  • Data Management: Insert, update, delete, and drop records
  • Schema Inspection: View the schema of tables
  • Multiple Output Formats: Display results as formatted tables or JSON
  • Auto-completion: Interactive mode includes SQL keywords and table name completion

Installation

Install the package using pip:

pip install lancedb-cli

Usage

Command Line

List all tables in a database:

lsql list-tables /path/to/database

Query a table:

lsql query /path/to/database my_table --limit 10

View table schema:

lsql schema /path/to/database my_table

Execute SQL query:

lsql sql /path/to/database "SELECT * FROM my_table WHERE id > 5"

Update records:

lsql update /path/to/database my_table \
  --set-clause "name='John',age=30" \
  --where "id=1"

Delete records:

lsql delete /path/to/database my_table --where "id=1"

Empty a table:

lsql empty /path/to/database my_table

Drop a table:

lsql drop /path/to/database my_table --confirm

Interactive Mode

Start an interactive session:

lsql interactive /path/to/database

Inside the interactive shell, you can:

  • Type SQL queries directly
  • Use special commands:
    • .tables - List all tables
    • .schema <table> - Show table schema
    • .refresh - Refresh all table views
    • .update <table> <set> <where> - Update rows
    • .delete <table> <where> - Delete rows
    • .empty <table> - Empty a table
    • .drop <table> - Drop a table
    • .exit - Exit the interactive shell

Query Options

  • --limit N: Limit results to N rows (default: 10)
  • --where <condition>: Filter rows with SQL WHERE clause
  • --select <columns>: Select specific columns (comma-separated)
  • --output <format>: Output format: table (default) or json

Development

To set up a development environment:

git clone https://github.com/yourusername/lancedb-cli.git
cd lancedb-cli
pip install -e ".[dev]"

Run tests:

pytest

Requirements

  • Python 3.8 or higher
  • lancedb
  • duckdb
  • typer
  • rich
  • prompt-toolkit
  • pygments

License

Apache 2.0 - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you encounter any issues or have suggestions, please open an issue on GitHub.

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

lancedb_cli-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lancedb_cli-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file lancedb_cli-0.1.0.tar.gz.

File metadata

  • Download URL: lancedb_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for lancedb_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb7712b73852409774b9c26186764a0b65bc6e070a49fb9ebdb106a45f6b904e
MD5 30e73511421153f823beadfafa94d8b4
BLAKE2b-256 c5b8f1cad73a61381465093a193c2a9dcdf45e431f06298e13f3ecd55b940380

See more details on using hashes here.

File details

Details for the file lancedb_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lancedb_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for lancedb_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57a961d48970a5af997bec7d924230b1c166d9a0a599780bece963e39936fa44
MD5 92e2f747035260f2eaabe79c052e7bd4
BLAKE2b-256 7fecb191e3a0411f8c3984ee271f663d8fe887e1e232691079939d29490e21e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page