Skip to content

Commit d4fe7d3

Browse files
committed
tweak a bit more
1 parent 280b0ee commit d4fe7d3

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

warehouse/scripts/dbt_artifacts/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ def gvattrs(self) -> Dict[str, Any]:
178178
and self.catalog_entry.num_bytes > 100_000_000_000 # type: ignore[attr-defined]
179179
)
180180

181-
if self.config.materialized in ("table", "incremental"):
181+
if self.config.materialized == "table":
182182
fillcolor = "darkseagreen"
183+
elif self.config.materialized == "incremental":
184+
fillcolor = "darkseagreen1"
183185

184186
if (
185187
more_than_100gb
+12-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Warehouse report 📦
22

3-
{% if new_models or changed_or_downstream_incremental_models %}
3+
{% if new_models or modified_or_downstream_incremental_models %}
44
### Checks/potential follow-ups
55

66
Checks indicate the following action items may be necessary.
77
{% if new_models -%}
88
- [ ] For new models, do they all have a surrogate primary key that is tested to be not-null and unique?
99
{%- endif %}
10-
{% if changed_or_downstream_incremental_models -%}
10+
{% if modified_or_downstream_incremental_models -%}
1111
- [ ] For modified incremental models (or incremental models whose parents are modified), does the PR description identify whether a full refresh is needed for these tables?
1212
{%- endif %}
1313
{% endif %}
@@ -22,11 +22,11 @@ Checks indicate the following action items may be necessary.
2222
{% endfor %}
2323
{% endif %}
2424

25-
{% if changed_or_downstream_incremental_models %}
25+
{% if modified_or_downstream_incremental_models %}
2626

2727
### Changed incremental models 🔀
2828

29-
{% for model in changed_or_downstream_incremental_models %}
29+
{% for model in modified_or_downstream_incremental_models %}
3030
{{ model }}
3131
{% endfor %}
3232
{% endif %}
@@ -37,11 +37,11 @@ Checks indicate the following action items may be necessary.
3737

3838
Legend (in order of precedence)
3939

40-
| Resource type | Indicator | Resolution |
41-
|------------------------------------------------|-----------|---------------------------------------|
42-
| Large table-materialized model | Orange | Make the model incremental |
43-
| Large model without partitioning or clustering | Orange | Add partitioning and/or clustering |
44-
| View with more than one child | Yellow | Materialize as a table or incremental |
45-
| Incremental | Green | |
46-
| Table | Green | |
47-
| View | White | |
40+
| Resource type | Indicator | Resolution |
41+
|------------------------------------------------|-------------|---------------------------------------|
42+
| Large table-materialized model | Orange | Make the model incremental |
43+
| Large model without partitioning or clustering | Orange | Add partitioning and/or clustering |
44+
| View with more than one child | Yellow | Materialize as a table or incremental |
45+
| Incremental | Light green | |
46+
| Table | Green | |
47+
| View | White | |

warehouse/scripts/visualize.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -262,42 +262,39 @@ def ci_report(
262262
]
263263
).result
264264

265-
changed_or_downstream_incremental_models = dbt.invoke(
265+
modified_models = dbt.invoke(
266266
[
267267
"ls",
268268
"--resource-type",
269269
"model",
270270
"--select",
271-
"state:modified+,config.materialized:incremental",
271+
"state:modified+",
272272
"--exclude",
273273
"state:new",
274274
"--state",
275275
latest_dir,
276276
]
277277
).result
278278

279-
modified_models = dbt.invoke(
279+
modified_or_downstream_incremental_models = dbt.invoke(
280280
[
281281
"ls",
282282
"--resource-type",
283283
"model",
284284
"--select",
285-
"state:modified",
285+
"state:modified+,config.materialized:incremental",
286286
"--exclude",
287287
"state:new",
288288
"--state",
289289
latest_dir,
290290
]
291291
).result
292292

293+
typer.secho(f"Visualizing the following models: {modified_models}")
293294
assert isinstance(modified_models, list)
294-
assert isinstance(changed_or_downstream_incremental_models, list)
295-
include = set(changed_or_downstream_incremental_models + modified_models)
296-
typer.secho(f"Visualizing the following models: {include}")
297-
298295
viz(
299296
ArtifactType.manifest,
300-
include=list(include),
297+
include=modified_models,
301298
output=Path("./target/dag.png"),
302299
)
303300

@@ -308,7 +305,7 @@ def ci_report(
308305
template = env.get_template("ci_report.md")
309306
report = template.render(
310307
new_models=new_models,
311-
changed_or_downstream_incremental_models=changed_or_downstream_incremental_models,
308+
modified_or_downstream_incremental_models=modified_or_downstream_incremental_models,
312309
)
313310
typer.secho(f"Writing to {output}", fg=typer.colors.GREEN)
314311
with open(output, "w") as f:

0 commit comments

Comments
 (0)