Skip to main content

MariaDB backend implementation for rhosocial-activerecord, providing a robust and optimized MariaDB database support.

Project description

rhosocial ActiveRecord MariaDB Backend

PyPI version Python Tests Coverage Status License Powered by vistart

rhosocial ActiveRecord Logo

MariaDB backend implementation for rhosocial-activerecord, providing a robust and optimized MariaDB database support.

Overview

This package provides MariaDB backend support for the rhosocial-activerecord ORM framework. It enables seamless integration with MariaDB databases while leveraging all the features of the ActiveRecord pattern implementation.

Features

This project is still under development and features are subject to change. Please stay tuned for the latest changes.

  • 🚀 Optimized MariaDB-specific query generation
  • 🔒 Full support for MariaDB's unique features
  • 📦 Connection pooling support (optional)
  • 🔄 Comprehensive transaction management
  • 🔍 Advanced query capabilities specific to MariaDB
  • 🔌 Simple configuration and setup

Requirements

  • Python 3.8+
  • rhosocial-activerecord 1.0.0+
  • mariadb 1.1.0+

Installation

# Basic installation
pip install rhosocial-activerecord-mariadb

# With connection pooling support
pip install rhosocial-activerecord-mariadb[pooling]

# With development tools
pip install rhosocial-activerecord-mariadb[dev]

Usage

from rhosocial.activerecord import ActiveRecord
from rhosocial.activerecord.backend.impl.mariadb.backend import MariaDBBackend
from rhosocial.activerecord.backend.typing import ConnectionConfig
from datetime import datetime
from typing import Optional

class User(ActiveRecord):
    __table_name__ = 'users'
    
    id: int
    name: str
    email: str
    created_at: datetime
    deleted_at: Optional[datetime] = None

# Configure with MariaDB backend
User.configure(
    ConnectionConfig(
        host='localhost',
        port=3306,
        database='myapp',
        user='dbuser',
        password='dbpassword'
    ),
    backend_class=MariaDBBackend
)

# Create a table (if not exists)
User.create_table_if_not_exists()

# Create a new user
user = User(name='John Doe', email='john@example.com', created_at=datetime.now())
user.save()

# Query users
active_users = User.query() \
    .where('deleted_at IS NULL') \
    .order_by('created_at DESC') \
    .all()

# Update user
user.name = 'Jane Doe'
user.save()

# Delete user (soft delete if implemented)
user.delete()

Advanced MariaDB Features

This backend supports MariaDB-specific features and optimizations:

# Using MariaDB fulltext search
results = User.query() \
    .where('MATCH(name, email) AGAINST(? IN BOOLEAN MODE)', ('+John -Doe', )) \
    .all()

# Using MariaDB JSON operations
results = User.query() \
    .where('JSON_EXTRACT(settings, "$.notifications") = ?', ('enabled', )) \
    .all()

# Batch insert with ON DUPLICATE KEY UPDATE
User.batch_insert_or_update([user1, user2, user3])

Documentation

Complete documentation is available at python-activerecord MariaDB Backend

Contributing

We welcome and value all forms of contributions! For details on how to contribute, please see our Contributing Guide.

License

license

Copyright © 2025 vistart

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

rhosocial_activerecord_mariadb-1.0.0.dev1.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file rhosocial_activerecord_mariadb-1.0.0.dev1.tar.gz.

File metadata

File hashes

Hashes for rhosocial_activerecord_mariadb-1.0.0.dev1.tar.gz
Algorithm Hash digest
SHA256 29c5490367e8d3c104cc29824ab1f5aad57a763968171ef5a51c9db3850703bf
MD5 14f65e338e60c5357c9a9fda0097d695
BLAKE2b-256 5c8ce3ee9861538ec12f8e8da33862065f38fc929eec8c0ff081a183a548ea2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rhosocial_activerecord_mariadb-1.0.0.dev1.tar.gz:

Publisher: publish.yml on rhosocial/python-activerecord-mariadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rhosocial_activerecord_mariadb-1.0.0.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for rhosocial_activerecord_mariadb-1.0.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9bba5186a88f34f04038f55590e9875e0dba74bc4e3b9f032aa1db989ec3f7f
MD5 1d957acc78bf544f6fc325374e0771be
BLAKE2b-256 683c227b6c4f9bee2dd6a8a5520b8b91228d3ec41a811324ff6b66c0dfc12895

See more details on using hashes here.

Provenance

The following attestation bundles were made for rhosocial_activerecord_mariadb-1.0.0.dev1-py3-none-any.whl:

Publisher: publish.yml on rhosocial/python-activerecord-mariadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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