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

add 1.5 features - fct_public_models_without_contracts #339

Merged
merged 21 commits into from
Aug 9, 2023

Conversation

dave-connors-3
Copy link
Collaborator

@dave-connors-3 dave-connors-3 commented May 3, 2023

This is a:

  • bug fix PR with no breaking changes
  • new functionality

Link to Issue

This PR is in partial fulfillment of #332

Description & motivation

this PR adds:

  • access
  • contract.enforced
  • latest_version
  • group
  • number of yml cols
  • number of yml cols with description

for models and adds:

  • fct_public_models_without_contracts - outputs each model with access: public and config.contract.enforced: false
  • fct_exposures_dependent_on_private_models - exposure parent that is not a public model
  • fct_undocumented_public_models - outputs each undocumented public model

Integration Test Screenshot

image

Checklist

  • I have verified that these changes work locally on the following warehouses (Note: it's okay if you do not have access to all warehouses, this helps us understand what has been covered)
    • BigQuery
    • Postgres
    • Redshift
    • Snowflake
    • Databricks
    • DuckDB
  • I have updated the README.md (if applicable)
  • I have added tests & descriptions to my models (and macros if applicable)

@dave-connors-3 dave-connors-3 changed the title add 1.5 features to stg_nodes, fct_public_models_without_contracts, docs add 1.5 features - fct_public_models_without_contracts May 4, 2023
@dave-connors-3
Copy link
Collaborator Author

we'll have to wait for dbx to release 1.5, but otherwise ready for review @graciegoheen @b-per !

@b-per
Copy link
Collaborator

b-per commented May 5, 2023

Did you check the docs that get generated? I think that you will need to update the nav config because you added a new page.

Copy link
Collaborator

@b-per b-per left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of changes required for the docs but except that it's all good for me

description: very important OKR reporting model
access: public
config:
materialized: table
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are public models required to be materialized as a table? If so, let's add a note about that. If not, let's remove this from the example because it's a difference between the public model without a contract example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think they are! removed


## Undocumented public models

`fct_undocumented_public_models` ([source](https://github.com/dbt-labs/dbt-project-evaluator/blob/main/models/marts/governance/fct_undocumented_public_models.sql)) shows each model with `access` configured as public that is not fully documented. This check is similar to `fct_undocumented_models` ([source](https://github.com/dbt-labs/dbt-project-evaluator/blob/main/models/marts/documentation/fct_undocumented_models.sql)), but is a stricter check that will highlight any public model that does not have a model-level description as well descriptions on each of its columns.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious the reason to have both this model and fct_undocumented_models? Seems a bit redundant to have both, though this captures documenting at the column level so maybe it's ok for the bit of overlap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's to have a stricter requirement that is called out separately (better signal to noise ratio) and also have details at the column level as you note. It's more important for these models to be documented than it is for a random staging model!


**Example**

`report_1` is defined as a public model, but does not descriptions on the model and each column
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`report_1` is defined as a public model, but does not descriptions on the model and each column
`report_1` is defined as a public model, but does not have descriptions on the model and each column


**How to Remediate**

Edit the yml to include a model level description, as well as a column entry with a description for all columns output by the model. While not strictly required for public models, these should likely also have contracts added as well. (See above rule)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link to the "above" rule (and name it, in case at some point it's no longer "above")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

access: public
config:
materialized: table
contract:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example shows the fix as also adding a contract. I wonder if we could have 2 different examples for these 2 rules so it's clear what needs to be added to remediate this specific issue

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i note in the description that it's not required, but encouraged -- I can remove if we think it's too confusing


## Exposures dependent on private models

`fct_exposures_dependent_on_private_models` ([source](https://github.com/dbt-labs/dbt-project-evaluator/blob/main/models/marts/governance/fct_exposures_dependent_on_private_models.sql)) shows each relationship between a resource and an exposure where the parent resource is not a model with `access` configured as public.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need fct_exposure_parents_materializations or can these be combined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a good question! this one is a bit stricter -- do we think folks not using governance features will get value out of this rule in the absence of the other?


**How to Remediate**

Edit the yml to include fully expose the models that your exposures depend on. This should include `access`, a full model contract, and descriptions at all levels of the model.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, what is the actual rule here? If it's just checking for access... should we also show adding contracts, descriptions, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I updated this description to be more clear. I can remove the extra details if we think they are not helpful

@@ -31,6 +33,8 @@ all_relationships (
child_resource_type,
child_model_type,
child_materialized,
child_access,
child_is_public,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the need for both access and is_public - isn't is_public just if access == 'public'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just to allow for future rules that use access! can remove for now if we don't think it's valuable

@b-per b-per self-requested a review August 9, 2023 14:03
Copy link
Collaborator

@b-per b-per left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥐

@dave-connors-3 dave-connors-3 merged commit 2180997 into main Aug 9, 2023
@dave-connors-3 dave-connors-3 deleted the public-models-have-contracts branch August 9, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants