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 MySQL CLI Client

Experimental Release — v4.0.0

PY DBMS is a modern, developer-focused command-line client for MySQL, built with Python.
It provides a clean terminal UI, readable query output, powerful helper commands, and a robust export system—without sacrificing safety, clarity, or control.

Designed for developers who live in the terminal but want a more structured, reliable experience than the default MySQL CLI.


Key Features

🏗️ Modular Architecture

  • Decoupled DB Connector Layer: Connection logic is separated from the CLI UX core to prepare for multi-engine support (PostgreSQL, SQLite, etc.).
  • Clean Result Abstraction: Query execution, rendering, and export are kept modular and easy to extend.

👤 Local Profile Login (New in v4.0.0)

  • Startup Authentication Gate: PY DBMS requires local login before starting the MySQL session.
  • Profile Stored Locally (profile.json)
    • Username stored as plain text
    • Password stored as Argon2 hash (never stored in plaintext)
  • Secure Input: Password entry is masked using pwinput.
  • First Run Friendly:
    • If no user exists, PY DBMS prompts to create a profile first.
    • If profile exists, user can choose:
      • Login
      • Create new user

📤 Query Export System (Stable)

  • Pluggable Export Manager: Centralized export handling with strict validation and predictable UX.
  • CSV & JSON Support: Export query results directly to .csv or .json.
  • Safe by Design: Export failures (invalid format, empty result, I/O issues) never terminate the session.
  • Persistent Default Export Path (export.path):
    • Default export directory is created automatically.
    • Can be modified using .config set export.path ....
    • Can be reset to default using .config reset export.path.
  • Space-Safe Paths: Quoted file paths with spaces are fully supported.
  • Bounded Result Rendering: Large result-sets do not crash the CLI and do not leave unread cursor data.

Note: --export always requires a format explicitly (csv or json).

📊 Query Output Control

  • --expand Flag: Expand query results inline to prevent column truncation.
  • Precedence-Aware Design:
    • Query-level --expand overrides session configuration
    • Session configuration defines default behavior
  • Composable Flags: --expand and --export work together in a single query.

Terminal UX

  • Rich Interface: Structured tables and panels for high readability.
  • Visual Feedback: Color-coded status messages for success, warnings, and SQL errors.
  • Startup Dashboard: ASCII banner and session summary on launch.

Configuration & Control

  • Persistent Config (config.json): Stored in an OS-appropriate runtime directory.
  • Session Config Layer: Runtime-only overrides that reset on every launch.
  • Inline Query Flags: Per-query behavior customization without mutating configuration.

Security

  • Masked Credentials: MySQL password input is always masked.
  • Local Profile Protection: Profile password is Argon2-hashed.
  • Zero Credential Persistence: MySQL credentials are never stored on disk.

Installation

Prerequisites

  • Python 3.10+
  • A running MySQL Server

Install via pip

pip install py-dbms-cli

Usage

1. Run from terminal

pydbms

2. Local login/signup

  • If a profile exists, choose:
    1. Login to existing user
    2. Create a new user
  • If no user exists, you will be prompted to create one.

3. MySQL Connection

You will be prompted for:

  • Host
  • Username
  • Password (masked)

4. Begin querying

Enter SQL commands as you normally would.
Multi-line queries are supported and executed once terminated with ;.


Meta Commands

PY DBMS includes several helper commands for interactive usage:

Command Description
.help Show all helper commands
.databases List all databases
.tables List tables in the current database
.schema <table> Show CREATE TABLE definition
.clear Clear the terminal screen
.version Show build and version information
.config Show persistent configuration
.config set <section>.<key> <value> Update a config value
.config reset <section>.<key> Reset a config value
.session-config Show session-level configuration
.session-config set <key> <value> Update session-only settings
.session-config reset <key> <value> Reset a session setting
.exit Exit the CLI

Query Flags

Flag Description
--expand Expand query output to avoid truncation (overrides session-config)
--export <format> [path] Export query results (csv or json)

✅ Supported export formats as of v4.0.0: {csv, json}
--export without a format is invalid.


Roadmap

Planned future improvements include:

  • Engine Selection System (.use mysql etc.) (planned for v4.1.0 stable)
  • Multi-Engine Support (PostgreSQL / SQLite)
  • Saved Engine Connections under pydbms profile system (v5.x foundation)
  • Query History (persistent command history)
  • Additional export formats

Author

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


License

This project is licensed under the BSD 3-Clause License.
Visit the BSD 3-Clause License page for more information.

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.0.10005.tar.gz (18.7 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.0.10005-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_dbms_cli-4.0.10005.tar.gz
  • Upload date:
  • Size: 18.7 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.0.10005.tar.gz
Algorithm Hash digest
SHA256 4bcd0d527dcb2de93359d5767ead0d7ee4bf1d23ff15799f360562bee185fb1d
MD5 575ae382de9088d31c9c456354fda911
BLAKE2b-256 7473fce64b4692b1f848d12e91d78a3eaa74c90b0d3f971a80c5410a0bd2f29a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_dbms_cli-4.0.10005-py3-none-any.whl
Algorithm Hash digest
SHA256 b25f0d79535a9ec5f1e58a4720feb0cdb6dece9286d74c6a4344094ca0f8e873
MD5 f119705f38b8f0c80929462ca7bf726d
BLAKE2b-256 74d7de5c80c81c28af56fd3aa9ec84f58f50b90440be6529c60e7e380a89de9f

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