Replies: 2 comments
-
Hi, thanks for your interest and great question — I should update the documentation to clarify this. TriliumAlchemy provides a high-level, ORM-like interface (heavily inspired by SQLAlchemy, hence the name). It gives you a data model for Notes, Attributes, etc and keeps track of changes you make to them. There are Pythonic interfaces making use of “+=“ and other operators, for example to intuitively add attributes and child notes. Once you’ve made changes, you simply “flush” them and the framework takes care of issuing the corresponding requests (ETAPI interface) to Trilium. It takes care of ordering, for example creating new notes before adding attributes to them. It also maintains a cache of notes, so it would be more performant for complex and performance-sensitive use cases. Along the same lines, it utilizes lazy loading and only fetches things like note content and child notes on-demand when they’re accessed by the application. This foundation was designed for, eventually, syncing notes with a filesystem and other such applications. It would perform well in these cases since it only makes ETAPI requests if changes were actually made, so the caller can blindly sync notes with another data store and only the changes will be committed back to Trilium (including handling of note content digests for lightweight comparison). trilium-py and pytrilium are, for the most part, low-level Python wrappers for ETAPI. They abstract the API call itself, but you might still have to put together a sequence of invocations, so it could get a bit tedious if used heavily in an application. You can lookup notes and make changes, but you have to manage some things yourself which are taken care of in TriliumAlchemy — working with attributes and branches, cloning notes, updating content, etc. For cases where you don't need such complexity, these applications are great — they have other nice features on top of abstracting ETAPI as well. But for working with notes at a high level (agnostic of any ETAPI specifics) TriliumAlchemy can save many lines of code and simplify your application logic. If this sounds like what you need, I’d encourage perusing the documentation and especially this section: https://mm21.github.io/trilium-alchemy/sdk/guide/working-with-notes/index.html |
Beta Was this translation helpful? Give feedback.
-
excellent and informative reply, thank you |
Beta Was this translation helpful? Give feedback.
-
Hi, trilium-py is about a year older than trilium-alchemy. I'm wondering what different problems you wanted to solve or benefits to bring forward you wanted that made this project worthwhile? I'm new to Trilium and when looking at python bindings/wrapping for it found the other project first. So now I'm wondering what distinguishes the two. (which of these two backpacks might fit me better?)
Beta Was this translation helpful? Give feedback.
All reactions