blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.86k stars 405 forks source link

support markdown tables as data sources #555

Open vitaly opened 2 years ago

vitaly commented 2 years ago

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
```
blacksmithgu commented 2 years ago

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

vitaly commented 2 years ago

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

blacksmithgu commented 2 years ago

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]])
vitaly commented 2 years ago

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.

rasmusagdestein commented 2 years ago

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

intellectronica commented 2 years ago

+1

apogorzelska commented 2 years ago

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.

intellectronica commented 2 years ago

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

blacksmithgu commented 2 years ago

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.

apogorzelska commented 2 years ago

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

dionvansevenant commented 2 years ago

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..

oktayacikalin commented 2 years ago

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 :-)

fedderw commented 2 years ago

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?

BluBloos commented 2 years ago

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.

AB1908 commented 2 years ago

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

jonnyniv commented 11 months ago

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.

elbeshenrique commented 10 months ago

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

pavel-suhakou commented 10 months ago

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

batuhanuzaldimvc commented 8 months ago

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.

AB1908 commented 8 months ago

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.

CoderRuq commented 6 months ago

+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.

alexristinmaa commented 4 months ago

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

nextzhou commented 4 months ago

+1. I have some very brief content that I wish to display through dataview, but I do not want to create a new note. Table source would be an ideal solution.

chrabia commented 3 months ago

+1, IMO it sounds like a lot more useful solution than files as data sources

Andrew-Willms commented 2 months ago

+1, I would use this

nonsns commented 2 months ago

+1 would use it too

ali4ever4 commented 1 week ago

+1