Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for node_color #4492

Closed
1 task done
dbeatty10 opened this issue Nov 16, 2023 · 5 comments · Fixed by #4493
Closed
1 task done

Update docs for node_color #4492

dbeatty10 opened this issue Nov 16, 2023 · 5 comments · Fixed by #4493
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented Nov 16, 2023

Contributions

  • I have read the contribution docs, and understand what's expected of me.

Link to the page on docs.getdbt.com requiring updates

https://docs.getdbt.com/reference/resource-configs/docs

What part(s) of the page would you like to see updated?

Two things:

  1. Expand code examples across all applicable node types
  2. (Option) Consider more explicit language of which node types support node_color (or not)

More explanation

Only the model node type includes node_color within its general code example:

image

And elsewhere, it only says "some node types" rather than being explicit about which support "node_color" and which don't:

image

Additional information

node_color was added within dbt-labs/dbt-core#5397

See dbt-labs/dbt-core#8061 (comment) for an adjacent issue.

@dbeatty10 dbeatty10 added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear labels Nov 16, 2023
@mirnawong1
Copy link
Contributor

mirnawong1 commented Nov 16, 2023

hey @dbeatty10 , does this mean that only models support node_color? everywhere I've looked, it seems like the only node type that supports node_color is models?

@mirnawong1
Copy link
Contributor

hey @dbeatty10 , i've created this pr here https://github.com/dbt-labs/docs.getdbt.com/pull/4493/files to address this but i'll add more to it once you have a chance to review this issue.

@mirnawong1
Copy link
Contributor

following up

@dbeatty10
Copy link
Contributor Author

@mirnawong1 I don't know either way if there are node types besides models that support the node_color. One way to determine one way or another is to try it with a bunch of node types and see if it affects the display of the auto-generated documentation site or not.

i.e., try it with seeds, sources, snapshots, and analyses and see what happens.

@dbeatty10
Copy link
Contributor Author

dbeatty10 commented Jan 8, 2024

i.e., try it with seeds, sources, snapshots, and analyses and see what happens.

I just tried this out, and the ones in purple are the ones that worked:

image

So these ones worked:

  • model
  • seed
  • analysis
  • snapshot

But these did not:

  • source
  • semantic model
  • metric
  • exposure

Reprex

models/_properties.yml

version: 2


models:
  - name: my_model
    docs:
      show: true
      node_color: "purple"
    columns:
      - name: id
        tests:
          - not_null

sources:
  - name: my_source
    tables:
      - name: my_source_table

seeds:
  - name: my_seed
    docs:
      show: true
      node_color: "purple"

snapshots:
  - name: my_snapshot
    docs:
      show: true
      node_color: "purple"

analyses:
  - name: my_analysis
    docs:
      show: true
      node_color: "purple"

exposures:
  - name: my_exposure
    label: my_exposure
    type: dashboard
    maturity: high
    url: https://bi.tool/dashboards/1

    depends_on:
      - ref('my_model')
      - ref('my_seed')
      - ref('my_snapshot')

    owner:
      name: Callum McData
      email: [email protected]

metrics:
  - name: my_metric
    label: my_metric
    type: derived
    type_params:
      expr: revenue - cost

semantic_models:
  - name: my_semantic_model
    model: ref('metricflow_time_spine')

# See: https://github.com/dbt-labs/dbt-docs/issues/486

# saved_queries:
#   - name: p0_booking
#     description: Booking-related metrics that are of the highest priority.
#     query_params:
#       metrics:
#         - my_metric
cat models/my_model.sql seeds/my_seed.csv snapshots/my_snapshot.sql analyses/my_analysis.sql | pbcopy

models/my_model.sql

-- {{ source("my_source", "my_source_table") }}
select 1 as id

seeds/my_seed.csv

id
1

snapshots/my_snapshot.sql

{% snapshot my_snapshot %}

{{
    config(
      target_database=target.database,
      target_schema=target.schema,
      unique_key='id',
      strategy='check',
      check_cols='all',
    )
}}

select 1 as id

{% endsnapshot %}

analyses/my_analysis.sql

select 1 as id from {{ source("my_source", "my_source_table") }}

models/metricflow_time_spine.sql

-- https://docs.getdbt.com/docs/build/metricflow-time-spine

{{ config(materialized='table') }}

with days as (

    {{
        dbt.date_spine(
            'day',
            "to_date('2000-01-01', 'YYYY-MM-DD')",
            "to_date('2000-01-05', 'YYYY-MM-DD')"
        )
    }}

),

final as (
    select cast(date_day as date) as date_day
    from days
)

select * from final

models/my_test_model.sql

select 1 as id

models/_unit.yml

unit_tests:

  - name: my_unit_test
    given: []
    model: my_test_model
    expect:
      rows:
        - {id: 1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants