lib

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountID

func AccountID() string

AccountID returns the current AWS Account ID

func CleanCache added in v0.0.2

func CleanCache(fileName string)

CleanCache deletes any tmp files used

func Partition added in v0.1.0

func Partition(daysback int, databaseName, tableName, tmplate string, partitionsMap []string)

Partition partitions the things

func Region

func Region() string

Region returns the current region

func RenderAsCSV added in v0.0.8

func RenderAsCSV(i interface{}) error

RenderAsCSV will render an interfact to table

func RenderAsJSON added in v0.0.8

func RenderAsJSON(i interface{}) error

RenderAsJSON will render an interface as json

func RenderAsTable added in v0.0.8

func RenderAsTable(i interface{}) error

RenderAsTable will render an interfact to table.

func RenderAsXLSX added in v0.1.5

func RenderAsXLSX(i interface{}) error

RenderAsXLSX will render an interface as XLSX

func RenderHistoricalExecutionAsParquet added in v0.1.3

func RenderHistoricalExecutionAsParquet(h []HistoricalExecution) error

RenderHistoricalExecutionAsParquet will render an interface to parquet.

func RenderHistoryResults added in v0.0.8

func RenderHistoryResults(h []HistoricalExecution, outputFormat string) error

RenderHistoryResults ..

Types

type Format added in v0.0.2

type Format int

Format is an enumeration of available query output formats ENUM( json, jsonl, csv, table, tsv, xlsx )

const (
	// FormatJson is a Format of type Json.
	FormatJson Format = iota
	// FormatJsonl is a Format of type Jsonl.
	FormatJsonl
	// FormatCsv is a Format of type Csv.
	FormatCsv
	// FormatTable is a Format of type Table.
	FormatTable
	// FormatTsv is a Format of type Tsv.
	FormatTsv
	// FormatXlsx is a Format of type Xlsx.
	FormatXlsx
)

func ParseFormat added in v0.1.5

func ParseFormat(name string) (Format, error)

ParseFormat attempts to convert a string to a Format.

func (Format) String added in v0.1.5

func (x Format) String() string

String implements the Stringer interface.

type HistoricalExecution added in v0.0.8

type HistoricalExecution struct {
	Query                      string  `parquet:"name=query, type=UTF8, encoding=PLAIN"`
	Catalog                    string  `parquet:"name=catalog, type=UTF8, encoding=PLAIN"`
	Database                   string  `parquet:"name=database, type=UTF8, encoding=PLAIN"`
	QueryExecutionID           string  `parquet:"name=queryexecutionid, type=UTF8, encoding=PLAIN"`
	OutputLocation             string  `parquet:"name=outputlocation, type=UTF8, encoding=PLAIN"`
	State                      string  `parquet:"name=state, type=UTF8, encoding=PLAIN"`
	WorkGroup                  string  `parquet:"name=workgroup, type=UTF8, encoding=PLAIN"`
	TotalExecutionTimeInMillis int64   `parquet:"name=total_execution_time_in_millis, type=INT64"`
	DataScannedInBytes         int64   `parquet:"name=data_scanned_in_bytes, type=INT64"`
	Cost                       float64 `parquet:"name=cost, type=DOUBLE"`
	SubmissionDateTime         time.Time
}

HistoricalExecution ..

func ListHistory added in v0.0.8

func ListHistory(maxResults int, historyCmdWorkgroup string) (h []HistoricalExecution, err error)

ListHistory returns query results per workgroup

type Query

type Query struct {
	OutputFile         string
	QueryResultsBucket string
	QueryResultsPrefix string
	Database           string
	SQL                string
	Format             string
	JMESPath           string
	Statistics         bool
	WorkGroup          string
}

Query ...

func (*Query) Execute

func (q *Query) Execute() (*os.File, error)

Execute a SQL query against Athena

func (*Query) RenderQueryResults added in v0.1.5

func (q *Query) RenderQueryResults(file *os.File) error

RenderQueryResults formats query results a in the desired format and sends to stdout

Jump to

Keyboard shortcuts

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