-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add raw application and category tables
- Loading branch information
1 parent
68e9d90
commit 01be16e
Showing
6 changed files
with
79 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
select distinct namespace as namespace from {{ ref("dim_dune_contracts_post_sigma") }} | ||
select | ||
namespace, | ||
max(last_updated) as last_updated | ||
from {{ ref("dim_dune_contracts_post_sigma") }} | ||
group by namespace |
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
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,25 @@ | ||
{{ | ||
config( | ||
materialized="incremental", | ||
unique_key=["application", "source"], | ||
incremental_strategy="merge", | ||
) | ||
}} | ||
|
||
-- there are technically two more tables: | ||
-- dim_new_apps_post_sigma and dim_apps_post_sigma | ||
-- but they can be handled later | ||
with unioned_table as ( | ||
SELECT namespace as application, 'dune' AS source, last_updated | ||
FROM {{ ref("dim_dune_namespaces") }} where namespace is not null | ||
UNION | ||
SELECT namespace as application, 'sui' AS source, last_updated | ||
FROM {{ ref("dim_sui_namespaces") }} where namespace is not null | ||
UNION | ||
SELECT namespace as application, 'flipside' AS source, last_updated | ||
FROM {{ ref("dim_flipside_namespaces") }} where namespace is not null | ||
) | ||
select * from unioned_table | ||
{% if is_incremental() %} | ||
where last_updated > (SELECT MAX(last_updated) FROM {{ this }}) | ||
{% endif %} |
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,22 @@ | ||
{{ | ||
config( | ||
materialized="incremental", | ||
unique_key=["category", "sub_category", "source"], | ||
incremental_strategy="merge", | ||
) | ||
}} | ||
|
||
-- there are technically two more tables: | ||
-- dim_new_apps_post_sigma and dim_apps_post_sigma | ||
-- but they can be handled later | ||
with unioned_table as ( | ||
SELECT category, sub_category, 'sui' AS source, last_updated | ||
FROM {{ ref("dim_sui_namespaces") }} where namespace is not null | ||
UNION | ||
SELECT category, sub_category, 'flipside' AS source, last_updated | ||
FROM {{ ref("dim_flipside_namespaces") }} where namespace is not null | ||
) | ||
select * from unioned_table | ||
{% if is_incremental() %} | ||
where last_updated > (SELECT MAX(last_updated) FROM {{ this }}) | ||
{% endif %} |
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