diff --git a/models/silver/actions/README.md b/models/silver/actions/README.md deleted file mode 100644 index 4913a3a..0000000 --- a/models/silver/actions/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# 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). diff --git a/models/silver/actions/silver__actions_events_addkey_s3.sql b/models/silver/actions/silver__actions_events_addkey_s3.sql deleted file mode 100644 index f318104..0000000 --- a/models/silver/actions/silver__actions_events_addkey_s3.sql +++ /dev/null @@ -1,63 +0,0 @@ --- 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'], - enabled = true -) }} - -{# 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 diff --git a/models/silver/actions/silver__actions_events_function_call_s3.sql b/models/silver/actions/silver__actions_events_function_call_s3.sql deleted file mode 100644 index 5d47fab..0000000 --- a/models/silver/actions/silver__actions_events_function_call_s3.sql +++ /dev/null @@ -1,83 +0,0 @@ --- TODO slated for deprecation and drop --- Note - must migrate curated to new ez_actions first - -{{ config( - materialized = 'incremental', - incremental_strategy = 'merge', - incremental_predicates = ["dynamic_range_predicate_custom","block_timestamp::date"], - merge_exclude_columns = ["inserted_timestamp"], - cluster_by = ['block_timestamp::DATE', 'modified_timestamp::DATE'], - unique_key = 'action_id', - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(action_id,tx_hash,receiver_id,predecessor_id,signer_id,method_name);", - tags = ['actions', 'curated','scheduled_core', 'grail'], - enabled = true -) }} --- todo deprecate this model -WITH action_events AS ( - - SELECT - action_id, - tx_hash, - receiver_id, - predecessor_id, - signer_id, - block_id, - block_timestamp, - action_name, - action_data, - logs, - receipt_succeeded, - _partition_by_block_number, - _inserted_timestamp - FROM - {{ ref('silver__actions_events_s3') }} - WHERE - action_name = 'FunctionCall' - - {% if var("MANUAL_FIX") %} - AND {{ partition_load_manual('no_buffer') }} - {% else %} -{% if is_incremental() %} -AND modified_timestamp >= ( - SELECT - MAX(modified_timestamp) - FROM - {{ this }} -) -{% endif %} -{% endif %} -), -FINAL AS ( - SELECT - action_id, - tx_hash, - receiver_id, - predecessor_id, - signer_id, - block_id, - block_timestamp, - action_name, - action_data :method_name :: STRING AS method_name, - COALESCE( - TRY_PARSE_JSON(TRY_BASE64_DECODE_STRING(action_data :args)), - action_data :args - ) AS args, - action_data :deposit :: NUMBER AS deposit, - action_data :gas :: NUMBER AS attached_gas, - logs, - receipt_succeeded, - _partition_by_block_number, - _inserted_timestamp - FROM - action_events -) -SELECT - *, - {{ dbt_utils.generate_surrogate_key( - ['action_id'] - ) }} AS actions_events_function_call_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - FINAL diff --git a/models/silver/actions/silver__actions_events_s3.sql b/models/silver/actions/silver__actions_events_s3.sql deleted file mode 100644 index 3c59f44..0000000 --- a/models/silver/actions/silver__actions_events_s3.sql +++ /dev/null @@ -1,113 +0,0 @@ --- TODO slated for deprecation and drop --- Note - must migrate curated to new ez_actions first -{{ config( - materialized = 'incremental', - incremental_strategy = 'merge', - merge_exclude_columns = ["inserted_timestamp"], - incremental_predicates = ["dynamic_range_predicate_custom","block_timestamp::date"], - cluster_by = ['block_timestamp::DATE', 'modified_timestamp::DATE'], - unique_key = 'action_id', - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash,signer_id,receipt_object_id,receiver_id);", - tags = ['actions', 'curated','scheduled_core', 'grail'], - enabled = true -) }} --- todo deprecate this model -WITH receipts AS ( - - SELECT - tx_hash, - receipt_id AS receipt_object_id, - receiver_id, - receipt_json :receipt :Action :signer_id :: STRING AS signer_id, - block_id, - block_timestamp, - chunk_hash, - outcome_json :outcome :logs :: ARRAY AS logs, - receipt_json AS receipt_actions, - outcome_json AS execution_outcome, - receipt_succeeded, - outcome_json :outcome :gas_burnt :: NUMBER AS gas_burnt, - _partition_by_block_number - FROM - {{ ref('silver__receipts_final') }} - - {% if var("MANUAL_FIX") %} - WHERE - {{ partition_load_manual('no_buffer') }} - {% else %} - {% if is_incremental() %} - WHERE modified_timestamp >= ( - SELECT - MAX(modified_timestamp) - FROM - {{ this }} - ) - {% endif %} - {% endif %} -), -flatten_actions AS ( - SELECT - tx_hash, - receipt_object_id, - receiver_id, - signer_id, - block_id, - block_timestamp, - chunk_hash, - logs, - receipt_actions, - receipt_actions :predecessor_id :: STRING AS predecessor_id, - receipt_actions :receipt :Action :gas_price :: NUMBER AS gas_price, - execution_outcome, - gas_burnt, - execution_outcome :outcome :tokens_burnt :: NUMBER AS tokens_burnt, - VALUE AS action_object, - INDEX AS action_index, - receipt_succeeded, - _partition_by_block_number - FROM - receipts, - LATERAL FLATTEN( - input => receipt_actions :receipt :Action :actions :: ARRAY - ) -), -FINAL AS ( - SELECT - concat_ws( - '-', - receipt_object_id, - action_index - ) AS action_id, - block_id, - block_timestamp, - tx_hash, - receipt_object_id, - chunk_hash, - predecessor_id, - receiver_id, - signer_id, - action_index, - key AS action_name, - TRY_PARSE_JSON(VALUE) AS action_data, - logs, - receipt_succeeded, - gas_price, - gas_burnt, - tokens_burnt, - _partition_by_block_number - FROM - flatten_actions, - LATERAL FLATTEN( - input => action_object - ) -) -SELECT - *, - {{ dbt_utils.generate_surrogate_key( - ['receipt_object_id', 'action_index'] - ) }} AS actions_events_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - FINAL