Skip to main content

🐍 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.

Metadata

Release files for py-dbms-cli 4.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-dbms-cli 4.1.0
File Size Uploaded
py_dbms_cli-4.1.0.tar.gz 25.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-dbms-cli 4.1.0
File Interpreter ABI Platform
py_dbms_cli-4.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.3 kB

Release files / py_dbms_cli-4.1.0.tar.gz

Download URL py_dbms_cli-4.1.0.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3f02d52168474fee4f560d1c441f1432809cbb92c3ffaf89a2e2032b9eb4ad75
BLAKE2b-256 checksum
How to use checksums
c3a598a29c1c62336ad799c0196edc7655a38b7f6b75210febe570f8d2f0a29a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / py_dbms_cli-4.1.0-py3-none-any.whl

Download URL py_dbms_cli-4.1.0-py3-none-any.whl
Size 30.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b677a522b9b2ad901b26614654c7752bc4c011048f68b0e491b2bbfdece5c0a
BLAKE2b-256 checksum
How to use checksums
6c7d7bcddcc3c23f34a3277ac0bf40bacc67b080fef429972eb84e1d4fdf27c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 release files

4.0.1

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.0.6

2 release files

3.0.5

1 release file

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.5.0

2 release files

2.1.5

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

3 release files

2.0

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page