Skip to content

Instantly share code, notes, and snippets.

@vergenzt
Last active May 13, 2022 16:37
Show Gist options
  • Save vergenzt/9b0cdf564f213745ed6a7d1ca905a700 to your computer and use it in GitHub Desktop.
Save vergenzt/9b0cdf564f213745ed6a7d1ca905a700 to your computer and use it in GitHub Desktop.
!include _header.puml
group #lightblue "Parse phase"
dbt -> project ++: //read all yaml and SQL files//
return
rnote right of dbt #white: Evalute config
rnote right of dbt #white
Evalute ""generate_schema_name""
on all nodes to determine
destination schema(s)
end note
rnote right of dbt #white
Evaluate ""ref"" and ""source""
calls to produce DAG
end note
dbt --> manifest **: //cache in manifest//
end group
!include _header.puml
group #gold "Execute phase"
control "target adapter" as adapter
database "target database" as database
group #lightyellow before_run
group create_schemas
dbt -> manifest : //$required_schemas// = get_model_schemas(//$selected_nodes//)
dbt -> adapter ++ : //$existing_schemas// = list_schemas()
adapter -> database ++ #lightgreen
return
return
loop each //$required_schema// not in //$existing_schemas//
dbt -> adapter ++ : create_schema(//$required_schema//)
adapter -> database ++ #lightgreen: create schema \n if not exists \n //$required_schema//
return
return
end loop
end group
dbt -> adapter : run_hooks(//on-run-start//)
end group
queue "dbt graph queue" as queue
dbt -> manifest : //$selected_nodes// = get_selected_nodes(//$dbt_args//)
dbt -> queue **: initialize(//$selected_nodes//)
group #lightyellow execute_nodes [while queue is not empty]
dbt -> queue ++ : //$node// = get()
rnote over queue #white
find topologically-next
graph node
end note
return
end group
end group
title "Standard dbt run with table / view materialization"
hide footbox
collections "dbt project files" as project
control dbt
entity "dbt manifest" as manifest
@startuml
!include _header.puml
!include 1-parse.puml
!include 2-execute.puml
@enduml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment