Skip to main content

Evidence

Evidence is an open source, code-based alternative to drag-and-drop BI tools. Build polished data products with just SQL and markdown.

Getting started

Head over to their installation page and start with their template to get you started.

Authenticate to MotherDuck

When using development, you can go manually through the UI, pick "settings". If you are running Evidence locally, typically at http://localhost:3000/settings.

img

Then select 'DuckDB' as a connection type, and as the filename, use 'md:?motherduck_token=xxxx' where xxx is your service token. Finally as extension, select "No extension". Click on Save.

img

In production, you can set some global environmements, you would have to set two environments variables:

  • EVIDENCE_DUCKDB_FILENAME='md:?motherduck_token=xxxx'
  • EVIDENCE_DATABASE=duckdb

Displaying some data through SQL and Markdown

Once done, you can add a new page in the pages folder and add the following code blocks to stackoverflow.md file:

First, we simply add some Markdown headers.

---
title: Evidence & MotherDuck
---

# Stories with most score

Then, we query our data from the HackerNews sample_data database in MotherDuck. The query is fetching the top stories (posts) from HackerNews.

​```​new_items
[object Object]
```

Finally, we use the reference of that query result new_items to create a list that would be generated in Mardown. The list contains the title (with the url of the story), the date, the score and the author of the story.

{#each new_items as item}

* [{item.title}](https://news.ycombinator.com/item?id={item.id}) {item.date} ⬆ {item.score} by [{item.by}](https://news.ycombinator.com/user?id={item.by})

{/each}

Head over then to this page you created and you should see the final result that looks like this:

img