|
|
|
|
|
by oneearedrabbit
1175 days ago
|
|
I am excited to see more solutions that work with Apple Notes database directly. This is my go-to application to capture unstructured memos while researching various topics. Last year I got carried away and built a simple site generator for Notes [0]. As a fun exercise I implemented ORM models to query Sqlite database in Ruby: User::Account.server(database: "tmp/test.sqlite").first.
folders_dataset.offset(1).first
notes.
map(&:attachments).flatten.
find { |el| el.is_a?(User::ObjectTypes::EmbeddedPublicJpeg) &&
el.height > 700 &&
el.summary[/animal/i] }.
media_filepath
=> "Accounts/<uuid>/Media/F669B83A-0C47-408E-9645-015737F3B11F/Pasted Graphic.jpg"
Apple Notes' database structure is a fascinating product story. Notes started as a simple note-taking application that stored its content as raw HTML in a few simple tables. However, as the product grew and needed more features like collaboration, they had to make changes and add new columns and tables. They also implemented two flavors of CRDT-like algorithms that evolved over time: one for plaintext chunks and the other one for embedded objects like tables. On top of that, every change that Apple makes must be backward compatible to support legacy devices and systems; but backward-compatibility was not always possible and users had to go through “Migrate your Notes” steps, but it is again a product story.I wish that one day, someone from the development team would write an article about it. [0] https://devlog.notespub.com/2022/08/site-generator-for-apple... |
|
It looked like the other stuff came later and was somewhat orthogonal. (Although their ordered set construct was abusing topotext to represent ordered lists of ids.)
I don't know how much has changed since 2018. I think my table decoding may be broken now.