Skip to content

Commit

Permalink
Merge pull request blockchain-etl#358 from CoinStatsHQ/pr/aws-schemas…
Browse files Browse the repository at this point in the history
…-updated

AWS Athena schemas update to JSON
  • Loading branch information
medvedev1088 authored Jun 18, 2022
2 parents 1711d2e + 4ee0706 commit f8f22f9
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 302 deletions.
20 changes: 6 additions & 14 deletions schemas/aws/blocks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@ CREATE EXTERNAL TABLE IF NOT EXISTS blocks (
gas_limit BIGINT,
gas_used BIGINT,
timestamp BIGINT,
transaction_count BIGINT
transaction_count BIGINT,
base_fee_per_gas BIGINT
)
PARTITIONED BY (start_block BIGINT, end_block BIGINT)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ',',
'escape.delim' = '\\'
)
STORED AS TEXTFILE
LOCATION 's3://<your_bucket>/ethereumetl/export/blocks'
TBLPROPERTIES (
'skip.header.line.count' = '1'
);
PARTITIONED BY (block_date STRING)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 's3://<your_bucket>/export/blocks/';

MSCK REPAIR TABLE blocks;
MSCK REPAIR TABLE blocks;
2 changes: 1 addition & 1 deletion schemas/aws/contracts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CREATE EXTERNAL TABLE IF NOT EXISTS contracts (
is_erc20 BOOLEAN,
is_erc721 BOOLEAN
)
PARTITIONED BY (start_block BIGINT, end_block BIGINT)
PARTITIONED BY (date STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
Expand Down
17 changes: 4 additions & 13 deletions schemas/aws/logs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,10 @@ CREATE EXTERNAL TABLE IF NOT EXISTS logs (
block_number BIGINT,
address STRING,
data STRING,
topics STRING
topics ARRAY<STRING>
)
PARTITIONED BY (start_block BIGINT, end_block BIGINT)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ',',
'escape.delim' = '\\'
)
STORED AS TEXTFILE
LOCATION 's3://<your_bucket>/ethereumetl/export/logs'
TBLPROPERTIES (
'skip.header.line.count' = '1'
);
PARTITIONED BY (block_date STRING)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 's3://<your_bucket>/export/logs/';

MSCK REPAIR TABLE logs;
18 changes: 5 additions & 13 deletions schemas/aws/receipts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@ CREATE EXTERNAL TABLE IF NOT EXISTS receipts (
gas_used BIGINT,
contract_address STRING,
root STRING,
status BIGINT
status BIGINT,
effective_gas_price BIGINT
)
PARTITIONED BY (start_block BIGINT, end_block BIGINT)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ',',
'escape.delim' = '\\'
)
STORED AS TEXTFILE
LOCATION 's3://<your_bucket>/ethereumetl/export/receipts'
TBLPROPERTIES (
'skip.header.line.count' = '1'
);
PARTITIONED BY (block_date STRING)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 's3://<your_bucket>/export/receipts/';

MSCK REPAIR TABLE receipts;
19 changes: 5 additions & 14 deletions schemas/aws/token_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@ CREATE EXTERNAL TABLE IF NOT EXISTS token_transfers (
token_address STRING,
from_address STRING,
to_address STRING,
value DECIMAL(38,0),
value STRING,
transaction_hash STRING,
log_index BIGINT,
block_number BIGINT
)
PARTITIONED BY (start_block BIGINT, end_block BIGINT)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ',',
'escape.delim' = '\\'
)
STORED AS TEXTFILE
LOCATION 's3://<your_bucket>/ethereumetl/export/token_transfers'
TBLPROPERTIES (
'skip.header.line.count' = '1'
);
PARTITIONED BY (block_date STRING)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 's3://<your_bucket>/export/token_transfers/';

MSCK REPAIR TABLE token_transfers;
MSCK REPAIR TABLE token_transfers;
2 changes: 1 addition & 1 deletion schemas/aws/tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CREATE EXTERNAL TABLE IF NOT EXISTS tokens (
decimals BIGINT,
total_supply DECIMAL(38,0)
)
PARTITIONED BY (start_block BIGINT, end_block BIGINT)
PARTITIONED BY (date STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
Expand Down
22 changes: 8 additions & 14 deletions schemas/aws/transactions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ CREATE EXTERNAL TABLE IF NOT EXISTS transactions (
value DECIMAL(38,0),
gas BIGINT,
gas_price BIGINT,
input STRING
input STRING,
max_fee_per_gas BIGINT,
max_priority_fee_per_gas BIGINT,
transaction_type BIGINT
)
PARTITIONED BY (start_block BIGINT, end_block BIGINT)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ',',
'escape.delim' = '\\'
)
STORED AS TEXTFILE
LOCATION 's3://<your_bucket>/ethereumetl/export/transactions'
TBLPROPERTIES (
'skip.header.line.count' = '1'
);
PARTITIONED BY (block_date STRING)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 's3://<your_bucket>/export/transactions/';

MSCK REPAIR TABLE transactions;
MSCK REPAIR TABLE transactions;
34 changes: 0 additions & 34 deletions schemas/aws_partition_by_date/blocks.sql

This file was deleted.

21 changes: 0 additions & 21 deletions schemas/aws_partition_by_date/contracts.sql

This file was deleted.

24 changes: 0 additions & 24 deletions schemas/aws_partition_by_date/logs.sql

This file was deleted.

25 changes: 0 additions & 25 deletions schemas/aws_partition_by_date/parquet/parquet_blocks.sql

This file was deleted.

14 changes: 0 additions & 14 deletions schemas/aws_partition_by_date/parquet/parquet_token_transfers.sql

This file was deleted.

18 changes: 0 additions & 18 deletions schemas/aws_partition_by_date/parquet/parquet_transactions.sql

This file was deleted.

25 changes: 0 additions & 25 deletions schemas/aws_partition_by_date/receipts.sql

This file was deleted.

23 changes: 0 additions & 23 deletions schemas/aws_partition_by_date/token_transfers.sql

This file was deleted.

21 changes: 0 additions & 21 deletions schemas/aws_partition_by_date/tokens.sql

This file was deleted.

27 changes: 0 additions & 27 deletions schemas/aws_partition_by_date/transactions.sql

This file was deleted.

0 comments on commit f8f22f9

Please sign in to comment.