Firebird Base Modules

2.0.2 · active · verified Thu Apr 16

Firebird-base provides foundational modules for working with Firebird databases in Python, offering utilities for logging, configuration, buffering, event handling, and protobuf integration. It is actively maintained with regular patch and minor releases, typically quarterly, and had a major version bump to 2.0.0 in late 2023, raising the minimum Python version to 3.11. The current version is 2.0.2.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates basic usage of MemoryBuffer, a core utility for managing binary data, including the `get_raw` method introduced in v2.0.0.

from firebird.base.buffer import MemoryBuffer
import io

# Create a MemoryBuffer with an initial capacity of 1KB
buffer = MemoryBuffer(1024)

# Write some bytes to the buffer
test_data = b"This is a test string to be written into the buffer."
buffer.write(test_data)

# Move the cursor to the beginning to read
buffer.seek(0, io.SEEK_SET)

# Read all data from the buffer
read_data = buffer.read()

# Get the raw underlying buffer content (new in v2.0.0)
raw_content = buffer.get_raw()

print(f"Original data: {test_data}")
print(f"Read data: {read_data}")
print(f"Raw buffer content (up to written length): {raw_content[:len(test_data)]}")

# Verify data
assert read_data == test_data
assert raw_content[:len(test_data)] == test_data
print("Buffer operations successful!")

view raw JSON →