AN-2168/Add network (#65)

* net data

* add version
This commit is contained in:
Jack Forgash 2022-09-19 15:48:12 -06:00 committed by GitHub
parent 1d89e84073
commit ee7efe3851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 1 deletions

View File

@ -0,0 +1,26 @@
root_height,network_version
1065711,candidate-04
2033592,candidate-05
3187931,candidate-06
4132133,candidate-07
4972987,candidate-08
6483246,candidate-09
7601063,mainnet-01
8742959,mainnet-02
9737133,mainnet-03
9992020,mainnet-04
12020337,mainnet-05
12609237,mainnet-06
13404174,mainnet-07
13950742,mainnet-08
14892104,mainnet-09
15791891,mainnet-10
16755602,mainnet-11
17544523,mainnet-12
18587478,mainnet-13
19050753,mainnet-14
21291692,mainnet-15
23830813,mainnet-16
27341470,mainnet-17
31735955,mainnet-18
35858811,mainnet-19
1 root_height network_version
2 1065711 candidate-04
3 2033592 candidate-05
4 3187931 candidate-06
5 4132133 candidate-07
6 4972987 candidate-08
7 6483246 candidate-09
8 7601063 mainnet-01
9 8742959 mainnet-02
10 9737133 mainnet-03
11 9992020 mainnet-04
12 12020337 mainnet-05
13 12609237 mainnet-06
14 13404174 mainnet-07
15 13950742 mainnet-08
16 14892104 mainnet-09
17 15791891 mainnet-10
18 16755602 mainnet-11
19 17544523 mainnet-12
20 18587478 mainnet-13
21 19050753 mainnet-14
22 21291692 mainnet-15
23 23830813 mainnet-16
24 27341470 mainnet-17
25 31735955 mainnet-18
26 35858811 mainnet-19

View File

@ -16,6 +16,7 @@ gold_blocks AS (
block_height,
block_timestamp,
network,
network_version,
chain_id,
tx_count,
id,

View File

@ -39,6 +39,15 @@ models:
- STRING
- VARCHAR
- name: NETWORK_VERSION
description: "{{ doc('network_version') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- STRING
- VARCHAR
- name: CHAIN_ID
description: "{{ doc('chain_id') }}"
tests:

View File

@ -0,0 +1,5 @@
{% docs network_version %}
The version of the Blockchain that cooresponds with the block height. For more information on Flow's network upgrades (Sporks), see https://developers.flow.com/nodes/node-operation/spork
{% enddocs %}

View File

@ -49,8 +49,36 @@ silver_blocks AS (
_inserted_timestamp
FROM
bronze_blocks
),
network_version AS (
SELECT
root_height,
network_version,
COALESCE(LAG(root_height) over (
ORDER BY
network_version DESC) - 1, 'inf' :: FLOAT) AS end_height
FROM
{{ ref('seeds__network_version') }}
),
add_version AS (
SELECT
block_height,
block_timestamp,
network,
v.network_version,
chain_id,
tx_count,
id,
parent_id,
_ingested_at,
_inserted_timestamp
FROM
silver_blocks b
LEFT JOIN network_version v
ON b.block_height BETWEEN v.root_height
AND v.end_height
)
SELECT
*
FROM
silver_blocks
add_version

View File

@ -39,6 +39,15 @@ models:
- STRING
- VARCHAR
- name: network_version
description: "{{ doc('network_version') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- STRING
- VARCHAR
- name: chain_id
description: "{{ doc('chain_id') }}"
tests: