Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rhosocial-activerecord-firebird ($\rho_{\mathbf{AR}\text{-firebird}}$)

PyPI version Python Tests Coverage Status Apache 2.0 License Powered by vistart

rhosocial ActiveRecord Logo

Firebird Backend for rhosocial-activerecord

Embedded & Server Modes · BLOB & Domains · Sync & Async

Note: This is a backend implementation for rhosocial-activerecord. It cannot be used standalone.

Why This Backend?

1. Firebird-Specific Optimizations

Feature This Backend Generic Solutions
BLOB Types Native BLOB/CLOB handling Application-level chunking
Domains Reusable CREATE DOMAIN Repetitive column definitions
Sequences Native generators Identity/application counters
Stored Procedures Native PSQL support Application-level orchestration
External Functions EXTERNAL FUNCTION DDL C/Python FFI glue

2. True Sync-Async Parity

Same API surface for both sync and async operations:

# Sync
users = User.query().where(User.c.age >= 18).all()

# Async - just add await
users = await User.query().where(User.c.age >= 18).all()

3. Built for Production

  • Connection pooling with configurable pool sizes
  • Transaction support with proper isolation levels
  • Error mapping from Firebird error codes to Python exceptions
  • Type adapters for Firebird-specific data types

Quick Start

Installation

pip install rhosocial-activerecord-firebird

Basic Usage

from rhosocial.activerecord.model import ActiveRecord
from rhosocial.activerecord.backend.impl.firebird import FirebirdBackend
from rhosocial.activerecord.backend.impl.firebird.config import FirebirdConnectionConfig
from typing import Optional

class User(ActiveRecord):
    __table_name__ = "users"
    id: Optional[int] = None
    name: str
    email: str

# Configure
config = FirebirdConnectionConfig(
    host="localhost",
    port=3050,
    database="/var/lib/firebird/2.5/data/myapp.fdb",
    username="SYSDBA",
    password="masterkey"
)
User.configure(config, FirebirdBackend)

# Use
user = User(name="Alice", email="alice@example.com")
user.save()

# Query with parameter binding
results = User.query().where("email = ?", ("alice@example.com",)).all()

💡 AI Prompt: "How do I configure connection pooling for Firebird?"

Firebird-Specific Features

BLOB & Text Types

Native handling of Firebird BLOB subtypes:

class Document(ActiveRecord):
    __table_name__ = "documents"
    id: int
    title: str
    content: bytes  # BLOB SUB_TYPE 0
    body: str       # BLOB SUB_TYPE TEXT

Domains

Reusable column type definitions:

# DDL-level domain support
User.query().where(
    "CREATE DOMAIN EMAIL_ADDRESS AS VARCHAR(255)"
).all()

Sequences (Generators)

Firebird's generator-based sequences:

class Ticket(ActiveRecord):
    __table_name__ = "tickets"
    ticket_no: int  # NEXT VALUE FOR ticket_seq

Stored Procedures

Native PSQL procedure execution:

# Call a stored procedure
result = User.query().where(
    "SELECT * FROM get_user_stats(?)",
    (1,),
).all()

Requirements

  • Python: 3.11+ (including 3.13t/3.14t free-threaded builds)
  • Core: rhosocial-activerecord>=1.0.0
  • Driver: firebird-driver>=2.0.0

Firebird Version Compatibility

Feature Min Version Notes
Basic operations 3.0+ Core functionality
BLOB types 1.0+ Binary/text subtypes
Domains 1.0+ CREATE DOMAIN
Sequences 1.0+ Generators
Stored procedures 1.0+ PSQL
External functions 2.5+ EXTERNAL FUNCTION
Window functions 3.0+ ROW_NUMBER, RANK, etc.
EXECUTE BLOCK 2.1+ Anonymous PSQL
MERGE statement 2.1+ Upsert
BOOLEAN type 3.0+ Native boolean
Identity columns 3.0+ GENERATED BY DEFAULT AS IDENTITY
DBMS_OUTPUT 2.1+ Server-side output

Recommended: Firebird 3.0+ for optimal feature support.

Get Started with AI Code Agents

This project supports AI-assisted development. Clone and open in your preferred tool:

git clone https://github.com/rhosocial/python-activerecord-firebird.git
cd python-activerecord-firebird

Example AI Prompts

  • "How do I configure connection pooling for Firebird?"
  • "Show me how to use BLOB fields"
  • "How do I create and use domains?"
  • "Call a stored procedure with parameters"

For Any LLM

Feed the documentation files in docs/ to your preferred LLM for context-aware assistance.

Testing

⚠️ CRITICAL: Tests MUST run serially. Do NOT use pytest -n auto or parallel execution.

# Run all tests
PYTHONPATH=src pytest tests/

# Run specific feature tests
PYTHONPATH=src pytest tests/rhosocial/activerecord_firebird_test/feature/basic/
PYTHONPATH=src pytest tests/rhosocial/activerecord_firebird_test/feature/query/

See the Testing Documentation for details.

Documentation

Comparison with Other Backends

Feature Firebird PostgreSQL SQLite
RETURNING ✅ RETURNING ✅ RETURNING ✅ RETURNING
BLOB Types ✅ Native ✅ BYTEA ⚠️ BLOB
Domains ✅ Native ✅ CREATE DOMAIN ❌
Arrays ❌ ✅ Native ❌
JSON Type ❌ ✅ JSONB ⚠️ JSON1 extension

💡 AI Prompt: "When should I choose Firebird over PostgreSQL for my project?"

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

License

Apache License 2.0 — Copyright © 2026 vistart


Built with ❤️ by the rhosocial team

GitHub · Documentation · PyPI

Metadata

Release files for rhosocial-activerecord-firebird 1.0.0.dev1

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

Source distribution (sdist)

Source distribution for rhosocial-activerecord-firebird 1.0.0.dev1
File Size Uploaded
rhosocial_activerecord_firebird-1.0.0.dev1.tar.gz 91.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rhosocial-activerecord-firebird 1.0.0.dev1
File Interpreter ABI Platform
rhosocial_activerecord_firebird-1.0.0.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 214.3 kB

Release files / rhosocial_activerecord_firebird-1.0.0.dev1.tar.gz

Download URL rhosocial_activerecord_firebird-1.0.0.dev1.tar.gz
Size 91.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6e0efad4aaa1ed0574a7865068bd9ff634644813ad46b667511d6f51034c9820
BLAKE2b-256 checksum
How to use checksums
3e90a404846045e54ee81225cef655f7860cd47b415e46c153a1f99ace64c9ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / rhosocial_activerecord_firebird-1.0.0.dev1-py3-none-any.whl

Download URL rhosocial_activerecord_firebird-1.0.0.dev1-py3-none-any.whl
Size 122.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f59fbbbd3398b4fd40a4bf6173914c4b283783254048de1647cf046983aaa60
BLAKE2b-256 checksum
How to use checksums
99bbb7ab906b3b936dbcf6edd9fdf52b23ca28d19590159488880c812f64133f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0.dev1 This release

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