trilium_alchemy.core

This module implements ORM access to Trilium and fundamental note capabilities.

See the User guide for a detailed walkthrough with examples.

Class index

Imported

Session

session

Interface to Trilium and context in which to store changes to entities.

Note

note

Encapsulates a note. Can be subclassed for custom attribute accessors.

BaseAttribute

attribute

Encapsulates an attribute, a key-value record attached to a note.

Label

attribute

Encapsulates a label.

Relation

attribute

Encapsulates a relation.

Branch

branch

Encapsulates a branch, a parent-child association between notes.

BaseDeclarativeNote

declarative.base

Note to use as subclass for declarative notes, i.e. note classes which automatically sync with the corresponding note if it already exists in Trilium.

BaseDeclarativeMixin

declarative.base

Reusable collection of attributes and children which can be inherited by a BaseDeclarativeNote.

BaseEntity

entity

Base class for Trilium entities.

State

entity

Entity state. Maintained automatically based on the user’s updates and object’s current state in Trilium.

Function index

Imported

label

declarative.decorators

Adds a Label to a BaseDeclarativeNote or BaseDeclarativeMixin subclass.

relation

declarative.decorators

Adds a Relation to a BaseDeclarativeNote or BaseDeclarativeMixin subclass.

label_def

declarative.decorators

Adds a Label definition (promoted label) to a BaseDeclarativeNote or BaseDeclarativeMixin subclass.

relation_def

declarative.decorators

Adds a Relation definition (promoted relation) to a BaseDeclarativeNote or BaseDeclarativeMixin subclass.

children

declarative.decorators

Add BaseDeclarativeNote subclasses as children, implicitly creating a Branch. May use a tuple of (child_cls, prefix) to additionally set branch prefix.

child

declarative.decorators

Instantiate provided class and add as child, creating a Branch and setting provided kwargs.

Exception index

Imported

ReadOnlyError

exceptions

Raised when user attempts to write a field which is read-only.

ValidationError

exceptions

Raised upon flush when changes in unit of work are invalid or incompatible.