Note: This is a backend implementation for rhosocial-activerecord. It cannot be used standalone.
| 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 |
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()- 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
pip install rhosocial-activerecord-firebirdfrom 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?"
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 TEXTReusable column type definitions:
# DDL-level domain support
User.query().where(
"CREATE DOMAIN EMAIL_ADDRESS AS VARCHAR(255)"
).all()Firebird's generator-based sequences:
class Ticket(ActiveRecord):
__table_name__ = "tickets"
ticket_no: int # NEXT VALUE FOR ticket_seqNative PSQL procedure execution:
# Call a stored procedure
result = User.query().where(
"SELECT * FROM get_user_stats(?)",
(1,),
).all()- Python: 3.11+ (including 3.13t/3.14t free-threaded builds)
- Core:
rhosocial-activerecord>=1.0.0 - Driver:
firebird-driver>=2.0.0
| 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.
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- "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"
Feed the documentation files in docs/ to your preferred LLM for context-aware assistance.
β οΈ CRITICAL: Tests MUST run serially. Do NOT usepytest -n autoor 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.
- Getting Started β Installation and configuration
- Firebird Features β Firebird-specific capabilities
- Type Adapters β Data type handling
- Transaction Support β Transaction management
| Feature | Firebird | PostgreSQL | SQLite |
|---|---|---|---|
| RETURNING | β RETURNING | β RETURNING | β RETURNING |
| BLOB Types | β Native | β BYTEA | |
| Domains | β Native | β CREATE DOMAIN | β |
| Arrays | β | β Native | β |
| JSON Type | β | β JSONB |
π‘ AI Prompt: "When should I choose Firebird over PostgreSQL for my project?"
We welcome contributions! See CONTRIBUTING.md for guidelines.
Apache License 2.0 β Copyright Β© 2026 vistart
Built with β€οΈ by the rhosocial team
GitHub Β· Documentation Β· PyPI