-
Notifications
You must be signed in to change notification settings - Fork 11
/
extractor.py
executable file
·43 lines (36 loc) · 1.36 KB
/
extractor.py
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
#!/usr/bin/env python3
import click
from operations import clickhouse
from config import DATABASE
OPERATIONS = {
"clickhouse": [
("prepare-database", clickhouse.prepare_indices_and_views),
("start", clickhouse.synchronize),
("start-full", clickhouse.synchronize_full),
("prepare-indices", clickhouse.prepare_indices),
("prepare-erc-transactions-view", clickhouse.extract_token_transactions),
("prepare-bancor-trades-view", clickhouse.prepare_bancor_trades),
("prepare-contracts-view", clickhouse.prepare_contracts_view),
("extract-blocks", clickhouse.prepare_blocks),
("extract-traces", clickhouse.extract_traces),
("extract-events", clickhouse.extract_events),
("extract-tokens", clickhouse.extract_tokens),
("download-contracts-abi", clickhouse.extract_contracts_abi),
("parse-transactions-inputs", clickhouse.parse_transactions_inputs),
("parse-events-inputs", clickhouse.parse_events_inputs),
("download-prices", clickhouse.extract_prices),
("test", clickhouse.run_tests)
]
}
@click.group()
def start_process():
"""
Ethereum extractor
"""
pass
def wrap_operations():
for name, operation in OPERATIONS[DATABASE]:
start_process.command(name)(operation)
wrap_operations()
if __name__ == '__main__':
start_process()