Skip to main content

MaazDB-Py 🐍

The Official Python Driver for MaazDB

License: MIT Python Security Website

maazdb-py is a pure-Python client library for interacting with the MaazDB engine. It implements the custom MaazDB binary protocol over a secure TLS 1.3 socket, allowing Python applications to communicate with your database safely and efficiently.


✨ Features

  • Secure by Default: Automatic TLS 1.3 encryption for all communications.
  • Pure Python: No heavy C-extensions; easy to install and cross-platform.
  • Context Manager Support: Use with statements for safe connection handling.
  • Binary Protocol: Optimized communication using the MaazDB Binary Protocol v1.
  • Lightweight: Minimal dependencies.

📦 Installation

From PyPI

pip install maazdb-py

From Source

git clone https://github.com/42Wor/maazdb-py.git
cd maazdb-py
pip install .

🛠 Quick Start

Basic Usage

from maazdb import MaazDB

# 1. Initialize the client
db = MaazDB()

try:
    # 2. Connect securely
    db.connect(host="127.0.0.1", port=8888, user="admin", password="password")
    print("✓ Connected to MaazDB")

    # 3. Execute SQL
    db.query("CREATE DATABASE analytics;")
    db.query("USE analytics;")
    db.query("CREATE TABLE logs (id SERIAL PRIMARY KEY, message TEXT);")
    
    # 4. Insert and Fetch
    db.query("INSERT INTO logs (message) VALUES ('System started');")
    results = db.query("SELECT * FROM logs;")
    print(f"Results:\n{results}")

except Exception as e:
    print(f"An error occurred: {e}")

finally:
    # 5. Always close the connection
    db.close()

The driver supports the with statement, which automatically closes the connection even if an error occurs.

from maazdb import MaazDB

with MaazDB() as db:
    db.connect("127.0.0.1", 8888, "admin", "password")
    result = db.query("SELECT count(*) FROM users;")
    print(f"Total users: {result}")

📋 API Reference

MaazDB()

The main class to interact with the database.

  • .connect(host, port, user, password): Establishes a TLS 1.3 connection and performs the handshake.
  • .query(sql_string): Sends a SQL query to the server and returns the result as a string.
  • .close(): Safely closes the socket connection.

🔐 Security & Protocol

The driver communicates using the MaazDB Binary Protocol v1. All data is packed as Big Endian (>I).

Step Type Description
Handshake 0x10 [Type] [Len] [User\0Pass\0Signature]
Query 0x20 [Type] [Len] [SQL String]
Success 0x02 [Type] [Len] [Result Data]
Error 0x03 [Type] [Len] [Error Message]

👩‍💻 Development & Contributing

If you are interested in contributing to the driver or building from source, please refer to the DEVELOPER.md file for:

  • Project structure
  • Setting up a development environment
  • Building and publishing to PyPI

📄 License

Distributed under the MIT License. See LICENSE for more information.


Created for the MaazDB Ecosystem.

Metadata

Release files for maazdb-py 1.0.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 maazdb-py 1.0.0
File Size Uploaded Provenance Actions
maazdb_py-1.0.0.tar.gz 6.1 kB Without provenance Details for maazdb_py-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maazdb-py 1.0.0
File Interpreter ABI Platform Actions
maazdb_py-1.0.0-py3-none-any.whl Python 3 none any Details for maazdb_py-1.0.0-py3-none-any.whl

Total release size: 11.9 kB

Release files / maazdb_py-1.0.0.tar.gz

Download URL maazdb_py-1.0.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a5b353942c926edc4b0985929b167107930ba7e0e8a316ea47068a811f2b1f50
BLAKE2b-256 checksum
How to use checksums
340153540c70de177219dbfa68c7f59888aebcb400bb38dcf6443e1eedc41c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / maazdb_py-1.0.0-py3-none-any.whl

Download URL maazdb_py-1.0.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1535994ce5266b01a762d270b7bea852dab211951625027acf85c61d59d8b00b
BLAKE2b-256 checksum
How to use checksums
e3eff91fd30e5ac57f0b5875a11e9c001b297fd2030f2d3d665c1dd84a86642f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for maazdb-py 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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