Skip to main content

A modern, secure, aesthetic and your ultimate DBMS client. Implemented as a CLI (Command-Line Interface) tool and written 100% in Python

Project description

🐍 PY DBMS

A Modern, Secure, and Blazing Fast MySQL CLI Client for Python

PyPI version Python 3.10+ License


PY DBMS is a modern, developer-focused command-line client constructed entirely in Python. It's built for developers who live in the terminal but want a more structured, responsive, and secure experience than the default MySQL CLI provides.

With built-in secure local user profiles, deep UX polish (think execution spinners and MySQL-like multi-line formatting), and a first-class data export system, PY DBMS stands on its own as a premium database interaction layer.


✨ Features

🛡️ Secure Local Profiles (profile_auth.py)

  • Startup Gate: You must log in via a local profile before PY DBMS spins up a MySQL connection.
  • Argon2 Hashed: Your local password is never stored in plaintext (profile.json relies purely on argon2-cffi hashed payloads).
  • Masked Prompts: pwinput safely hides your credentials as you type.

🎨 Stunning Terminal UX

  • Live Query Spinners: Executing a massive JOIN? A sleek cyan spinner ensures you know the query is actively running in the background.
  • MySQL-Style Query Loops: Type complex multi-line queries with ease natively formatted with -> line breaks.
  • Color-Coded Statuses: All terminal errors log instantly with explicit visual warnings like pydbms warning> or mysql error>.

📤 Native Query Exports

  • Export to .csv or .json instantly by appending --export <format> to any query.
  • Completely crash-safe: Unresolved paths or permission errors fall back to clear UI warnings without dropping your session.
  • Handles massive exports securely.

🛠️ Tiered Configuration

  • Global Config (config.json): Set persistent states mapped cleanly across sessions.
  • Session Config (.session-config): Hot-swap settings that reset the moment you exit.
  • Query Overrides (--expand): On-the-fly execution changes explicitly attached to a single inline SQL execution.

🚀 Installation

Prerequisites

  • Python 3.10+
  • A running MySQL Server

Install via pip

pip install -U py-dbms-cli

💻 Quick Start

1. Launch the Environment

pydbms

2. Authentication

On first launch, you'll be prompted to create a secure, hashed local profile. Next time, just log in!

3. Database Connection

You'll instantly be prompted to input your target MySQL Host, Username, and Password. PY DBMS ensures nothing is logged unencrypted to your disk.

4. Write SQL

Write your standard SQL inside the shell:

pydbms> SELECT * FROM users
    -> WHERE id > 100
    -> LIMIT 50;

📖 Helper Meta Commands

PY DBMS includes an array of . prefixed meta-commands that vastly speed up the database inspection process.

Command Description
.help Show all helper commands
.databases List all databases
.tables List tables in the current database
.schema <table> Show the exact CREATE TABLE definition
.clear Clear the terminal screen
.version Show build and MySQL version information
.config Show persistent UI/Export configurations
.config set <section>.<key> <value> Update a config value globally
.config reset <section>.<key> Reset a config value
.session-config Show session-level settings
.session-config set <key> <value> Update a temporary session setting
.exit Safely terminate the CLI and MySQL connection

⚙️ Query Flags

Attach these raw flags to the very end of any valid SQL query.

Flag Description
--expand Render the result set expanded vertically to bypass hard window truncation overrides.
--export <format> [path] Extract your query locally to csv or json.
--row-limit <N> Limit rows returned for this query (overrides ui.max_rows).
--include-query Embed original SQL query in the exported file (default: off).

Example:

SELECT * FROM access_logs WHERE status=404; --row-limit 100 --export json --include-query

🧪 Developer Testing

PY DBMS strictly utilizes pytest to govern all underlying architecture (Query Execution, Parsing, CSV/JSON Export flows, and Configuration Schemas).

All test pipelines are publicly committed to GitHub to ensure community pull requests maintain absolute stability.

To contribute or run tests locally on your machine:

# 1. Install the CLI with developer testing dependencies attached
pip install -e .[dev]

# 2. Run the test suite natively
pytest tests/

👨‍💻 Author

Anish Sethi
B.Tech Computer Science & Engineering
Delhi Technological University (Class of 2029)
LinkedIn | GitHub


📄 License

This project is officially licensed under the BSD 3-Clause License. See the LICENSE file for details or type .version in the terminal for further context.

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

py_dbms_cli-4.1.0.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

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

py_dbms_cli-4.1.0-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file py_dbms_cli-4.1.0.tar.gz.

File metadata

  • Download URL: py_dbms_cli-4.1.0.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for py_dbms_cli-4.1.0.tar.gz
Algorithm Hash digest
SHA256 3f02d52168474fee4f560d1c441f1432809cbb92c3ffaf89a2e2032b9eb4ad75
MD5 00e156f7a23ef6ca5dfc94d0345eccf6
BLAKE2b-256 c3a598a29c1c62336ad799c0196edc7655a38b7f6b75210febe570f8d2f0a29a

See more details on using hashes here.

File details

Details for the file py_dbms_cli-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: py_dbms_cli-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for py_dbms_cli-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b677a522b9b2ad901b26614654c7752bc4c011048f68b0e491b2bbfdece5c0a
MD5 53eac3e59a658b0f18fce8b9b95f06cf
BLAKE2b-256 6c7d7bcddcc3c23f34a3277ac0bf40bacc67b080fef429972eb84e1d4fdf27c3

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