Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing quotes for cluster name in SQL schema #62

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion create_schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ done
ON_CLUSTER_DIRECTIVE=""
ENGINE_TYPE="ReplacingMergeTree()"
if [ -n "$CLUSTER_NAME" ]; then
ON_CLUSTER_DIRECTIVE="ON CLUSTER $CLUSTER_NAME"
ON_CLUSTER_DIRECTIVE="ON CLUSTER \"$CLUSTER_NAME\""
ENGINE_TYPE="ReplicatedReplacingMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')"
fi

Expand Down
43 changes: 43 additions & 0 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,49 @@ SELECT contract,
timestamp AS updated_at_timestamp
FROM supply_change_events;

-- Table to store token transfers primarily indexed by the 'contract' field --
CREATE TABLE IF NOT EXISTS transfers_contract ON CLUSTER "antelope"
(
trx_id String,
action_index UInt32,

contract String,
symcode String,

from String,
to String,
quantity String,
memo String,

precision UInt32,
amount Int64,
value Float64,

block_num UInt64,
timestamp DateTime
)
ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')
PRIMARY KEY (contract, symcode, trx_id, action_index)
ORDER BY (contract, symcode, trx_id, action_index);

CREATE MATERIALIZED VIEW transfers_contract_mv ON CLUSTER "antelope"
TO transfers_contract
AS
SELECT trx_id,
action_index,
contract,
symcode,
from,
to,
quantity,
memo,
precision,
amount,
value,
block_num,
timestamp
FROM transfer_events;

-- Table to store token transfers primarily indexed by the 'from' field --
CREATE TABLE IF NOT EXISTS transfers_from ON CLUSTER "antelope"
(
Expand Down
Loading