From c583b3c408232a2fc59719bc2cab904439d1205b Mon Sep 17 00:00:00 2001 From: Benoit Perigaud <8754100+b-per@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:20:42 +0200 Subject: [PATCH] Update docs --- docs/customization/overriding-variables.md | 7 +++++++ ...lumns.md => querying-columns-names-and-descriptions.md} | 6 ++++-- docs/querying-the-dag.md | 2 ++ mkdocs.yml | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) rename docs/customization/{querying-columns.md => querying-columns-names-and-descriptions.md} (74%) diff --git a/docs/customization/overriding-variables.md b/docs/customization/overriding-variables.md index e4e0aa3..41f64b2 100644 --- a/docs/customization/overriding-variables.md +++ b/docs/customization/overriding-variables.md @@ -92,6 +92,13 @@ vars: chained_views_threshold: 8 ``` +## SQL code analysis + +| variable | description | default | +| ----------- | ----------- | ----------- | +| `comment_chars` | a list of strings used for inline comments | `["--"]` | +| `token_costs` | a dictionary of SQL tokens (words) and associated complexity weight,
used to estimate models complexity | see in the `dbt_project.yml` file of the package | + ## Execution | variable | description | default | diff --git a/docs/customization/querying-columns.md b/docs/customization/querying-columns-names-and-descriptions.md similarity index 74% rename from docs/customization/querying-columns.md rename to docs/customization/querying-columns-names-and-descriptions.md index 31289d4..8ba6420 100644 --- a/docs/customization/querying-columns.md +++ b/docs/customization/querying-columns-names-and-descriptions.md @@ -1,6 +1,8 @@ -# Querying columns with SQL +# Querying columns names and descriptions with SQL -The model `stg_columns` ([source](https://github.com/dbt-labs/dbt-project-evaluator/tree/main/models/staging/graph/stg_columns.sql)), created with the package, lists all the columns from all the dbt nodes (models, sources, tests, snapshots) +The model `stg_columns` ([source](https://github.com/dbt-labs/dbt-project-evaluator/tree/main/models/staging/graph/stg_columns.sql)), created with the package, lists all the columns configured in all the dbt nodes (models, sources, tests, snapshots). + +It will not list the columns of the models that have not explicitly been added to the YAML files. You can use this model to help with questions such as: diff --git a/docs/querying-the-dag.md b/docs/querying-the-dag.md index 3865e5d..0efa7b8 100644 --- a/docs/querying-the-dag.md +++ b/docs/querying-the-dag.md @@ -17,6 +17,8 @@ Building additional models and snapshots on top of this model could allow: ## Getting insights on potential refactoring work +- identifying models with a lof of lines of code +- identifying the models with the highest level of complexity leveraging the column `sql_complexity` from the table `int_all_graph_resources`, based on the weights defined in the `token_costs` variable - looking at the longest "chains" of models in a project - reviewing models with many/few direct dependents - identifying potential bottlenecks diff --git a/mkdocs.yml b/mkdocs.yml index 4679af5..a9177b4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -81,7 +81,7 @@ nav: - Configuring exceptions to the rules: customization/exceptions.md - Excluding packages and models/sources based on path: customization/excluding-packages-and-paths.md - Display issues in the logs: customization/issues-in-log.md - - Querying columns: customization/querying-columns.md + - Querying columns names and descriptions: customization/querying-columns-names-and-descriptions.md - Run in CI Check: ci-check.md - Querying the DAG: querying-the-dag.md - Contributing: contributing.md \ No newline at end of file