Skip to content

Commit

Permalink
Merge pull request #5 from FlipsideCrypto/adhoc_launch_fixes
Browse files Browse the repository at this point in the history
Adhoc launch fixes
  • Loading branch information
mrstepanovic authored Oct 16, 2024
2 parents dbf1fbc + 1106f76 commit 1f2ddab
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 54 deletions.
5 changes: 5 additions & 0 deletions models/descriptions/succeeded.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% docs succeeded %}

A boolean value indicating if the event succeeded.

{% enddocs %}
4 changes: 2 additions & 2 deletions models/gold/core/core__fact_blocks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ SELECT
coinbase_target,
cumulative_proof_target,
cumulative_weight,
block_reward,
puzzle_reward,
CASE WHEN block_id = 0 THEN 0 ELSE block_reward END AS block_reward,
CASE WHEN block_id = 0 THEN 0 ELSE puzzle_reward END AS puzzle_reward,
{{ dbt_utils.generate_surrogate_key(['block_id']) }} AS fact_blocks_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
Expand Down
2 changes: 1 addition & 1 deletion models/gold/core/core__fact_blocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ models:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- NETWORK_ID
- NETWORK
- block_id
columns:
- name: block_id
Expand Down
3 changes: 1 addition & 2 deletions models/gold/core/core__fact_transactions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ models:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- STRING
- VARCHAR
- BOOLEAN
- name: TX_TYPE
description: "{{ doc('tx_type') }}"
tests:
Expand Down
5 changes: 0 additions & 5 deletions models/silver/core/silver__blocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ models:
description: "{{ doc('network_id') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- STRING
- VARCHAR
- NUMBER
- name: TX_COUNT
description: "{{ doc('tx_count') }}"
tests:
Expand Down
6 changes: 0 additions & 6 deletions models/silver/core/silver__transactions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@ models:
tests:
- not_null

- name: inner_type
tests:
- not_null

- name: FEE_MSG
description: "{{ doc('fee_msg') }}"
tests:
- not_null

- name: execution_msg

Expand Down
54 changes: 26 additions & 28 deletions models/silver/core/silver__transitions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ rej_trans AS (
t.tx_id,
t.block_timestamp,
FALSE AS succeeded,
f.value: TYPE :: STRING AS TYPE,
'execution' AS TYPE,
f.value AS transition,
f.index AS transition_index
FROM
Expand All @@ -73,30 +73,28 @@ transitions AS (
*
FROM
rej_trans
) {# ,
parsed AS (
#}
SELECT
block_id,
block_timestamp,
tx_id,
INDEX,
transition :id :: STRING AS transition_id,
succeeded,
TYPE,
transition :program :: STRING AS program_id,
transition :function :: STRING AS FUNCTION,
TRY_PARSE_JSON(
transition :inputs
) AS inputs,
TRY_PARSE_JSON(
transition :outputs
) AS outputs,
{{ dbt_utils.generate_surrogate_key(
['tx_id','transition_id']
) }} AS transitions_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS invocation_id
FROM
transitions
)
SELECT
block_id,
block_timestamp,
tx_id,
INDEX,
transition :id :: STRING AS transition_id,
succeeded,
TYPE,
transition :program :: STRING AS program_id,
transition :function :: STRING AS FUNCTION,
TRY_PARSE_JSON(
transition :inputs
) AS inputs,
TRY_PARSE_JSON(
transition :outputs
) AS outputs,
{{ dbt_utils.generate_surrogate_key(
['tx_id','transition_id']
) }} AS transitions_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS invocation_id
FROM
transitions
4 changes: 3 additions & 1 deletion models/silver/core/silver__transitions_fee.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ WITH base AS (
fee_msg :transition AS transition
FROM
{{ ref('silver__transactions') }}
WHERE
fee_msg IS NOT NULL

{% if is_incremental() %}
WHERE
AND
modified_timestamp >= DATEADD(
MINUTE,
-5,(
Expand Down
13 changes: 4 additions & 9 deletions models/silver/core/silver__transitions_fee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ models:
description: "{{ doc('tx_id') }}"
tests:
- not_null
- name: INDEX
description: "{{ doc('program_id') }}"

- name: SUCCEEDED
description: "{{ doc('succeeded') }}"
tests:
- not_null

Expand All @@ -29,16 +29,11 @@ models:
tests:
- not_null
- unique

- name: TYPE
tests:
- not_null

- name: PROGRAM_ID
description: "{{ doc('program_id') }}"
tests:
- not_null

- name: FUNCTION
description: "{{ doc('transition_function') }}"
tests:
Expand All @@ -50,7 +45,7 @@ models:
- name: OUTPUTS
description: "{{ doc('transition_outputs') }}"

- name: TRANSITIONS_ID
- name: TRANSITIONS_FEE_ID
description: "{{ doc('pk') }}"
tests:
- unique
Expand Down

0 comments on commit 1f2ddab

Please sign in to comment.