Skip to content

Latest commit

 

History

History
74 lines (60 loc) · 1.87 KB

Books_Queries.md

File metadata and controls

74 lines (60 loc) · 1.87 KB
banner banner_x banner_y
assets/banners/Dataview-Banner.png
1.0
1.0

Dataview Queries

The Obsidian Books Vault markdown contains metadata with tags allowing a variety of queries using the Dataview plugin for Obsidian. A few example Dataview queries follow.

Example Books query

The markdown for "Timequake" by Kurt Vonnegut Jr. has the following YAML prelude:

---
bookid: 9594
title: Timequake
author: Kurt Vonnegut Jr.
authors: 
isbn: 0099267543
isbn13: 9780099267546
rating: 4
avgrating: 3.72
publisher: Vintage Classics
binding: Paperback
pages: 219
published: 1997
shelves: science-fiction, novels, vonnegut
shelf: read
review: 
---

Dataview_Books_query

The above book metadata can be used to perform Dataview queries to search, filter, and retrieve books as if they are in a database. For example, to produce a table of all books in this vault by Kurt Vonnegut Jr. published prior to 1970 add the following to a markdown file in the vault:

```dataview
TABLE
  link(file.link, title) as Title,
  author AS "Author",
  published AS "Year"
FROM "Books"
WHERE author = "Kurt Vonnegut Jr." and published < 1970
SORT published ASC
```

The above Dataview code block produces the following output:

TABLE
  link(file.link, title) as Title,
  author AS "Author",
  published AS "Year"
FROM "Books"
WHERE author = "Kurt Vonnegut Jr." and published < 1970
SORT published ASC

Additional example Dataview book queries can be found in the Dataviews folder:

See also