Skip to main content

easy to set up alternative to SQl, bugs and leak proof by design and also support multiple console interactions

Project description

A data cleaning and quality solution for messy data, bug prevention, and leakage control.

Ideal for structured data storage where full database integration is overkill. Uses simple 1D/2D list logic with built-in validation, file management, backup and snapshot support. Dependency-free, designed by a Data Analyst/Engineer.


🚀 Features

  • ✅ Safe read/write with structure validation (1D & 2D lists).
  • ➕ Append support with consistency checks.
  • ❌ Granular delete with filters (cutoff, keep, reverse, size).
  • 💾 Backup and 📸 Snapshot support.
  • 🧹 Debug and auto-clean corrupted files.
  • 📚 Built-in mini-guide.
  • 🎗️ Supports Multiple Console usage.
  • 🗂️ Clean folder/files organization.
  • 💪 Strong anti-corruption and Tamper mechanism.

Why Use This Package?

For Data Professionals (Analysts, Scientists, Engineers):

  • Build quick dashboards and visualizations from real-time text data.
  • Process and clean scraped or pipeline data without needing a database.
  • Track, audit, and version small datasets during experimentation.
  • Validate incoming data and auto-correct format issues on the fly (clean from the source).
  • Run fast, repeatable data operations locally without SQL overhead.

For General Developers:

  • Great for automation scripts, bots, or microservices.
  • Ideal for prototyping features without setting up a database.
  • Use as a flat-file backend for small apps or CLI tools.
  • Snapshot and backup data safely without extra libraries.
  • Handle concurrent access and reduce race-condition bugs automatically.

📦 Core Functions

w(txt_name: str, write_list: list) -> None

Write (or reset) the contents of a file, validating structure before saving to all backup locations.

r(txt_name: str, set_new: list | None = [], notify_new: bool = True) -> list | None

Read file contents. If the file is missing, return set_new and optionally notify user of new file creation.

a(txt_name: str, append_list: list) -> list

Append new rows to an existing file after validating structure. Returns the updated list.

d(txt_name: str, ...) -> tuple[int, list]

Delete matching rows with flexible options:

  • del_list: values to delete
  • index: column index for 2D deletion
  • cutoff: max deletions per value
  • keep: retain only N per value
  • reverse: delete from end
  • size: trim to max N items

backup(txt_name: str, display=True)

Create a manual backup of a file or all (txt_name="*").

snapshot(txt_name: str, unit, gap, begin=0, display=True)

Take time-based snapshots if eligible. Supports:

  • unit: 'minute', 'hour', 'day', 'month', etc.
  • gap: how much time must pass
  • begin: used for daily-based triggers

debug(txt_name, is_2D=None, clean=None, length=None, display=True)

Scan and optionally auto-clean a file that fails validation. Great for corrupted data recovery.

help()

Opens the interactive mini-guide documentation tool.


📁 File Organization

Each file is saved as a .txt in a structured folder. All backups and snapshots are handled automatically.

Other folders:

  • Backup 💾/ – Manual backups
  • Snapshot 📸/ – A timed backup

Validation files:

  • *_validation.txt – Schema registry per file

Absolutely! Here's a single-copy version of the usage guide, rewritten to make it easier for people who may not understand what a "2D list" means. Instead, we explain using examples like a table with headers (e.g. name, sex, age) and rows of data.


📦 Installation – MaxCleanerDB

pip install MaxCleanerDB

♻️ Upgrade

pip install --upgrade MaxCleanerDB


Usage Examples

**import MaxCleanerDB or import MaxCleanerDB as mdb

Write (w): Overwrite data

  • Stores a simple (1D) list of student names:
    w("students", ["Alice", "Bob"])

  • Stores a 2D list (like a table of people):
    Think of it like this:
    Headers = [name, sex, age]
    Rows = ["Eve", "female", 25], ["Adam", "male", 30]
    w("people", [["Eve", "female", 25], ["Adam", "male", 30]])


Read (r): Read data or set default if missing

  • r("students") Reads the data from the "students" file.

  • r("new_file", [], notify_new=True) If "new_file" doesn’t exist, it creates one with an empty list and optionally shows a notification.


Append (a): Add new entries

  • a("students", ["Charlie"]) Adds "Charlie" to the list of students.

  • a("people", [["Lucy", "female", 22], ["Mark", "male", 27]]) Adds new rows to the "people" table.


Delete (d): Remove entries with different options

For simple lists (like names):

  • d("students", ["Bob"]) Deletes "Bob" from the student list.

  • d("students", ["Bob", "Charlie"]) Deletes both "Bob" and "Charlie" if found.

For tables (like people list with name, sex, age):

  • d("people", ["Eve"], index=0) Deletes rows where name is "Eve" (index 0 means the name column).

  • d("people", ["female"], index=1, cutoff=1) Deletes only the first row where sex is "female".

  • d("people", ["female"], index=1, keep=1) Keeps only one row with sex as "female", deletes any others.

  • d("people", size=2) Keeps only the last 2 entries in the list.

  • d("people", ["Lucy"], index=0, reverse=True) Deletes rows with name "Lucy", starting from the bottom.

Using multiple column conditions (like WHERE in SQL):

  • d("people", [["Adam", "male"]], index=[0, 1]) Deletes the row where name is "Adam" AND sex is "male".

  • d("people", [["Eve", "female", 25]], index="*") Deletes the exact row ["Eve", "female", 25].

  • d("people", [["Adam", 30], ["Mark", 27]], index=[0, 2]) Deletes rows where (name is "Adam" AND age is 30) OR (name is "Mark" AND age is 27)


Backup and Snapshot

  • backup("students") Makes a backup copy of the "students" file.

  • backup("*") Backs up all files.

  • snapshot("students", "day", 1) Takes a snapshot once a day if the last one was over a day ago.

  • snapshot("*", "hour", 6) Snapshots all files every 6 hours if enough time has passed.


Debugging

  • debug("students", is_2D=False, clean=True) Checks and cleans up simple list data in "students".

  • debug("people", is_2D=True, length=3) Checks if each row in "people" has 3 columns (name, sex, age).


Help

  • help() Shows this usage guide.

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

maxcleanerdb-3.0.8.2.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

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

maxcleanerdb-3.0.8.2-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file maxcleanerdb-3.0.8.2.tar.gz.

File metadata

  • Download URL: maxcleanerdb-3.0.8.2.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for maxcleanerdb-3.0.8.2.tar.gz
Algorithm Hash digest
SHA256 ab86116ae3248dbfd4543c1a7fc8b7fc23f5db38d186ba4fef71760b14504133
MD5 cb6ddabb67c3ed05f3a0d528f3a21294
BLAKE2b-256 f5ad85fd0c950248dcc4f4d382535648256b1a43d90a23e0eadc868a0d8d2d15

See more details on using hashes here.

File details

Details for the file maxcleanerdb-3.0.8.2-py3-none-any.whl.

File metadata

  • Download URL: maxcleanerdb-3.0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for maxcleanerdb-3.0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e2187dc49d38f5f020dc39d724f74f4ba46f4c700a59b190d75a747b2df68f01
MD5 26779120a239619c4e5e3e8616f741e0
BLAKE2b-256 4413e91e23ec76b8fddff5526070847a81013dcc4d32392d29f79bd2a8e66214

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