Skip to content

Warning

You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

dbt-docs-to-notion

Actions
Exports dbt model docs to a Notion database
v1.0.2
Star (40)

Tags

 (1)

dbt-docs-to-notion

A Github action for exporting dbt model docs to a Notion database, where they can be conveniently consumed (especially by casual users in your org).

Output

A Notion database, within a page of your choosing, with records like this: dbt docs to notion output

Usage

Prerequisites

In advance of using this action, you should:

  1. Create a new integration within your Notion workspace
  2. Have your Notion integration token and a working dbt profiles.yml accessible to your repo (I'd recommend using Github's repository secrets; see example workflow below).

Inputs

  • dbt-package: dbt-bigquery, dbt-postgres, dbt-bigquery==1.0.0, etc. (required)
  • dbt-profile-path: where profile.yml lives (default: ./)
  • dbt-target: profile target to use for dbt docs generation (required)
  • model-records-to-write: "all" or "model_name_1 model_name_2 ..." (default: "all")
  • notion-database-name: what to name the Notion database of dbt models (required)
  • notion-parent-id: Notion page where database of dbt models will be added (required)
  • notion-token: Notion token API for integration to use (pass using secrets) (required)

Post-initialization Touchups

Unfortunately, Notion's API doesn't allow for setting the order of properties or records in a database. Thus, after creating your database, you'll probably want to do some re-arranging (I'd recommend adding a table view to your database's parent page).

Example workflow

name: dbt Docs to Notion

on:
  push:
    branches:
      - master

jobs:
  dbt-docs-to-notion:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Create temp dbt profiles
        run: "printf %s \"$DBT_PROFILES\" > ./profiles.yml"
        env:
          DBT_PROFILES: ${{ secrets.DBT_PROFILES }}
      - name: dbt-docs-to-notion
        uses: ./.github/actions/dbt-docs-to-notion
        with:
          dbt-package: 'dbt-bigquery==1.0.0'
          dbt-profile-path: './'
          dbt-target: 'github_actions'
          model-records-to-write: "all"
          notion-database-name: 'dbt Models'
          notion-parent-id: '604ece5b9dca4cdda449abeabef759e8'
          notion-token: '${{ secrets.DBT_DOCS_TO_NOTION_TOKEN }}'

dbt-docs-to-notion is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Exports dbt model docs to a Notion database
v1.0.2

Tags

 (1)

dbt-docs-to-notion is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.