Skip to content

Athena

Bases: Spout

__init__(output, state, **kwargs)

Initialize the Athena class.

Parameters:

Name Type Description Default
output BatchOutput

An instance of the BatchOutput class for saving the data.

required
state State

An instance of the State class for maintaining the state.

required
**kwargs

Additional keyword arguments.

{}

Using geniusrise to invoke via command line

genius Athena rise \
    batch \
        --output_s3_bucket my_bucket \
        --output_s3_folder s3/folder \
    none \
    fetch \
        --args region_name=us-east-1 output_location=s3://mybucket/output query="SELECT * FROM mytable"

Using geniusrise to invoke via YAML file

version: "1"
spouts:
    my_athena_spout:
        name: "Athena"
        method: "fetch"
        args:
            region_name: "us-east-1"
            output_location: "s3://mybucket/output"
            query: "SELECT * FROM mytable"
        output:
            type: "batch"
            args:
                bucket: "my_bucket"
                s3_folder: "s3/folder"

fetch(region_name, output_location, query)

📖 Fetch data from an AWS Athena table and save it in batch.

Parameters:

Name Type Description Default
region_name str

The AWS region name.

required
output_location str

The S3 output location for the query results.

required
query str

The SQL query to execute.

required

Raises:

Type Description
Exception

If unable to connect to the AWS Athena service or execute the query.