-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathclickhouse_create_insert_null_table.sql
98 lines (98 loc) · 3.01 KB
/
clickhouse_create_insert_null_table.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
CREATE TABLE IF NOT EXISTS inserts_null_table (
chain_id UInt256,
block Tuple(
block_number UInt256,
block_timestamp DateTime,
hash FixedString(66),
parent_hash FixedString(66),
sha3_uncles FixedString(66),
nonce FixedString(18),
mix_hash FixedString(66),
miner FixedString(42),
state_root FixedString(66),
transactions_root FixedString(66),
receipts_root FixedString(66),
logs_bloom String,
size UInt64,
extra_data String,
difficulty UInt256,
total_difficulty UInt256,
transaction_count UInt64,
gas_limit UInt256,
gas_used UInt256,
withdrawals_root FixedString(66),
base_fee_per_gas Nullable(UInt64)
),
transactions Array(Tuple(
hash FixedString(66),
nonce UInt64,
block_hash FixedString(66),
block_number UInt256,
block_timestamp DateTime,
transaction_index UInt64,
from_address FixedString(42),
to_address FixedString(42),
value UInt256,
gas UInt64,
gas_price UInt256,
data String,
function_selector FixedString(10),
max_fee_per_gas UInt128,
max_priority_fee_per_gas UInt128,
max_fee_per_blob_gas UInt256,
blob_versioned_hashes Array(String),
transaction_type UInt8,
r UInt256,
s UInt256,
v UInt256,
access_list Nullable(String),
contract_address Nullable(FixedString(42)),
gas_used Nullable(UInt64),
cumulative_gas_used Nullable(UInt64),
effective_gas_price Nullable(UInt256),
blob_gas_used Nullable(UInt64),
blob_gas_price Nullable(UInt256),
logs_bloom Nullable(String),
status Nullable(UInt64)
)),
logs Array(Tuple(
block_number UInt256,
block_hash FixedString(66),
block_timestamp DateTime,
transaction_hash FixedString(66),
transaction_index UInt64,
log_index UInt64,
address FixedString(42),
data String,
topic_0 String,
topic_1 String,
topic_2 String,
topic_3 String
)),
traces Array(Tuple(
block_number UInt256,
block_hash FixedString(66),
block_timestamp DateTime,
transaction_hash FixedString(66),
transaction_index UInt64,
subtraces Int64,
trace_address Array(Int64),
type LowCardinality(String),
call_type LowCardinality(String),
error Nullable(String),
from_address FixedString(42),
to_address FixedString(42),
gas UInt64,
gas_used UInt64,
input String,
output Nullable(String),
value UInt256,
author Nullable(FixedString(42)),
reward_type LowCardinality(Nullable(String)),
refund_address Nullable(FixedString(42))
)),
insert_timestamp DateTime DEFAULT now(),
sign Int8 DEFAULT 1
) ENGINE = MergeTree
ORDER BY (chain_id, insert_timestamp)
PARTITION BY chain_id;