athena

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AthenaService

type AthenaService struct {
	// contains filtered or unexported fields
}

AthenaService is the cloudmock implementation of the AWS Athena API.

func New

func New(accountID, region string) *AthenaService

New returns a new AthenaService for the given AWS account ID and region.

func (*AthenaService) Actions

func (s *AthenaService) Actions() []service.Action

Actions returns the list of Athena API actions supported by this service.

func (*AthenaService) HandleRequest

func (s *AthenaService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)

HandleRequest routes an incoming Athena request to the appropriate handler.

func (*AthenaService) HealthCheck

func (s *AthenaService) HealthCheck() error

HealthCheck always returns nil (no external dependencies).

func (*AthenaService) Name

func (s *AthenaService) Name() string

Name returns the AWS service name used for routing.

func (*AthenaService) RegisterSchema

func (s *AthenaService) RegisterSchema(database, table string, columns []string)

RegisterSchema registers a table schema for SQL validation.

func (*AthenaService) SetLocator

func (s *AthenaService) SetLocator(locator ServiceLocator)

SetLocator sets the service locator for cross-service lookups (e.g., Glue catalog).

type ColumnInfo

type ColumnInfo struct {
	Name string
	Type string
}

ColumnInfo describes a result column.

type DataCatalog

type DataCatalog struct {
	Name        string
	Type        string // LAMBDA, GLUE, HIVE
	Description string
	Parameters  map[string]string
	Tags        map[string]string
}

DataCatalog represents an Athena data catalog.

type NamedQuery

type NamedQuery struct {
	ID          string
	Name        string
	Description string
	Database    string
	QueryString string
	WorkGroup   string
}

NamedQuery represents an Athena named query.

type QueryExecution

type QueryExecution struct {
	ID             string
	Query          string
	Database       string
	WorkGroup      string
	Status         QueryExecutionStatus
	ResultConfig   ResultConfiguration
	Statistics     QueryExecutionStatistics
	SubmissionTime time.Time
}

QueryExecution represents a running or completed query.

type QueryExecutionStatistics

type QueryExecutionStatistics struct {
	EngineExecutionTimeInMillis int64
	DataScannedInBytes          int64
	TotalExecutionTimeInMillis  int64
}

QueryExecutionStatistics holds execution stats.

type QueryExecutionStatus

type QueryExecutionStatus struct {
	State             string // QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED
	StateChangeReason string
	SubmissionTime    time.Time
	CompletionTime    *time.Time
}

QueryExecutionStatus holds query state.

type QueryResultSet

type QueryResultSet struct {
	ColumnInfo []ColumnInfo
	Rows       [][]string
}

QueryResultSet holds mock query results for a completed execution.

type ResultConfiguration

type ResultConfiguration struct {
	OutputLocation string
}

ResultConfiguration holds result output settings.

type ServiceLocator

type ServiceLocator interface {
	Lookup(name string) (service.Service, error)
}

ServiceLocator resolves other services by name.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages all Athena resources in memory.

func NewStore

func NewStore(accountID, region string) *Store

NewStore creates a new Athena Store with the default "primary" workgroup.

func (*Store) BatchGetNamedQuery

func (s *Store) BatchGetNamedQuery(ids []string) ([]*NamedQuery, []string)

BatchGetNamedQuery returns multiple named queries by ID.

func (*Store) BatchGetQueryExecution

func (s *Store) BatchGetQueryExecution(ids []string) ([]*QueryExecution, []string)

BatchGetQueryExecution returns multiple query executions by ID.

func (*Store) CreateDataCatalog

func (s *Store) CreateDataCatalog(name, catalogType, description string, params, tags map[string]string) (*DataCatalog, bool)

CreateDataCatalog creates a new data catalog. Returns false if already exists.

func (*Store) CreateNamedQuery

func (s *Store) CreateNamedQuery(name, description, database, queryString, workGroup string) *NamedQuery

CreateNamedQuery creates a named query. Returns the query ID.

func (*Store) CreateWorkGroup

func (s *Store) CreateWorkGroup(name, description string, tags map[string]string, config WorkGroupConfiguration) (*WorkGroup, bool)

CreateWorkGroup creates a new workgroup. Returns false if it already exists.

func (*Store) DeleteDataCatalog

func (s *Store) DeleteDataCatalog(name string) bool

DeleteDataCatalog deletes a data catalog. Returns false if not found.

func (*Store) DeleteNamedQuery

func (s *Store) DeleteNamedQuery(id string) bool

DeleteNamedQuery deletes a named query. Returns false if not found.

func (*Store) DeleteWorkGroup

func (s *Store) DeleteWorkGroup(name string) bool

DeleteWorkGroup deletes a workgroup. Returns false if not found.

func (*Store) GetDataCatalog

func (s *Store) GetDataCatalog(name string) (*DataCatalog, bool)

GetDataCatalog returns a data catalog by name.

func (*Store) GetNamedQuery

func (s *Store) GetNamedQuery(id string) (*NamedQuery, bool)

GetNamedQuery returns a named query by ID.

func (*Store) GetQueryExecution

func (s *Store) GetQueryExecution(id string) (*QueryExecution, bool)

GetQueryExecution returns a query execution by ID.

func (*Store) GetQueryResultSet

func (s *Store) GetQueryResultSet(executionID string) (*QueryResultSet, bool)

GetQueryResultSet returns mock results for a completed query execution.

func (*Store) GetWorkGroup

func (s *Store) GetWorkGroup(name string) (*WorkGroup, bool)

GetWorkGroup returns a workgroup by name.

func (*Store) ListDataCatalogs

func (s *Store) ListDataCatalogs() []*DataCatalog

ListDataCatalogs returns all data catalogs.

func (*Store) ListNamedQueries

func (s *Store) ListNamedQueries(workGroup string) []string

ListNamedQueries returns all named query IDs, optionally filtered by workgroup.

func (*Store) ListQueryExecutions

func (s *Store) ListQueryExecutions(workGroup string) []string

ListQueryExecutions returns all query execution IDs, optionally filtered by workgroup.

func (*Store) ListTagsForResource

func (s *Store) ListTagsForResource(arn string) (map[string]string, bool)

ListTagsForResource returns tags for the given resource ARN.

func (*Store) ListWorkGroups

func (s *Store) ListWorkGroups() []*WorkGroup

ListWorkGroups returns all workgroups.

func (*Store) SetLocator

func (s *Store) SetLocator(locator ServiceLocator)

SetLocator sets the service locator for cross-service lookups.

func (*Store) StartQueryExecution

func (s *Store) StartQueryExecution(query, database, workGroup, outputLocation string) *QueryExecution

StartQueryExecution creates a new query execution, parses and validates the SQL, and generates mock results for SELECT queries.

func (*Store) StopQueryExecution

func (s *Store) StopQueryExecution(id string) bool

StopQueryExecution cancels a query execution.

func (*Store) TagResource

func (s *Store) TagResource(arn string, tags map[string]string) bool

TagResource adds tags to a workgroup ARN.

func (*Store) UntagResource

func (s *Store) UntagResource(arn string, keys []string) bool

UntagResource removes tag keys from a workgroup ARN.

func (*Store) UpdateDataCatalog

func (s *Store) UpdateDataCatalog(name, description string, params map[string]string) bool

UpdateDataCatalog updates a data catalog's description and parameters.

func (*Store) UpdateWorkGroup

func (s *Store) UpdateWorkGroup(name, description, state string) (*WorkGroup, bool)

UpdateWorkGroup updates a workgroup's description and state.

type WorkGroup

type WorkGroup struct {
	Name          string
	Description   string
	State         string // ENABLED or DISABLED
	CreationTime  time.Time
	Tags          map[string]string
	Configuration WorkGroupConfiguration
}

WorkGroup represents an Athena workgroup.

type WorkGroupConfiguration

type WorkGroupConfiguration struct {
	ResultOutputLocation          string
	EnforceWorkGroupConfiguration bool
	BytesScannedCutoffPerQuery    int64
}

WorkGroupConfiguration holds workgroup settings.

Jump to

Keyboard shortcuts

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