Query
- เปิดใช้งาน AWS Athena โดยทำการ Search ชื่อ Service (AWS Athena)
- เมื่อเข้ามายัง Athena ครั้งแรกต้องทำการ Setting S3 สำหรับเก็บ Query และผลลัพธ์
- เลือก Bucket ให้อยู่ใน Region เดียวกับ AWS Glue database เมื่อเลือกเสร็จสิ้นแล้วทำการกด Save
- จากนั้นสามารถรัน SQL สำหรับค้นหาข้อมูลและประมวลผลข้อมูลในลักษณะเดียวกับ Dune analytics ได้เรียบร้อยแล้ว
select count(blocknumber) as tx_volumn,blocknumber from op_logs_tx_engine
where any_match(topics, topic -> topic = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef')
and array_position(topics, '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef') = 1
and address = '0x4200000000000000000000000000000000000006'
and CARDINALITY(topics) = 3
group by blocknumber
สามารถใช้งานได้เรียบร้อยแล้ว ซึ่ง ณ ปัจจุบันยังมีความท้าทายในการจัดการกับ uint256 ที่เป็นชนิดข้อมูลของ logs ซึ่งเราสามารถทำการ Preprocess ก่อนนำมาจัดเก็บไว้ใน Datalake ได้ ซึ่งต้องรอกับอัพเดทครั้งถัดไปสำหรับการแก้ไขปัญหานี้
เพิ่มเติมสำหรับ AWS Athena
1.https://www.vultureprime.com/how-to/what-is-aws-athena
สำหรับครั้งนี้เราจะสอนใช้งาน TXEngine เป็น Open Source Data Ingestion and Validation ซึ่งสามารถใช้งานร่วมกับ AWS Glue, AWS Athena และ AWS Quicksight เพื่อสร้าง On chain analyst engine (Dune analytics-like) ของตัวเอง https://github.com/vultureprime/tx-engine
- Data Ingestion
- Data Catalog
- Query
- Visualization