From 31f8e047c17951ec58ec4a6567cda8b5f19ec155 Mon Sep 17 00:00:00 2001 From: gregoriustanleyy Date: Thu, 13 Mar 2025 21:27:52 +0700 Subject: [PATCH] Revert "initial streamline models" This reverts commit 118d328febd88f4acb92556ca95b07c02e14b7d0. --- .../streamline/streamline__oklink_metrics.sql | 88 ------------------- .../streamline__oklink_realtime.sql | 53 ----------- 2 files changed, 141 deletions(-) delete mode 100644 models/oklink/streamline/streamline__oklink_metrics.sql delete mode 100644 models/oklink/streamline/streamline__oklink_realtime.sql diff --git a/models/oklink/streamline/streamline__oklink_metrics.sql b/models/oklink/streamline/streamline__oklink_metrics.sql deleted file mode 100644 index 0178a74..0000000 --- a/models/oklink/streamline/streamline__oklink_metrics.sql +++ /dev/null @@ -1,88 +0,0 @@ -{{ - config( - materialized = 'view', - tags = ['streamline_view'] - ) -}} - --- Chains: SCROLL, SUI, FTM, LINEA, RONIN (Flipside Supported) --- Address: LINEA, SCROLL, RONIN (Only `newActiveAddresses`), FTM --- Stats: FTM - -WITH metrics AS ( - -- Addresses count metrics (no date params) - SELECT - 'Linea' AS blockchain, - 'LINEA' AS chain_short_name, - 'address_count' AS metric, - 'https://www.oklink.com/api/v5/explorer/blockchain/address' AS endpoint, - FALSE AS historical_data, - 'Count of addresses on Linea blockchain' AS description - UNION ALL - SELECT - 'Scroll' AS blockchain, - 'SCROLL' AS chain_short_name, - 'address_count' AS metric, - 'https://www.oklink.com/api/v5/explorer/blockchain/address' AS endpoint, - FALSE AS historical_data, - 'Count of addresses on Scroll blockchain' AS description - UNION ALL - -- Only `activeAddresses`/`newActiveAddresses` available for Ronin - SELECT - 'Ronin' AS blockchain, - 'RONIN' AS chain_short_name, - 'address_count' AS metric, - 'https://www.oklink.com/api/v5/explorer/blockchain/address' AS endpoint, - FALSE AS historical_data, - 'Count of addresses on Ronin blockchain' AS description - UNION ALL - SELECT - 'Fantom' AS blockchain, - 'FTM' AS chain_short_name, - 'address_count' AS metric, - 'https://www.oklink.com/api/v5/explorer/blockchain/address' AS endpoint, - FALSE AS historical_data, - 'Count of addresses on Ronin blockchain' AS description - UNION ALL - -- Blockchain stats metrics (can use StartTime and endTime) - SELECT - 'Fantom' AS blockchain, - 'FTM' AS chain_short_name, - 'blockchain_stats' AS metric, - 'https://www.oklink.com/api/v5/explorer/blockchain/stats' AS endpoint, - TRUE AS historical_data, - 'Blockchain statistics for Fantom' AS description -) - -SELECT - date_day, - blockchain, - metric, - endpoint, - CASE - WHEN metric IN ('address_count') THEN - -- For endpoints without look-back functionality (i.e. address) - OBJECT_CONSTRUCT( - 'chainShortName', chain_short_name - ) - ELSE - -- For endpoints with look-back functionality (i.e. stats) - OBJECT_CONSTRUCT( - 'chainShortName', chain_short_name, - 'startTime', ((DATE_PART('EPOCH', date_day)) * 1000)::STRING, - 'endTime', ((DATE_PART('EPOCH', DATEADD(SECOND, -1, DATEADD(DAY, 1, date_day)))) * 1000)::STRING, - 'limit', '1', - 'page', '1' - ) - END AS variables, - description -FROM - {{ source( - 'crosschain_core', - 'dim_dates' - ) }} - CROSS JOIN metrics -WHERE - (metric = 'address_count' AND date_day = CURRENT_DATE()) - OR - (metric = 'blockchain_stats' AND date_day >= '2025-01-01' AND date_day < CURRENT_DATE()) diff --git a/models/oklink/streamline/streamline__oklink_realtime.sql b/models/oklink/streamline/streamline__oklink_realtime.sql deleted file mode 100644 index 153c04f..0000000 --- a/models/oklink/streamline/streamline__oklink_realtime.sql +++ /dev/null @@ -1,53 +0,0 @@ -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = { - "external_table": "oklink", - "sql_limit": "1", - "producer_batch_size": "1", - "worker_batch_size": "1", - "async_concurrent_requests": "1", - "sql_source": "{{this.identifier}}", - "order_by_column": "date_day", - "request_delay_ms": "1000"} - ), - tags = ['streamline_realtime'] -) }} - -WITH metrics AS ( - SELECT - date_day, - blockchain, - metric, - CASE - WHEN metric = 'address_count' THEN - endpoint || '?chainShortName=' || variables:chainShortName - WHEN metric = 'blockchain_stats' THEN - endpoint || '?chainShortName=' || variables:chainShortName || - '&startTime=' || variables:startTime || - '&endTime=' || variables:endTime || - '&limit=' || variables:limit || - '&page=' || variables:page - END AS full_endpoint - FROM - {{ ref("streamline__oklink_metrics") }} -) -SELECT - TO_NUMBER(to_char(date_day, 'YYYYMMDD')) AS date_day, - blockchain, - metric, - TO_NUMBER(to_char(SYSDATE()::DATE, 'YYYYMMDD')) AS partition_key, - livequery.live.udf_api( - 'GET', - full_endpoint, - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'Ok-Access-Key', '{Authentication}' - ), - NULL, - 'Vault/prod/oklink' - ) AS request -FROM - metrics \ No newline at end of file