#athena #aws #user-defined #aws-sdk

aws-athena-parser

Athena parser to convert Athena ResultSet into user defined Structs

5 releases

0.1.5 Apr 13, 2024
0.1.4 Apr 13, 2024

#554 in Database interfaces

Download history 187/week @ 2024-04-07 87/week @ 2024-04-14

274 downloads per month

MIT/Apache

11KB
181 lines

Athena Parser

Overview

The purpose of this package is to provide an easy method of turning the external aws_sdk_athena::types::ResultSet into a user defined struct of various types.

Usage

Ensure that named values within your struct correspond to the column names of the Athena query result set.

use aws_athena_pasrer::{FromAthena, build_map};

#[derive(FromAthena)]
struct MyStruct {
  my_value: String
}

pub fn main() {
      let result_set = ...; // Athena response
      let res: Vec<MyStruct> = build_map(result_set)
            .iter()
            .flat_map(|x| MyStruct::from_athena(x.clone()))
            .collect();
      // ( use the res for your purposes )
}

Dependencies

~13–21MB
~263K SLoC