Skip to main content

basedb

PyPI version License: GPL v3 Docs

basedb is a thin, pure-Python abstraction layer over MariaDB/MySQL. It provides Column, Row, Table, and Database base classes that handle DDL generation, value marshalling, and connection management — without hiding the SQL.

Installation

pip install basedb

Quick Start

Subclass Row to define your schema, then subclass Table to wrap it:

from basedb.database import Database
from basedb.row import Row
from basedb.table import Table

class MyRow(Row):
    def get_col_def(self):
        defs = [
            {'name': 'id',    'type': int, 'length': 4,  'primary': True,
             'autoincrement': True},
            {'name': 'label', 'type': str, 'length': 64, 'notNull': True},
            {'name': 'value', 'type': float},
        ]
        cols, _ = self.define_cols(defs)
        return cols

class MyTable(Table):
    def __init__(self, db):
        self.row = MyRow()
        super().__init__(db, 'my_table', columns=self.row.get_col_def())
        self.row = MyRow()

db = Database(host='localhost', user='dqr', password='s3cr3t', database='mydb')

t = MyTable(db)
t.create(ifnotexists=True)

row = MyRow()
row.set({'label': 'alpha', 'value': 3.14})
t.insert(row)
db.commit()

results = t.select(where='label = "alpha"')
print(results[0]['value'])   # → 3.14

db.close()

Documentation

Full documentation — including a column type reference and a detailed subclassing guide — is available at:

https://dqr-builder.docs.ligo.org/dqr_basedb/

License

basedb is distributed under the GNU General Public License v3 or later.

Metadata

Release files for basedb 0.2.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 basedb 0.2.0
File Size Uploaded Provenance Actions
basedb-0.2.0.tar.gz 31.2 kB Without provenance Details for basedb-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for basedb 0.2.0
File Interpreter ABI Platform Actions
basedb-0.2.0-py3-none-any.whl Python 3 none any Details for basedb-0.2.0-py3-none-any.whl

Total release size: 66.8 kB

Release files / basedb-0.2.0.tar.gz

Download URL basedb-0.2.0.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b30fe1a3517d3175443b6f30cdfe9f8cba700c0e1b1e2885a13761b4c4b50f3f
BLAKE2b-256 checksum
How to use checksums
4b68079a3805f02bdcfaac6a7e6eeac99d88bc72f1de856ec7085a34545acb0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Release files / basedb-0.2.0-py3-none-any.whl

Download URL basedb-0.2.0-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81bf379313c626f3ff405612f7fa94922a5de7d396d602878944b8144c391d99
BLAKE2b-256 checksum
How to use checksums
ec74f4b202df5da9c4c04a04d00a636e11ae44df6a5c63707ff9877e76faa992
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Security for basedb 0.2.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

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