[recipes] obsidian-vault-import: --source-label to override metadata.source#302
Open
dhanjit wants to merge 1 commit into
Open
[recipes] obsidian-vault-import: --source-label to override metadata.source#302dhanjit wants to merge 1 commit into
dhanjit wants to merge 1 commit into
Conversation
…ata.source
By default, every imported thought gets metadata.source = "obsidian".
When a vault aggregates notes from multiple upstream tools (e.g. an
Apple Journal exporter, a Day One exporter, an old Roam dump), there
was no way to tell them apart in OB1 after import — they all read as
just "obsidian", losing provenance.
This adds --source-label (default unchanged: "obsidian") so the
operator can stamp a more specific origin tag:
python import-obsidian.py /path/to/journal-vault \
--source-label apple-journal
After import, metadata->>'source' = 'apple-journal' filters those
thoughts specifically. No other behavior changes; existing scripts
that don't pass the flag get the default.
README updated with a "Customizing the source label" subsection.
Collaborator
|
Thanks for the contribution. Clean additive feature — — Alan (community reviewer; non-binding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--source-labelflag torecipes/obsidian-vault-import/import-obsidian.pyso the operator can stamp a more specific origin tag inmetadata.source. Default is unchanged (obsidian), so existing scripts behave identically.Motivation
The recipe currently hardcodes
metadata.source = "obsidian". That's accurate when the vault is a hand-curated Obsidian vault, but increasingly people pipeline other tools (Apple Journal exporters, Day One exporters, Roam dumps) through Obsidian-style markdown and into OB1 via this recipe.After import, all those thoughts read as just
"obsidian"— provenance is lost. There's no way to query "all Apple Journal entries" or "all Day One imports" separately.Change
Plus a README subsection documenting it.
Usage
After import:
metadata->>'source' = 'apple-journal'retrieves only Apple Journal-originated thoughts.Backward compatibility
100%. Default value matches the previous hardcoded constant. Anyone not passing the flag sees zero behavioral change.
Test plan
--helpshows the new flagobsidian(preserves existing behavior)--source-label apple-journalsetsmetadata.sourceaccordingly on all inserted rowsRelated
Complementary to #301 (preserve full frontmatter under
metadata.frontmatter). With both merged, a single Obsidian vault can carry multi-source provenance:metadata.sourcesays where the thought came from, andmetadata.frontmatter.*carries the per-note original YAML.