diff --git a/macros/streamline/create_udf_get_chainhead.sql b/macros/streamline/create_udf_get_chainhead.sql deleted file mode 100644 index 89fe1bc..0000000 --- a/macros/streamline/create_udf_get_chainhead.sql +++ /dev/null @@ -1,30 +0,0 @@ --- todo, what if we receive a bad response? --- ask for backend deployment? -{% macro create_UDF_GET_CHAINHEAD() %} - {% set sql %} - CREATE - OR REPLACE FUNCTION {{ target.database }}.STREAMLINE.UDF_GET_CHAINHEAD( - ) returns INTEGER - AS $$ - SELECT - {{ target.database }}.live.udf_api( - 'POST', - '{Service}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json' - ), - OBJECT_CONSTRUCT( - 'jsonrpc', '2.0', - 'id', 'Flipside/getChainhead/0.1', - 'method', 'status', - 'params', OBJECT_CONSTRUCT( - 'finality', 'final' - ) - ), - 'Vault/prod/near/quicknode/mainnet' - ) :data :result :sync_info :latest_block_height :: INT AS block_id - - $$ - {% endset %} - {% do run_query(sql) %} -{% endmacro %} diff --git a/models/silver/core/lake/README.md b/models/silver/core/lake/README.md new file mode 100644 index 0000000..8d83d50 --- /dev/null +++ b/models/silver/core/lake/README.md @@ -0,0 +1,7 @@ +# Near Lake Silver Models + +The models in this directory were used to ingest and process the blocks and shards from the Near Lake Indexer. + +They are being deprecated as of February 2025 in favor of Streamline 2. + +Todo - around 30-60 days after the migration, these models will be deleted and the associated tables likely dropped from Snowflake. diff --git a/models/silver/core/silver__blocks_v2.sql b/models/silver/core/silver__blocks_v2.sql index 9ab4a82..e2e4426 100644 --- a/models/silver/core/silver__blocks_v2.sql +++ b/models/silver/core/silver__blocks_v2.sql @@ -3,7 +3,7 @@ {{ config ( materialized = "incremental", incremental_strategy = 'merge', - incremental_predicates = ["DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE-7 ) from " ~ generate_tmp_view_name(this) ~ ")"], + incremental_predicates = ["DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from " ~ generate_tmp_view_name(this) ~ ")"], unique_key = "block_hash", cluster_by = ['modified_timestamp::DATE','partition_key'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_hash)", diff --git a/models/silver/core/silver__chunks_v2.sql b/models/silver/core/silver__chunks_v2.sql index 97b5a3d..d604aa6 100644 --- a/models/silver/core/silver__chunks_v2.sql +++ b/models/silver/core/silver__chunks_v2.sql @@ -3,7 +3,7 @@ {{ config ( materialized = "incremental", incremental_strategy = 'merge', - incremental_predicates = ["DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE-7 ) from " ~ generate_tmp_view_name(this) ~ ")"], + incremental_predicates = ["DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from " ~ generate_tmp_view_name(this) ~ ")"], unique_key = "chunk_hash", cluster_by = ['modified_timestamp::DATE','partition_key'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(chunk_hash)", diff --git a/models/silver/core/silver__transactions_v2.sql b/models/silver/core/silver__transactions_v2.sql index 641f274..2f96f91 100644 --- a/models/silver/core/silver__transactions_v2.sql +++ b/models/silver/core/silver__transactions_v2.sql @@ -3,7 +3,7 @@ {{ config ( materialized = "incremental", incremental_strategy = 'merge', - incremental_predicates = ["DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE-7 ) from " ~ generate_tmp_view_name(this) ~ ")"], + incremental_predicates = ["DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from " ~ generate_tmp_view_name(this) ~ ")"], unique_key = "tx_hash", cluster_by = ['modified_timestamp::DATE','partition_key'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(tx_hash)",