athena_s3

package module
v0.0.0-...-a759b4d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2017 License: GPL-3.0 Imports: 9 Imported by: 0

README

athena_s3_sample

Use Amazon AWS SDK to upload data to S3 bucket and query by Athena

Install Amazon AWS Go SDK.

go get -u github.com/aws/aws-sdk-go

http://docs.aws.amazon.com/sdk-for-go/api/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Athena

type Athena struct {
	C *athena.Athena
}

Amazon API guide: http://docs.aws.amazon.com/sdk-for-go/api/

func NewAthenaClient

func NewAthenaClient(k string, sk string, r string) (*Athena, error)

Create New Athena Client with accessKey , secretAccessKey, region info

func (*Athena) ProcessResultRows

func (a *Athena) ProcessResultRows(queryExecutionId *string, fn ProcessRow) error

func (*Athena) SubmitAthenaQuery

func (a *Athena) SubmitAthenaQuery(db *string, query *string, o *string) (*string, error)

Submit Query Request db: target db to query query: standard sql o : output location. s3 output path

func (*Athena) WaitForQueryToComplete

func (a *Athena) WaitForQueryToComplete(queryExecutionId *string) error

Wait for an Athena query to complete, fail or is canceled. If a query fails or is canceled, then Error Query finish will return nil

type ProcessRow

type ProcessRow func(page *athena.GetQueryResultsOutput, lastPage bool) bool

Define function for executing data

type S3

type S3 struct {
	C *s3.S3
}

Amazon API guide: http://docs.aws.amazon.com/sdk-for-go/api/

func NewS3

func NewS3(k string, sk string, r string) (*S3, error)

Create New S3 Client with accessKey , secretAccessKey, region info

func (*S3) Upload

func (c *S3) Upload(srcPath string, bucket string, desPath string) error

Upload file from local to s3 Local file path: srcPath S3 bucket : bucket S3 destination path: desPath

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL