Skip to content

Instantly share code, notes, and snippets.

@leeadh
Last active October 15, 2022 08:48
Show Gist options
  • Save leeadh/3e10869a95d13462a794766cd7ec8995 to your computer and use it in GitHub Desktop.
Save leeadh/3e10869a95d13462a794766cd7ec8995 to your computer and use it in GitHub Desktop.
//CREATE SCRIPT
create or replace TABLE BLOCKCHAIN_DEMO.PUBLIC.TXN_RECEIPT_DATA (
SCR VARIANT
);
//TASK TO TRANSFORM DATA
CREATE OR REPLACE TASK TRANSFORM_DATA
USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE='SMALL'
WHEN
SYSTEM$STREAM_HAS_DATA('BLOCKCHAIN_DEMO.PUBLIC.TXN_RECEIPT_DATA')
AS
insert into BLOCKCHAIN_DEMO.PUBLIC.FINAL_TRANSFORMATION (
select SCR:blockHash as blockhash,
SCR:blockNumber as blockNumber,
SCR:contractAddress as contractaddress,
SCR:cumulativeGasUsed as cumulativeGasUsed,
SCR:logs:address as address,
SCR:logs:data as data,
SCR:logs:logIndex as logIndex,
SCR:logs:topics as topics,
SCR:logs:transactionHash as transactionHash,
SCR:logs:transactionIndex as transactionIndex,
SCR:logs:type as type,
SCR:logsBloom as logsBloom,
SCR:status as status,
SCR:from as from_address,
SCR:to as to_address
from TXN_RECEIPT_DATA
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment