blacksmithgu / obsidian-dataview Goto Github PK
View Code? Open in Web Editor NEWA data index and query language over Markdown files, for https://obsidian.md/.
Home Page: https://blacksmithgu.github.io/obsidian-dataview/
License: MIT License
A data index and query language over Markdown files, for https://obsidian.md/.
Home Page: https://blacksmithgu.github.io/obsidian-dataview/
License: MIT License
Allow querying for files which link to a file (so something like from [[games]]
).
Hi,
I really like the dataview plug-in and thank you for the great work. I am exploring the possibility of build-up a research paper list based on Obsidian-publish, Obsidian-citation, and Obsidian-dataview. A prototype would be something like this. So far in the prototype, I have to manually copy and paste the citations into the notes until I came across Obsidian-dataview. I believe the query and visualization feature of Obsidian-dataview could be the cornerstone of my project.
So far my progress is that I am able to use obsidian-citation to generate paper notes with YAML header and I can use Obsidian-dataview to generate beautiful tables offline. But the problem is that the table cannot be carried over to Obsidian-publish since the markdown file only has a code block and the table is generated during the preview. I am wondering whether and how I could put this table online?
I understand that it is probably impossible to have dynamic render in Obsidian-publish. But is it possible for obsidian-dataview to generate the table in markdown code or HTML code so that I could append the table in the .md
file before publishing? Or do you have any other suggestions?
Thanks again for this great plug-in!
Best,
Derek Da Kuang
Hi
Looks a great plugin, but can you to add to the docs, what shortcut or options to click to make it work?
I have the plugin, but see nothing in the action menu or sidebar.
Thank you
Hi there, I am super excited about Dataview, it's already revolutionized my workflow. One question, though, is whether there's planned support (or already existing support) for dataviews of individual lines/headings based on tags? For instance, one of my common workflows looks like:
# Today's Note
## Tale of Two Cities #reading
- conflagration #worddefinitions
- [ ] Read 'War and Peace' #books
- France is wild
## Harry Potter #reading
- [ ] Check out 'Lord of the Rings' #books
- Muggle #worddefinitions
Ideally, I'd love to be able to set up queries in the following forms:
Reading:
'''dataview
sections from #reading // or something similar
'''
which could return something like:
Reading:
(where each of thes is a link to the relevant heading, to deep-dive).
Also useful would be querying individual lines for tasks or tags, e.g.
Words:
'''dataview
list lines from #worddefinitions
'''
or
Books:
'''dataview
list tasks from #books
'''
to get references to those individual lines, a la:
Words:
Books:
The existing page-based linking is super helpful for lots of cases, but for those small thoughts that don't have their own page, it'd be great to collate them as well.
Fantastic plug-in. Bloody fantastic!
Just wondering if other date formats will be supported in the future?
I don't mean the Windows explorer dates, but dates used in titles or in notes.
I've always used YYYYMMDD because I've always been too lazy to add the hyphens.
Hello there,
Thanks for creating this useful plugin!
I'm currently using the tags
field in the YAML front matter of my notes:
---
author: John Smith
tags: book, business
---
These get picked up by Obsidian in the tags panel. However, it doesn't work when I try to filter by a particular tag using dataview:
```dataview
table author, tags
from #book
```
Seems like only tags with the #
prefix is parsed at the moment. Is it possible to support tags located in the YAML front matter?
I would love to be able to add new page from the table view and to have a pre-filled yaml structure (so the page fits the query). Perhaps even be able to define default yaml values?
Thoughts?
I've started using dataviews in my daily notes via the daily note template. One dataview I'm using lists all the notes I edit that day:
list from "some-folder"
where file.mtime.day = date({{date:YYYY-MM-DD}}).day and file.mtime.month = date({{date:YYYY-MM-DD}}).month and file.mtime.year = date({{date:YYYY-MM-DD}}).year
That ends up inserted in my daily note as a dataview that matches any files edited today. It's very useful. However, if I edit a file after that day, the list stops showing it, even though I edited a file on that day. Because I'd love to have a history of the files I've worked on for any given day, I need some way to "burn out" a dataview—effectively replace its code fence with its markdown result.
I can see this being a button that appears on hovering the code fence when in preview mode, or even a command in the command palette that operates on the dataview under the cursor. Even better would be a way to bake this into the dataview so that it happens automatically after a certain threshold, e.g.
list from "some-folder"
where file.mtime.day = date({{date:YYYY-MM-DD}}).day and file.mtime.month = date({{date:YYYY-MM-DD}}).month and file.mtime.year = date({{date:YYYY-MM-DD}}).year
burnout after {{date:YYYY-MM-DD}}
but I have no idea if such a thing is technically feasible, as I haven't dug too deeply into Obsidian's internals. Either way, a way to go from a dataview query to its hardcoded result would be very useful to freeze documents in time.
A common scenario (if not the most common) when gathering tasks using dataview is likely to be able to pull all tasks that remain incomplete. It would be ideal to be able to do something like the following to filter out tasks that aren't complete:
task from ""
where !task.complete
sort file.day desc
Add support for nested YAML fields using simple dot notation (so, Dates.Birthday
for example, which should map to the 'Birthday' field in the dates map/object).
Is there a way to select untagged notes?
Something like this:
```dataview
list where tags = list()
```
I can't figure out how to query tags on items either.
Hi, I couldn't have Dataview work with v0.1.5 (I had an empty output whatever the query), and I saw you fixed things in v0.1.7 so I tried again.
Unfortunately it still doesn't work for me.
I use MacOS Catalina 10.15.3 with Obsidian v0.11.0.
My vault is on iCloud if that matters.
With a very simple query:
list from "CONCEPTS"
I get the following output:
Dataview: TypeError: Cannot read property 'prefix' of null
And the console says:
Uncaught (in promise) TypeError: Cannot read property 'startsWith' of null at Function.TagIndex.parseTags (eval at <anonymous> (app.js:1), <anonymous>:9102:34) at Function.eval (eval at <anonymous> (app.js:1), <anonymous>:9152:44) at step (eval at <anonymous> (app.js:1), <anonymous>:68:23) at Object.eval [as next] (eval at <anonymous> (app.js:1), <anonymous>:49:53) at eval (eval at <anonymous> (app.js:1), <anonymous>:42:71) at new Promise (<anonymous>) at __awaiter (eval at <anonymous> (app.js:1), <anonymous>:38:12) at Function.TagIndex.generate (eval at <anonymous> (app.js:1), <anonymous>:9141:16) at Function.eval (eval at <anonymous> (app.js:1), <anonymous>:8977:33) at step (eval at <anonymous> (app.js:1), <anonymous>:68:23) TagIndex.parseTags @ index.ts:119 eval @ index.ts:146 step @ tslib.es6.js:102 eval @ tslib.es6.js:83 eval @ tslib.es6.js:76 __awaiter @ tslib.es6.js:72 TagIndex.generate @ index.ts:139 eval @ index.ts:14 step @ tslib.es6.js:102 eval @ tslib.es6.js:83 eval @ tslib.es6.js:76 __awaiter @ tslib.es6.js:72 FullIndex.generate @ index.ts:12 eval @ main.ts:78 step @ tslib.es6.js:102 eval @ tslib.es6.js:83 eval @ tslib.es6.js:76 __awaiter @ tslib.es6.js:72 DataviewPlugin.prepareIndexes @ main.ts:77 eval @ main.ts:35 step @ tslib.es6.js:102 eval @ tslib.es6.js:83 eval @ tslib.es6.js:76 __awaiter @ tslib.es6.js:72 eval @ main.ts:35 e.tryTrigger @ app.js:1 e.trigger @ app.js:1 t.trigger @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 s @ app.js:1 Show 2 more frames
And if I query by tag the output is:
Dataview: TypeError: Cannot read property 'tag' of null
First of all, thanks for this great plugin. I would like to ask if there is a syntax to exclude a specific folder, for example like: from "" not from "books"
?
This seems like a great plugin but I can't get it to work and I think I might be using it incorrectly.
Scenario 1. Creating a list of files based on a particular word/phrase within the file's content (eg. show all files which mention "Dailies")
Scenario 2. Creating a list of files based on partial title match (eg. list all files with the name "Journal - " in the title)
Is either of these possible and if so, can you help me with the syntax?
Any chance of having support for using markdown sections (i.e. content under a header) being used as fields (with multiline values and markdown rendering)?
This is different from #23, in that the question here is one of using the content of a section (including nested sections) as fields rather than treating the items themselves as records (as in #23). (Likewise, it'd actually be nice to be able to use standardized block names as fields; e.g. to pull out the ^thesis
block of a file and treat it as a field for that file's row, to get a nice grid of chapter thesis statements.)
Anyway, I ask because I've recently found myself wanting to display the contents of various note files (structural work on chapters for a book) in consolidated form. For example, to display all the intros or all the exercises, and be able to see which parts of what chapters are fleshed out or not.
(Even more awesome would be if you could edit in place or at least have a way to click and open the relevant note+section.)
Anyway, I've been sort of kludging a solution using hovering over various links, and using section titles that are links to chapter titles and whatnot, and been wishing I had a better way. I was thinking of maybe implementing some sort of query layer over the markdown, and then I stumbled across a reference to this plugin. ;-)
(Anyway, I totally understand if this is something completely out of scope. Just thought I'd ask.)
Hey blacksmithgu, thanks for the awesome new 0.2.0 release 😄
I've seen when using the new from [[link]]
feature that certain symbols cause a parsing failure.
When links contain an !
, $
, %
, *
, (
, )
, or +
, the parser fails.
Thanks to @arminta7 for finding most of these characters! 😃
It appears NLP is a bit too aggressive. When I query a note that has a time as a field in the frontmatter such as "12 minutes" it renders as "PT12M", which I'm guessing is 12 midnight Pacific Time?
Really love this plug-in, though. Great job on this!
Thanks for creating this plugin. I use it to list music video's I frequently play.
A good addition would be to group the list based on the first letter of the name (or part (year, month, day) of ctime or mtime for example. And that links at the top are shown with the grouping value.
For name that would be something like 0...9...A...Z. So you can make jumps to the part you want. As the sorting works this might be feasible too?
Hello,
While using dataview, I noticed that the plugin only render single line YAML attributes, while multi-line YAML attributes are returned as null.
EX:
Attribute:
Would it be possible to enhance the plugin by adding supports for multi-line YAML attributes?
Hello! This plugin rules, and I'm so excited to use it.
I'm wondering about tables that represent arrays of data within notes. I know that #6 is still open, but if we imagine a folder pet-owners
of notes with frontmatter like:
---
pets:
- Alfred
- Betty
- Carl
---
It would be useful to be able to create a table of pet names in this instance—more generically, a table of data that has been extracted from notes. The SQL equivalent of this would be unnest
. So for the above note format, we'd end up with
pet name | parent note |
---|---|
Alfred | note-title |
Betty | note-title |
Carl | note-title |
Here's a guess at what that syntax could look like:
```dataview
table pets as "pet name", name as "parent note"
from "pet-owners".pets
```
Ideally, this could go one step further and support arrays of YAML objects:
---
pets:
- name: Alfred
age: 5
- name: Betty
age: 3
- name: Carl
age: 8
---
This might necessitate some sort of aliasing on the from
field, to be able to access properties from different sources:
```dataview
table pets.name, pets.age, owners.name as "parent note"
from "pet-owners" as owners, owners.pets
```
I'd be happy to build such a feature if you think it's possible.
It would be great to be able to filter based on block or sections link in the standard search.
This could be a lower hanging fruit comparing to the proper per-task filtering.
This would let us use tasks as "pseudo-database-records" if we add tags to them (partly solving request #23).
Currently, there are multiple ways to do per-file filtering (e.g. folders, filename, YAML fields, tags), but not a single way to target the tasks.
You could pass "query" into renderFileTasks function, extract the required tags and simply not render the tasks if they don't have the tags. A bit of code to redo "from and/or/not" logic but still not too complicated.
Hi. Thank you for creating the best and most usefull plugin for Obsidian 🏆🥇. If I do a search or inline query I have to wait (to long). But with Dataview there is no waiting time. I started to create all my MOC/TOC of Dashboards like I call them with Dataview. Thats why I was very happy that Obsidian yesterday allowed to install community plugins on Mobile. Of course I first tested with Dataview 😀. I can install it but I can not activated it. People told me in the Discord Mobile channel that it works on Android. Would you be able to fix it on iPhone and iPad? That would be AWESOME 👏
Hi. You have cretaed the best Obsidian Plugin. It is only when it is not working anymore that you know how much you are depending on something. Yesterday everything did work perfect. Today I upgraded your plugin and nothing is working anymore.
This is een example what I use and I got zero results.
TABLE file.mtime as Modified, file.size, file.path as Path
FROM #dagboek and #dailyreview
WHERE date(tommorow) - file.mtime >= dur(365 days) and file.name != "Dashboard Daily Review Dagboeken.md"
SORT file.mtime desc
Dataview: Query returned 0 results.
This is from another query that modified with the feedback on the error (original it was like above with zero results)
TABLE file.mtime as Modified, file.size, file.path as Path
FROM tag ('#book') and tag ('#productivity')
WHERE date(now) - file.mtime >= dur(365 days)
SORT file.mtime desc
Dataview: Error:
-- PARSING FAILED --------------------------------------------------
1 | TABLE file.mtime as Modified, file.size, file.path as Path
2 | FROM tag ('#book') and tag ('#productivity')
| ^
3 | WHERE date(now) - file.mtime >= dur(365 days)
4 | SORT file.mtime desc
Expected one of the following:
'(', '-', string, tag ('#hello/stuff')
my email : [email protected]
Use Case: To test out this plugin I started started moving my monthly expenses into Obsidian. It provides a really nice overview but it would be cool to see a total ($) too.
Hi there! Thanks a bunch for this plugin, it's quite useful 👍
I slightly prefer using page + explicit mentions over tags. For instance, to tag page A with tag B, i prefer to create a page B, and then add a mention from A to B: this makes it so that Obsidian displays page A as a linked mentions, getting me a free reverse-tag search using the mentions view. Plus, it keeps pages connected in the graph display, and it allows adding additional information on the tag page itself, which is nice for giving more context.
As a matter of fact, I was wondering if it'd make sense to add mentions in the search queries? In addition to doing list from #tag
, one could also do list where "tag_page_name" in linked_mentions
to select the pages that contain a mention to tag_page_name
. We could also imagine asking for several mentions with an array-like syntax, list where ["foo", "bar"] in linked_mentions
, to mean that both mention must appear (or just use the plain and
/or
operators, while making sure to cache the mention set for a page :)).
Thoughts?
Hello, thank you so much for the plugin.
But i am a bit not clear on how to use. Could you help me clarify?
For example, in example 1:
table time-played, length, rating
from "games"
sort rating desc
I would assume that "games" is the note title.
while "time-played", "length", and "rating" is metadata specified in YAML?
When no matches show up, I think it would be helpful to see an empty state mentioning that there are no matches. When nothing shows up, I end up double checking the devtools to see if something broke.
Hi, sorry for filing all the tickets. I'm really just playing around and stress testing it a bit 😄
More than once I've run into the following stacktrace while switching to preview:
2index.html:9045 Uncaught (in promise) TypeError: Cannot read property 'tags' of undefined
at TagIndex.eval (eval at <anonymous> (app.js:1), <anonymous>:9045:31)
at step (eval at <anonymous> (app.js:1), <anonymous>:68:23)
at Object.eval [as next] (eval at <anonymous> (app.js:1), <anonymous>:49:53)
at eval (eval at <anonymous> (app.js:1), <anonymous>:42:71)
at new Promise (<anonymous>)
at __awaiter (eval at <anonymous> (app.js:1), <anonymous>:38:12)
at TagIndex.reloadFile (eval at <anonymous> (app.js:1), <anonymous>:9038:16)
at eval (eval at <anonymous> (app.js:1), <anonymous>:8860:90)
at step (eval at <anonymous> (app.js:1), <anonymous>:68:23)
at Object.eval [as next] (eval at <anonymous> (app.js:1), <anonymous>:49:53)
Most recently it was while building the following dataview (not sure if it's related though):
task from ""
where file.day
sort file.day desc
Hi, first of all thank you very much for the great plugin, it's very useful.
I noticed a bug while using the WHERE
command.
I have this file tree:
Note1
is
---
color: blue
type: note
---
and Note2
is
---
color: red
type: note
---
and in Dataview
, I have this dataview
code snippet:
TABLE color, type
FROM "Test_folder"
WHERE color="blue" AND type="note"
So in Dataview
I should see
but instead I am seeing this
!=
Also, it seems that the !=
operator for strings is broken too. Querying this:
TABLE color, type
FROM "Test_folder"
WHERE color!="blue"
gives an empty table.
Thank you very much once again!
I don't think there's a way to say:
list from #dessert but not #icecream
I've tried a few ways to no avail.
Something like this would be so useful.
This is probably a separate issue, but a way to say does not contain would also be great.
list from #dessert
where !=contains(file.name, "Ice Cream")
or something like that.
It seems that the Dataview plugin can’t parse queries with accented characters like :
list from #début
Dataview: Failed to parse query (line 1, column 13): expected ‘and’ or ‘or’ or ‘&’ or ‘|’,/FROM/i,/SORT/i,/WHERE/i,EOF
It is essential to non English speaking people like me…
I'm still getting things set up so this might just be an issue with my query syntax. Or I'm misunderstanding how to set up the YAML
I have the following query block:
\```dataview
table cost from #foo
\```
I have a very basic note with the following:
This is what renders for me in the query block:
Using version 0.1.4.
No errors in the console.
Thank you for the update and rendering multi-line YAML array!!!
Currently the array is comma separated
Would it be possible to add in the option (in plugin setting) to let the user to input the separator? (like the current option to Render Null As)
The table generated currently doesn't wrap the first table cell in a <td>
.
Also, less important but the table doesn't include a tbody and a thead. While not required, it would make it easier to target the table with CSS.
The reading notes are split into many cards, making the index cluttered。Also, can the form letterhead support Chinese?thx
Sorry for the issue spam. My current goal is to create a list of files modified today. I tried:
TABLE file.mtime as Modified
FROM ""
WHERE file.mtime >= date(today)
SORT file.mtime
But that didn't work. My guess is that today
reflects the current day rather than the start of the day. There isn't a yesterday
keyword so I couldn't do that.
I was able to find "files modified in the last 24 hours" though:
TABLE file.mtime as Modified
FROM ""
WHERE date(today) - file.mtime >= dur(1 days)
SORT file.mtime
One of the things I love about this plugin is the temp links it creates. I can make MOCs without cluttering my graph, for example.
But now having tried out the list from [[note]]
feature, there are times where I would actually like a page with a temporary link to note
to appear in the results of the query. I'm not sure if that makes sense.
Is it possible to include a toggle tempLinks
, for example, to indicate that any notes with temp links should count when querying for that link?
Hi there!
The plugin doesn't see tags in the frontmatter. It processes only hashtags.
I think this might just be user error but I'm trying to use the following query for project management:
task from #projects/active/calendar and #task/todo
I have a note with the following frontmatter:
---
tags:
- "projects/active/calendar"
- "task/todo"
---
It's not showing up. Any ideas why?
This error keep popping up while i am using Obsidian. I am not sure if this is the same error as #11, Please help me close this if it is the same.
Uncaught (in promise) TypeError: Cannot read property 'tags' of undefined
at TagIndex.eval (eval at <anonymous> (app.js:1), <anonymous>:9045:31)
at step (eval at <anonymous> (app.js:1), <anonymous>:68:23)
at Object.eval [as next] (eval at <anonymous> (app.js:1), <anonymous>:49:53)
at eval (eval at <anonymous> (app.js:1), <anonymous>:42:71)
at new Promise (<anonymous>)
at __awaiter (eval at <anonymous> (app.js:1), <anonymous>:38:12)
at TagIndex.reloadFile (eval at <anonymous> (app.js:1), <anonymous>:9038:16)
at eval (eval at <anonymous> (app.js:1), <anonymous>:8860:90)
at step (eval at <anonymous> (app.js:1), <anonymous>:68:23)
at Object.eval [as next] (eval at <anonymous> (app.js:1), <anonymous>:49:53)
I think it'd be very useful to be able to limit the number of records returned by a query. Basically the equivalent of the limit N
clause in postgres, or top N
clause in SQL Server.
Thanks for the excellent plugin!
Maybe this is already possible, in which case it's a documentation request.
It would be useful if a snippet could use / reference attributes of the note a dataview snippet is in.
So that e.g. thisnote.path or thisnote.mtime can be used in equations.
And so that template dataview snippets can be used.
Hi, this plugin seems awesome! I'm still trying to get things set up but this was the first issue I ran into.
\```dataview
list FROM #loose-end
\```
I'm seeing the following parsing error:
Dataview: Failed to parse query (line 1, column 17): expected /FROM/i,/SORT/i,/WHERE/i,/and|or|&|\|/i,EOF
It seems that it's not properly parsing tags with -
s in them. I tried the same query with a different tag and it worked fine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.