Version: v0.3.8 Latest Latest

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 10 Imported by: 0


aws-sdk-go-v2-wrapper | Athena

Quick Usage

import (


func main() {
	svc, err := athena.New(config.Config{
		AccessKey: "<...>",
		SecretKey: "<...>",
	if err != nil {
	ctx := context.Background()

	sql := "SELECT col1, col2 FROM db.table WHERE col3 = 'foobar'"
	// fetch error level logs
	result, err := svc.XQueryResults(ctx, cloudwatchlogs.XQueryResultsRequest{
		QueryString: sql,
		WorkGroup:   "primary",
	if err != nil {

	fmt.Printf("mapResult: [%+v]", result.ResultSet.ToMapString())
	fmt.Printf("sliceResult: [%+v]", result.ResultSet.ToListString())
	// ...


Name Description
XQueryResults executes a query and waits for fetching complete results.
XGetQueryResultsAll waits for fetching complete results.




This section is empty.


This section is empty.


This section is empty.


type Athena

type Athena struct {
	// contains filtered or unexported fields

Athena has Athena client.

func New

func New(conf config.Config) (*Athena, error)

New returns initialized *Athena.

func (*Athena) Errorf

func (svc *Athena) Errorf(format string, v ...interface{})

Errorf logging error information.

func (*Athena) GetClient

func (svc *Athena) GetClient() *SDK.Client

GetClient gets original SDK client.

func (*Athena) GetQueryExecution

func (svc *Athena) GetQueryExecution(ctx context.Context, r GetQueryExecutionRequest) (*GetQueryExecutionResult, error)

GetQueryExecution executes `GetQueryExecution` operation.

func (*Athena) GetQueryResults

func (svc *Athena) GetQueryResults(ctx context.Context, r GetQueryResultsRequest) (*GetQueryResultsResult, error)

GetQueryResults executes `GetQueryResults` operation.

func (*Athena) Infof

func (svc *Athena) Infof(format string, v ...interface{})

Infof logging information.

func (*Athena) RawBatchGetNamedQuery

func (svc *Athena) RawBatchGetNamedQuery(ctx context.Context, in *SDK.BatchGetNamedQueryInput) (*SDK.BatchGetNamedQueryResponse, error)

RawBatchGetNamedQuery executes `BatchGetNamedQuery` raw operation.

func (*Athena) RawBatchGetQueryExecution

func (svc *Athena) RawBatchGetQueryExecution(ctx context.Context, in *SDK.BatchGetQueryExecutionInput) (*SDK.BatchGetQueryExecutionResponse, error)

RawBatchGetQueryExecution executes `BatchGetQueryExecution` raw operation.

func (*Athena) RawCreateDataCatalog

func (svc *Athena) RawCreateDataCatalog(ctx context.Context, in *SDK.CreateDataCatalogInput) (*SDK.CreateDataCatalogResponse, error)

RawCreateDataCatalog executes `CreateDataCatalog` raw operation.

func (*Athena) RawCreateNamedQuery

func (svc *Athena) RawCreateNamedQuery(ctx context.Context, in *SDK.CreateNamedQueryInput) (*SDK.CreateNamedQueryResponse, error)

RawCreateNamedQuery executes `CreateNamedQuery` raw operation.

func (*Athena) RawCreateWorkGroup

func (svc *Athena) RawCreateWorkGroup(ctx context.Context, in *SDK.CreateWorkGroupInput) (*SDK.CreateWorkGroupResponse, error)

RawCreateWorkGroup executes `CreateWorkGroup` raw operation.

func (*Athena) RawDeleteDataCatalog

func (svc *Athena) RawDeleteDataCatalog(ctx context.Context, in *SDK.DeleteDataCatalogInput) (*SDK.DeleteDataCatalogResponse, error)

RawDeleteDataCatalog executes `DeleteDataCatalog` raw operation.

func (*Athena) RawDeleteNamedQuery

func (svc *Athena) RawDeleteNamedQuery(ctx context.Context, in *SDK.DeleteNamedQueryInput) (*SDK.DeleteNamedQueryResponse, error)

RawDeleteNamedQuery executes `DeleteNamedQuery` raw operation.

func (*Athena) RawDeleteWorkGroup

func (svc *Athena) RawDeleteWorkGroup(ctx context.Context, in *SDK.DeleteWorkGroupInput) (*SDK.DeleteWorkGroupResponse, error)

RawDeleteWorkGroup executes `DeleteWorkGroup` raw operation.

func (*Athena) RawGetDataCatalog

func (svc *Athena) RawGetDataCatalog(ctx context.Context, in *SDK.GetDataCatalogInput) (*SDK.GetDataCatalogResponse, error)

RawGetDataCatalog executes `GetDataCatalog` raw operation.

func (*Athena) RawGetDatabase

func (svc *Athena) RawGetDatabase(ctx context.Context, in *SDK.GetDatabaseInput) (*SDK.GetDatabaseResponse, error)

RawGetDatabase executes `GetDatabase` raw operation.

func (*Athena) RawGetNamedQuery

func (svc *Athena) RawGetNamedQuery(ctx context.Context, in *SDK.GetNamedQueryInput) (*SDK.GetNamedQueryResponse, error)

RawGetNamedQuery executes `GetNamedQuery` raw operation.

func (*Athena) RawGetQueryExecution

func (svc *Athena) RawGetQueryExecution(ctx context.Context, in *SDK.GetQueryExecutionInput) (*SDK.GetQueryExecutionResponse, error)

RawGetQueryExecution executes `GetQueryExecution` raw operation.

func (*Athena) RawGetQueryResults

func (svc *Athena) RawGetQueryResults(ctx context.Context, in *SDK.GetQueryResultsInput) (*SDK.GetQueryResultsResponse, error)

RawGetQueryResults executes `GetQueryResults` raw operation.

func (*Athena) RawGetTableMetadata

func (svc *Athena) RawGetTableMetadata(ctx context.Context, in *SDK.GetTableMetadataInput) (*SDK.GetTableMetadataResponse, error)

RawGetTableMetadata executes `GetTableMetadata` raw operation.

func (*Athena) RawGetWorkGroup

func (svc *Athena) RawGetWorkGroup(ctx context.Context, in *SDK.GetWorkGroupInput) (*SDK.GetWorkGroupResponse, error)

RawGetWorkGroup executes `GetWorkGroup` raw operation.

func (*Athena) RawListDataCatalogs

func (svc *Athena) RawListDataCatalogs(ctx context.Context, in *SDK.ListDataCatalogsInput) (*SDK.ListDataCatalogsResponse, error)

RawListDataCatalogs executes `ListDataCatalogs` raw operation.

func (*Athena) RawListDatabases

func (svc *Athena) RawListDatabases(ctx context.Context, in *SDK.ListDatabasesInput) (*SDK.ListDatabasesResponse, error)

RawListDatabases executes `ListDatabases` raw operation.

func (*Athena) RawListNamedQueries

func (svc *Athena) RawListNamedQueries(ctx context.Context, in *SDK.ListNamedQueriesInput) (*SDK.ListNamedQueriesResponse, error)

RawListNamedQueries executes `ListNamedQueries` raw operation.

func (*Athena) RawListQueryExecutions

func (svc *Athena) RawListQueryExecutions(ctx context.Context, in *SDK.ListQueryExecutionsInput) (*SDK.ListQueryExecutionsResponse, error)

RawListQueryExecutions executes `ListQueryExecutions` raw operation.

func (*Athena) RawListTableMetadata

func (svc *Athena) RawListTableMetadata(ctx context.Context, in *SDK.ListTableMetadataInput) (*SDK.ListTableMetadataResponse, error)

RawListTableMetadata executes `ListTableMetadata` raw operation.

func (*Athena) RawListTagsForResource

func (svc *Athena) RawListTagsForResource(ctx context.Context, in *SDK.ListTagsForResourceInput) (*SDK.ListTagsForResourceResponse, error)

RawListTagsForResource executes `ListTagsForResource` raw operation.

func (*Athena) RawListWorkGroups

func (svc *Athena) RawListWorkGroups(ctx context.Context, in *SDK.ListWorkGroupsInput) (*SDK.ListWorkGroupsResponse, error)

RawListWorkGroups executes `ListWorkGroups` raw operation.

func (*Athena) RawStartQueryExecution

func (svc *Athena) RawStartQueryExecution(ctx context.Context, in *SDK.StartQueryExecutionInput) (*SDK.StartQueryExecutionResponse, error)

RawStartQueryExecution executes `StartQueryExecution` raw operation.

func (*Athena) RawStopQueryExecution

func (svc *Athena) RawStopQueryExecution(ctx context.Context, in *SDK.StopQueryExecutionInput) (*SDK.StopQueryExecutionResponse, error)

RawStopQueryExecution executes `StopQueryExecution` raw operation.

func (*Athena) SetLogger

func (svc *Athena) SetLogger(logger log.Logger)

SetLogger sets logger.

func (*Athena) StartQueryExecution

func (svc *Athena) StartQueryExecution(ctx context.Context, r StartQueryExecutionRequest) (*StartQueryExecutionResult, error)

StartQueryExecution executes `StartQueryExecution` operation.

func (*Athena) StopQueryExecution

func (svc *Athena) StopQueryExecution(ctx context.Context, r StopQueryExecutionRequest) (*StopQueryExecutionResult, error)

StopQueryExecution executes `StopQueryExecution` operation.

func (*Athena) XGetQueryResultsAll

func (svc *Athena) XGetQueryResultsAll(ctx context.Context, queryID string) (*GetQueryResultsResult, error)

func (*Athena) XQueryResults

func (svc *Athena) XQueryResults(ctx context.Context, r XQueryResultsRequest) (*GetQueryResultsResult, error)

XQueryResults executes a query and waits for fetching complete results.

type ColumnInfo

type ColumnInfo struct {
	Name string
	Type string

	// optional
	CaseSensitive bool
	CatalogName   string
	Label         string
	Nullable      ColumnNullable
	Precision     int64
	Scale         int64
	SchemaName    string
	TableName     string

func NewColumnInfo

func NewColumnInfo(o SDK.ColumnInfo) ColumnInfo

func NewColumnInfoList

func NewColumnInfoList(list []SDK.ColumnInfo) []ColumnInfo

func NewColumnInfoListFromMetadata

func NewColumnInfoListFromMetadata(o *SDK.ResultSetMetadata) []ColumnInfo

type ColumnNullable

type ColumnNullable string

func (ColumnNullable) IsNotNull

func (v ColumnNullable) IsNotNull() bool

func (ColumnNullable) IsNullable

func (v ColumnNullable) IsNullable() bool

func (ColumnNullable) IsUnknown

func (v ColumnNullable) IsUnknown() bool

type Datum

type Datum struct {
	VarCharValue string

	HasValue bool

func NewDatum

func NewDatum(o SDK.Datum) Datum

func NewDatumList

func NewDatumList(list []SDK.Datum) []Datum

type EncryptionOption

type EncryptionOption string

func (EncryptionOption) IsCSEKMS

func (v EncryptionOption) IsCSEKMS() bool

func (EncryptionOption) IsSSEKMS

func (v EncryptionOption) IsSSEKMS() bool

func (EncryptionOption) IsSSES3

func (v EncryptionOption) IsSSES3() bool

type GetQueryExecutionRequest

type GetQueryExecutionRequest struct {
	QueryExecutionID string

GetQueryExecutionRequest has parameters for `GetQueryExecution` operation.

func (GetQueryExecutionRequest) ToInput

type GetQueryExecutionResult

type GetQueryExecutionResult struct {
	Query                 string
	QueryExecutionContext QueryExecutionContext
	QueryExecutionID      string
	ResultConfiguration   ResultConfiguration
	StatementType         StatementType
	Statistics            QueryExecutionStatistics
	Status                QueryExecutionStatus
	WorkGroup             string

type GetQueryResultsRequest

type GetQueryResultsRequest struct {
	QueryExecutionID string

	// optional
	MaxResults int64
	NextToken  string

GetQueryResultsRequest has parameters for `GetQueryResults` operation.

func (GetQueryResultsRequest) ToInput

type GetQueryResultsResult

type GetQueryResultsResult struct {
	NextToken   string
	ResultSet   ResultSet
	UpdateCount int64

type QueryExecutionContext

type QueryExecutionContext struct {
	Catalog  string
	Database string

func (QueryExecutionContext) ToSDK

type QueryExecutionState

type QueryExecutionState string

func (QueryExecutionState) IsCancelled

func (v QueryExecutionState) IsCancelled() bool

func (QueryExecutionState) IsFailed

func (v QueryExecutionState) IsFailed() bool

func (QueryExecutionState) IsQueued

func (v QueryExecutionState) IsQueued() bool

func (QueryExecutionState) IsRunning

func (v QueryExecutionState) IsRunning() bool

func (QueryExecutionState) IsSucceeded

func (v QueryExecutionState) IsSucceeded() bool

type QueryExecutionStatistics

type QueryExecutionStatistics struct {
	DataManifestLocation          string
	DataScannedInBytes            int64
	EngineExecutionTimeInMillis   int64
	QueryPlanningTimeInMillis     int64
	QueryQueueTimeInMillis        int64
	ServiceProcessingTimeInMillis int64
	TotalExecutionTimeInMillis    int64

type QueryExecutionStatus

type QueryExecutionStatus struct {
	CompletionDateTime time.Time
	State              QueryExecutionState
	StateChangeReason  string
	SubmissionDateTime time.Time

type ResultConfiguration

type ResultConfiguration struct {
	OutputLocation   string
	EncryptionKMSKey string
	EncryptionOption EncryptionOption

func (ResultConfiguration) ToSDK

type ResultSet

type ResultSet struct {
	ColumnInfo []ColumnInfo
	Rows       []Row

func NewResultSet

func NewResultSet(o *SDK.ResultSet) ResultSet

func (ResultSet) ToListString

func (r ResultSet) ToListString() [][]string

func (ResultSet) ToMapString

func (r ResultSet) ToMapString() []map[string]string

type Row

type Row struct {
	Data []Datum

func NewRow

func NewRow(o SDK.Row) Row

func NewRowList

func NewRowList(list []SDK.Row) []Row

type StartQueryExecutionRequest

type StartQueryExecutionRequest struct {
	QueryString string

	// optional
	ClientRequestToken    string
	QueryExecutionContext QueryExecutionContext
	ResultConfiguration   ResultConfiguration
	WorkGroup             string

StartQueryExecutionRequest has parameters for `StartQueryExecution` operation.

func (StartQueryExecutionRequest) ToInput

type StartQueryExecutionResult

type StartQueryExecutionResult struct {
	QueryExecutionID string

type StatementType

type StatementType string

func (StatementType) IsDDL

func (v StatementType) IsDDL() bool

func (StatementType) IsDML

func (v StatementType) IsDML() bool

func (StatementType) IsUtility

func (v StatementType) IsUtility() bool

type StopQueryExecutionRequest

type StopQueryExecutionRequest struct {
	QueryExecutionID string

StopQueryExecutionRequest has parameters for `StopQueryExecution` operation.

func (StopQueryExecutionRequest) ToInput

type StopQueryExecutionResult

type StopQueryExecutionResult struct {

type XQueryResultsRequest

type XQueryResultsRequest struct {
	QueryString string

	// optional
	ClientRequestToken    string
	QueryExecutionContext QueryExecutionContext
	ResultConfiguration   ResultConfiguration
	WorkGroup             string

	// extension
	MaxRetry int         // default=5
	WaitFunc func(i int) // waiting strategy, default=exponential backoff with full jitter from 10sec

Jump to

Keyboard shortcuts

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