obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

support markdown tables as data sources

Open vitaly opened this issue 3 years ago • 29 comments

A regular markdown table

| name | foo | bar |
| - | - | - |
| something | 1 | |
| something else | 2 | 123 |

that renders as

name foo bar
something 1
something else 2 123

can be made accessible through the api. may be something like

```dataquery
table i.name as Name, i.foo as Foo, i.bar as Bar
FROM ...
FLATTEN file.items as i
```

vitaly avatar Oct 17 '21 01:10 vitaly

I think the only hard part of this is coming up with the syntax for specifying what Markdown table you want to load from.

blacksmithgu avatar Oct 19 '21 02:10 blacksmithgu

cooperate and do it with cooperation with the advanced. table plugin people?

vitaly avatar Oct 19 '21 06:10 vitaly

That plugin is for table manipulation is it not? I'm more referring to how mechanically the source should look like. I.e., maybe by taking the first table under a header?

TABLE FROM mdtable([[Page#Header]])

blacksmithgu avatar Oct 19 '21 07:10 blacksmithgu

well, even just 'first table in the file' would already be great. but now that you have header queries, that seems like the right direction.

vitaly avatar Oct 20 '21 15:10 vitaly

This would be a realy awesome feature for this already very cool plugin :)

rasmusagdestein avatar Oct 21 '21 15:10 rasmusagdestein

+1

intellectronica avatar Oct 23 '21 09:10 intellectronica

I think the only hard part of this is coming up with the syntax for specifying what Markdown table you want to load from.

Obsidian already supports the following:

[[My Note#^my-table]]

Where ^my-table should be put under the table in question.

Maybe it could be used.

apogorzelska avatar Oct 23 '21 12:10 apogorzelska

It can also just be an array of tables, so something like: p.tables[2]

intellectronica avatar Oct 23 '21 12:10 intellectronica

Block references would also work, that is a good idea. I'll make the data available in the index (as file.tables) and see if I can make it possible to query by the block ID.

blacksmithgu avatar Oct 23 '21 17:10 blacksmithgu

You could possibly take a peek at how the Dice Roller plugin does it, it lets you pick a table to roll from by specifying table's block ID

apogorzelska avatar Oct 25 '21 05:10 apogorzelska

Was just playing with obsidian-tracker, which can work on tables, and came here to see if I could use dataview to query a table to return just a subset of the table (think a constantly growing activity log, and wanting to just show the day's activities in the Daily Note).

Looks like pulling from tables with DataView is not available yet, but this ticket gives me hope it will be someday..

dionvansevenant avatar Jan 11 '22 21:01 dionvansevenant

Block references would also work, that is a good idea. I'll make the data available in the index (as file.tables) and see if I can make it possible to query by the block ID.

What's the status on this? I'd love to experiment with dataview in order to query my inventory database :-)

oktayacikalin avatar Mar 18 '22 16:03 oktayacikalin

cooperate and do it with cooperation with the advanced. table plugin people?

I think Notion-like Tables must have something like this under the hood, right?

fedderw avatar Jun 01 '22 18:06 fedderw

I also give this feature a +1. In my daily notes, I use markdown tables to keep track of my daily habits. I'm thinking I could have a page to parse my habit logs with the hopes of displaying some sort of "don't break the chain" / summary idea.

BluBloos avatar Jul 28 '22 10:07 BluBloos

Hmm I wonder how difficult this is. Obsidian does parse tables so wonder if we could leverage that somehow.

AB1908 avatar Jul 28 '22 11:07 AB1908

Just coming by to add my +1 to this as a useful feature. I'm writing up a table of my home network and would love to query it to pull the IP into sub-pages.

jonnyniv avatar Oct 20 '23 10:10 jonnyniv

That would be a relly nice feature, +1 to this for sure!

elbeshenrique avatar Oct 22 '23 14:10 elbeshenrique

+1. My current workaround is to use lists with inline fields. It’s more verbose syntax, but also more flexible.

pavel-suhakou avatar Oct 25 '23 05:10 pavel-suhakou

Since the markdown tables got a boost with the 1.5 update, supporting the tables directly as a data source would be a very good addition by Dataview.

batuhanuzaldimvc avatar Dec 26 '23 05:12 batuhanuzaldimvc

The update does not bring table indexing to the metadata cache which means we'd still have to parse tables by hand. Given that this plugin is in maintenance mode, it is unlikely it will be added.

AB1908 avatar Dec 26 '23 14:12 AB1908

+1 to this issue. An idea I have a use for this feature would be having a table of expenses in my daily notes, that I can tally up in a monthly note for budgeting.

CoderRuq avatar Mar 14 '24 12:03 CoderRuq

+1 This would be very useful to query manual data with.

alexristinmaa avatar Apr 19 '24 15:04 alexristinmaa