API Reference
Overview

API Reference Overview

Welcome to the API reference! This section provides a detailed look at all the functions available in dbzero. Use the table below to quickly find the function you're looking for and jump to its documentation. 👩‍💻


Workspace

FunctionDescription
initInitialize the dbzero workspace at a specific root path.
openOpen a data prefix and set it as the current working context.
closeGracefully shut down dbzero, persisting changes and releasing resources.
commitPersist all pending data changes.
get_current_prefixRetrieve the currently active prefix.
get_prefixesGet a list of all prefixes accessible from the current context.
get_mutable_prefixesGet a list of prefixes that are currently open in read-write mode.
copy_prefixCopy data from prefix to a file (e.g. for backup purposes).

Objects

FunctionDescription
fetchRetrieve a dbzero object instance by its UUID or type (for singletons).
existsCheck if a UUID points to a valid dbzero object or an existing singleton instance.
loadLoad a dbzero instance recursively into memory as its equivalent native Python representation.
uuidGet the unique object ID (UUID) of a dbzero instance.
set_prefixSet the persistence prefix for a Memo instance dynamically at runtime.
get_prefix_ofReturn the prefix where given dbzero-managed object resides.
materializedReturn a "materialized" (fully initialized) version of a @dbzero.memo object.

Data Types

FunctionDescription
memoDecorator that transforms a standard Python class into a persistent, dbzero-managed object.
tupleCreate a new dbzero tuple instance.
listCreate a new dbzero list instance.
setCreate a new dbzero set instance.
dictCreate a new dbzero dictionary instance.
indexCreate a new dbzero index instance for fast lookups.
bytearrayCreate a new dbzero bytearray instance.
enumCreate a persistent, type-safe enumerated type.

Query and Tags

FunctionDescription
findQuery for memo objects based on specified search criteria.
tagsGet a tag manager interface for given memo objects.
as_tagMake a searchable tag from a memo instance or class.
noCreate a negative predicate (NOT condition) for find queries.
filterApply fine-grained, custom filtering logic to a query.
split_bySplits a query iterator into groups based on a given criterion.
init_fast_queryInitializes the fast query caching system using a specified prefix.
group_byPerform cached group-and-aggregate queries over a set of objects.

Snapshots

FunctionDescription
snapshotGet a read-only snapshot view of dbzero state.
get_snapshot_ofGet the Snapshot instance from which a given object originates.
select_newRefine a query to include only objects created between two snapshots.
select_deletedRefine a query to include only objects deleted between two snapshots.
select_modifiedRefine a query to include only objects modified between two snapshots.

Introspection

FunctionDescription
is_memoCheck if a given object is a dbzero memo class or memo instance.
is_singletonCheck if a given object is a dbzero singleton instance.
is_enumCheck if an object is a dbzero enum type.
is_enum_valueCheck if an object is a dbzero enum value.
get_schemaIntrospect all in-memory instances of a @dbzero.memo class to deduce dynamic schema.

Object Lifecycle

FunctionDescription
weak_proxyCreate a weak reference to a memo object.
expiredCheck if a weak reference proxy has expired (the object was garbage collected).
getrefcountGet the number of strong references to a memo object or class.

Synchronization

FunctionDescription
get_state_numReturn the state number for a given data prefix.
waitBlock execution until desired prefix reaches target state or timeout occurs.
async_waitPause an asyncio coroutine until a specific data prefix reaches a target state number.
lockedStop the autocommit, ensuring that all changes will be made in a scope of single transaction.
atomicOpen a context manager to group multiple mutating operations into a single indivisible transaction.

Other

FunctionDescription
assignPerform bulk attribute updates on one or more memo objects.
atomic_assignPerform bulk attribute updates on one or more memo objects within an atomic transaction.
comparePerform a deep, content-based comparison of two memo objects to check if they are identical.
touchMark one or more Memo objects as modified without changing their data.
rename_fieldRename a field for a given memo class.
hashCompute a deterministic 64-bit integer hash for any object.
set_cache_sizeSet the maximum size of the in-memory cache.
clear_cacheManually evict all objects from the in-memory cache.
get_configRetrieve the active configuration settings for dbzero.
serializeConvert a dbzero query iterable or enum value into platform-independent binary representation.
deserializeReconstruct a dbzero object from serialized bytes.