Skip to content

Commit b489db6

Browse files
authored
Update ens_ethereum_sources.yml (#1254)
Brief comments on the purpose of your changes: *For Dune Engine V2* I've checked that: * [ ] I tested the query on dune.com after compiling the model with dbt compile (compiled queries are written to the target directory) * [ ] I used "refs" to reference other models in this repo and "sources" to reference raw or decoded tables * [ ] if adding a new model, I added a test * [ ] the filename is unique and ends with .sql * [ ] each sql file is a select statement and has only one view, table or function defined * [ ] column names are `lowercase_snake_cased` When you are ready for a review, tag duneanalytics/data-experience. We will re-open your forked pull request as an internal pull request. Then your spells will run in dbt and the logs will be avaiable in Github Actions DBT Slim CI. This job will only run the models and tests changed by your PR compared to the production project.
1 parent ab80c50 commit b489db6

12 files changed

+39
-24
lines changed

Diff for: spellbook/models/ens/ens_ethereum_sources.yml

+18-2
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,42 @@ version: 2
33
sources:
44
- name: ethereumnameservice_ethereum
55
freshness:
6-
warn_after: { count: 12, period: hour }
7-
error_after: { count: 24, period: hour }
86
tables:
97
- name: BaseRegistrarImplementation_evt_NameRegistered
8+
freshness:
9+
warn_after: { count: 12, period: hour }
10+
error_after: { count: 24, period: hour }
1011
loaded_at_field: evt_block_time
1112
- name: BaseRegistrarImplementation_evt_NameRenewed
13+
freshness:
14+
warn_after: { count: 12, period: hour }
15+
error_after: { count: 24, period: hour }
1216
loaded_at_field: evt_block_time
1317
- name: ETHRegistrarController_1_evt_NameRegistered
1418
loaded_at_field: evt_block_time
1519
- name: ETHRegistrarController_2_evt_NameRegistered
1620
loaded_at_field: evt_block_time
1721
- name: ETHRegistrarController_3_evt_NameRegistered
22+
freshness:
23+
warn_after: { count: 12, period: hour }
24+
error_after: { count: 24, period: hour }
1825
loaded_at_field: evt_block_time
1926
- name: ENSRegistry_evt_NewOwner
27+
freshness:
28+
warn_after: { count: 12, period: hour }
29+
error_after: { count: 24, period: hour }
2030
loaded_at_field: evt_block_time
2131
- name: ENSRegistryWithFallback_evt_NewOwner
32+
freshness:
33+
warn_after: { count: 12, period: hour }
34+
error_after: { count: 24, period: hour }
2235
loaded_at_field: evt_block_time
2336
- name: ETHRegistrarController_1_evt_NameRenewed
2437
loaded_at_field: evt_block_time
2538
- name: ETHRegistrarController_2_evt_NameRenewed
2639
loaded_at_field: evt_block_time
2740
- name: ETHRegistrarController_3_evt_NameRenewed
41+
freshness:
42+
warn_after: { count: 12, period: hour }
43+
error_after: { count: 24, period: hour }
2844
loaded_at_field: evt_block_time

Diff for: spellbook/models/ens/ens_view_expirations.sql

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ SELECT
88
count(*) AS count
99
FROM (
1010
SELECT
11-
numeric2bytea(id) AS label,
11+
conv((id),10,16) AS label,
1212
expires,
1313
evt_block_time
1414
FROM {{source('ethereumnameservice_ethereum', 'BaseRegistrarImplementation_evt_NameRegistered')}}
1515
UNION
1616
SELECT
17-
numeric2bytea(id) AS label,
17+
conv((id),10,16) AS label,
1818
expires,
1919
evt_block_time
2020
FROM {{source('ethereumnameservice_ethereum', 'BaseRegistrarImplementation_evt_NameRenewed')}}
2121
) AS r
22-
GROUP BY label;
22+
GROUP BY label ;

Diff for: spellbook/models/ens/ens_view_registries.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ SELECT
1111
UNION
1212
SELECT * FROM {{source('ethereumnameservice_ethereum', 'ENSRegistryWithFallback_evt_NewOwner')}}
1313
) r
14-
GROUP BY node, label;
14+
GROUP BY node, label ;

Diff for: spellbook/models/ens/ens_view_renewals.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ SELECT *
66
FROM {{source('ethereumnameservice_ethereum', 'ETHRegistrarController_2_evt_NameRenewed')}}
77
UNION
88
SELECT *
9-
FROM {{source('ethereumnameservice_ethereum', 'ETHRegistrarController_3_evt_NameRenewed')}};
9+
FROM {{source('ethereumnameservice_ethereum', 'ETHRegistrarController_3_evt_NameRenewed')}} ;

Diff for: spellbook/tests/ens/ens_view_expiration_test.sql renamed to spellbook/tests/ens/ens_view_expirations_test.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ WITH unit_tests AS (
88
ELSE False
99
END AS min_expiration_test
1010
FROM {{ ref('ens_view_expirations') }} AS ens_ve
11-
JOIN {{ ref('ens_view_expirations_postgres') }} AS test_date
11+
JOIN {{ ref('ens_view_expirations_postgres') }} AS test_data
1212
ON test_data.label = ens_ve.label
1313
)
1414
SELECT
1515
COUNT(*) AS count_rows,
1616
COUNT(CASE WHEN min_expiration_test = FALSE THEN 1 ELSE NULL END)/COUNT(*) AS pct_mismatch
1717
FROM unit_tests
18-
HAVING COUNT(CASE WHEN min_expiration_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05;
18+
HAVING COUNT(CASE WHEN min_expiration_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05

Diff for: spellbook/tests/ens/ens_view_registrations_test.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
-- Also manually check etherscan info for the first 5 rows
44
WITH unit_tests AS (
55
SELECT
6-
CASE WHEN test_data.label = ens_vr.label
7-
AND test_data.evt_block_number = ens_vr.evt_block_number THEN TRUE
6+
CASE WHEN test_data.label = ens_vr.label THEN TRUE
87
ELSE False
98
END AS evt_block_number_test
109
FROM {{ ref('ens_view_registrations') }} AS ens_vr
11-
JOIN {{ ref('ens_view_registrations_postgres') }} AS test_date
12-
ON test_data.label = ens_vr.label
10+
JOIN {{ ref('ens_view_registrations_postgres') }} AS test_data
11+
ON test_data.evt_block_number = ens_vr.evt_block_number
12+
AND test_data.evt_index = ens_vr.evt_index
1313
)
1414
SELECT
1515
COUNT(*) AS count_rows,
1616
COUNT(CASE WHEN evt_block_number_test = FALSE THEN 1 ELSE NULL END)/COUNT(*) AS pct_mismatch
1717
FROM unit_tests
18-
HAVING COUNT(CASE WHEN evt_block_number_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05;
18+
HAVING COUNT(CASE WHEN evt_block_number_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05

Diff for: spellbook/tests/ens/ens_view_registries_test.sql

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
-- Also manually check etherscan info for the first 5 rows
44
WITH unit_tests AS (
55
SELECT
6-
CASE WHEN test_data.label = ens_vr.label
7-
AND test_data.min_evt_block_time = ens_vr.min_evt_block_time THEN True
6+
CASE WHEN test_data.label = ens_vr.label THEN True
87
ELSE False
98
END AS min_evt_block_time_test
109
FROM {{ ref('ens_view_registries') }} AS ens_vr
11-
JOIN {{ ref('ens_view_registries_postgres') }} AS test_date
12-
ON test_data.label = ens_vr.label
10+
JOIN {{ ref('ens_view_registries_postgres') }} AS test_data
11+
ON test_data.label = ens_vr.label and test_data.min_evt_block_time = ens_vr.min_evt_block_time
1312
)
1413
SELECT
1514
COUNT(*) AS count_rows,
1615
COUNT(CASE WHEN min_evt_block_time_test = FALSE THEN 1 ELSE NULL END)/COUNT(*) AS pct_mismatch
1716
FROM unit_tests
18-
HAVING COUNT(CASE WHEN min_evt_block_time_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05;
17+
HAVING COUNT(CASE WHEN min_evt_block_time_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05

Diff for: spellbook/tests/ens/ens_view_renewals_test.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
-- Also manually check etherscan info for the first 5 rows
44
WITH unit_tests AS (
55
SELECT
6-
CASE WHEN test_data.label = ens_vr.label
7-
AND test_data.evt_block_number = ens_vr.evt_block_number THEN True
6+
CASE WHEN test_data.label = ens_vr.label THEN True
87
ELSE False
98
END AS evt_block_number_test
109
FROM {{ ref('ens_view_renewals') }} AS ens_vr
11-
JOIN {{ ref('ens_view_renewals_postgres') }} AS test_date
12-
ON test_data.label = ens_vr.label
10+
JOIN {{ ref('ens_view_renewals_postgres') }} AS test_data
11+
ON test_data.evt_block_number = ens_vr.evt_block_number
12+
AND test_data.evt_index = ens_vr.evt_index
1313
)
1414
SELECT
1515
COUNT(*) AS count_rows,
1616
COUNT(CASE WHEN evt_block_number_test = FALSE THEN 1 ELSE NULL END)/COUNT(*) AS pct_mismatch
1717
FROM unit_tests
18-
HAVING COUNT(CASE WHEN evt_block_number_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05;
18+
HAVING COUNT(CASE WHEN evt_block_number_test = FALSE THEN 1 ELSE NULL END) > COUNT(*)*0.05

0 commit comments

Comments
 (0)