-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from tailsdotcom/build_speed
Improve build speed and add dim_dbt__models
- Loading branch information
Showing
5 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{ config( materialized='incremental', unique_key='manifest_model_id' ) }} | ||
|
||
with dbt_models as ( | ||
|
||
select * from {{ ref('stg_dbt__models') }} | ||
|
||
), | ||
|
||
dbt_models_incremental as ( | ||
|
||
select * | ||
from dbt_models | ||
|
||
{% if is_incremental() %} | ||
-- this filter will only be applied on an incremental run | ||
where artifact_generated_at > (select max(artifact_generated_at) from {{ this }}) | ||
{% endif %} | ||
|
||
), | ||
|
||
fields as ( | ||
|
||
select | ||
manifest_model_id, | ||
command_invocation_id, | ||
artifact_generated_at, | ||
node_id, | ||
name, | ||
model_schema, | ||
depends_on_nodes, | ||
package_name, | ||
model_path, | ||
checksum, | ||
model_materialization | ||
from dbt_models_incremental | ||
|
||
) | ||
|
||
select * from fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{{ config( materialized='incremental', unique_key='model_execution_id' ) }} | ||
|
||
with model_executions as ( | ||
|
||
select * | ||
from {{ ref('stg_dbt__model_executions') }} | ||
|
||
), | ||
|
||
model_executions_incremental as ( | ||
|
||
select * | ||
from model_executions | ||
|
||
{% if is_incremental() %} | ||
-- this filter will only be applied on an incremental run | ||
where artifact_generated_at > (select max(artifact_generated_at) from {{ this }}) | ||
{% endif %} | ||
|
||
), | ||
|
||
fields as ( | ||
|
||
select | ||
model_execution_id, | ||
command_invocation_id, | ||
artifact_generated_at, | ||
was_full_refresh, | ||
node_id, | ||
thread_id, | ||
status, | ||
compile_started_at, | ||
query_completed_at, | ||
total_node_runtime, | ||
rows_affected | ||
from model_executions_incremental | ||
|
||
) | ||
|
||
select * from fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters