mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 14:11:54 +00:00
retain legacy actions FOR NOW
This commit is contained in:
parent
6497f42a7d
commit
ccec7e7ec5
4
models/silver/actions/README.md
Normal file
4
models/silver/actions/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Deprecating Actions Models
|
||||
|
||||
All 3 of these models will be deprecated and dropped.
|
||||
There are a number of silver models that need to be migrated to core.ez_actions. Migrate those by EOM (March 2025).
|
||||
62
models/silver/actions/silver__actions_events_addkey_s3.sql
Normal file
62
models/silver/actions/silver__actions_events_addkey_s3.sql
Normal file
@ -0,0 +1,62 @@
|
||||
-- TODO slated for deprecation and drop
|
||||
-- Note - a model in Social does use this
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_predicates = ["COALESCE(DBT_INTERNAL_DEST.block_timestamp::DATE,'2099-12-31') >= (select min(block_timestamp::DATE) from " ~ generate_tmp_view_name(this) ~ ")"],
|
||||
incremental_strategy = 'merge',
|
||||
merge_exclude_columns = ["inserted_timestamp"],
|
||||
unique_key = 'action_id',
|
||||
cluster_by = ['block_timestamp::DATE', 'modified_timestamp::DATE'],
|
||||
tags = ['actions', 'curated','scheduled_non_core']
|
||||
) }}
|
||||
|
||||
{# NOTE - used downstream in Social models, no longer a gold view on just this #}
|
||||
-- todo deprecate this model
|
||||
|
||||
WITH action_events AS (
|
||||
|
||||
SELECT
|
||||
action_id,
|
||||
tx_hash,
|
||||
block_id,
|
||||
block_timestamp,
|
||||
action_data,
|
||||
_partition_by_block_number,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__actions_events_s3') }}
|
||||
WHERE
|
||||
action_name = 'AddKey'
|
||||
{% if var("MANUAL_FIX") %}
|
||||
AND {{ partition_load_manual('no_buffer') }}
|
||||
{% else %}
|
||||
AND {{ incremental_load_filter('modified_timestamp') }}
|
||||
{% endif %}
|
||||
),
|
||||
addkey_events AS (
|
||||
SELECT
|
||||
action_id,
|
||||
tx_hash,
|
||||
block_id,
|
||||
block_timestamp,
|
||||
action_data :access_key :nonce :: NUMBER AS nonce,
|
||||
action_data :public_key :: STRING AS public_key,
|
||||
action_data :access_key :permission AS permission,
|
||||
action_data :access_key :permission :FunctionCall :allowance :: FLOAT AS allowance,
|
||||
action_data :access_key :permission :FunctionCall :method_names :: ARRAY AS method_name,
|
||||
action_data :access_key :permission :FunctionCall :receiver_id :: STRING AS receiver_id,
|
||||
_partition_by_block_number,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
action_events
|
||||
)
|
||||
SELECT
|
||||
*,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['action_id']
|
||||
) }} AS actions_events_addkey_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
addkey_events
|
||||
@ -15,21 +15,20 @@ WITH receipts AS (
|
||||
|
||||
SELECT
|
||||
tx_hash,
|
||||
receipt_object_id,
|
||||
receipt_id AS receipt_object_id,
|
||||
receiver_id,
|
||||
signer_id,
|
||||
predecessor_id AS signer_id,
|
||||
block_id,
|
||||
block_timestamp,
|
||||
chunk_hash,
|
||||
logs,
|
||||
receipt_actions,
|
||||
execution_outcome,
|
||||
outcome_json :outcome :logs :: ARRAY AS logs,
|
||||
receipt_json AS receipt_actions,
|
||||
outcome_json AS execution_outcome,
|
||||
receipt_succeeded,
|
||||
gas_burnt,
|
||||
_partition_by_block_number,
|
||||
_inserted_timestamp
|
||||
outcome_json :outcome :gas_burnt :: NUMBER AS gas_burnt,
|
||||
_partition_by_block_number
|
||||
FROM
|
||||
{{ ref('silver__streamline_receipts_final') }}
|
||||
{{ ref('silver__receipts_final') }}
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
WHERE
|
||||
@ -64,12 +63,11 @@ flatten_actions AS (
|
||||
VALUE AS action_object,
|
||||
INDEX AS action_index,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number,
|
||||
_inserted_timestamp
|
||||
_partition_by_block_number
|
||||
FROM
|
||||
receipts,
|
||||
LATERAL FLATTEN(
|
||||
input => receipt_actions :receipt :Action :actions
|
||||
input => receipt_actions :receipt :Action :actions :: ARRAY
|
||||
)
|
||||
),
|
||||
FINAL AS (
|
||||
@ -95,8 +93,7 @@ FINAL AS (
|
||||
gas_price,
|
||||
gas_burnt,
|
||||
tokens_burnt,
|
||||
_partition_by_block_number,
|
||||
_inserted_timestamp
|
||||
_partition_by_block_number
|
||||
FROM
|
||||
flatten_actions,
|
||||
LATERAL FLATTEN(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user