Skip to content

Commit

Permalink
real time and historical update
Browse files Browse the repository at this point in the history
  • Loading branch information
Matlefebvre1234 committed Jun 21, 2024
1 parent 2f234e7 commit 6714998
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 140 deletions.
9 changes: 5 additions & 4 deletions clickhouse schema/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ AS
SELECT owner as account,
contract,
amount,
block_num AS updated_at_block_num,
timestamp AS updated_at_timestamp,
block_num,
timestamp,
if(amount > 0, 0, 1) AS is_deleted
FROM balance_changes;

Expand All @@ -59,6 +59,7 @@ CREATE TABLE IF NOT EXISTS account_balances
contract String,
amount Int64,
block_num UInt32,
timestamp DateTime,
is_deleted UInt8
)
ENGINE = ReplacingMergeTree(block_num, is_deleted)
Expand All @@ -71,8 +72,8 @@ AS
SELECT owner as account,
contract,
amount,
block_num AS updated_at_block_num,
timestamp AS updated_at_timestamp,
block_num,
timestamp,
if(amount > 0, 0, 1) AS is_deleted
FROM balance_changes;

Expand Down
Loading

0 comments on commit 6714998

Please sign in to comment.