work_group: Athena Work Groups

work_groupR Documentation

Athena Work Groups

Description

Lower level API access, allows user to create and delete Athena Work Groups.

create_work_group

Creates a workgroup with the specified name (link). The work group utilises parameters from the dbConnect object, to determine the encryption and output location of the work group. The s3_staging_dir, encryption_option and kms_key parameters are gotten from dbConnect

tag_options

Helper function to create tag options for function create_work_group()

delete_work_group

Deletes the workgroup with the specified name (link). The primary workgroup cannot be deleted.

list_work_groups

Lists available workgroups for the account (link).

get_work_group

Returns information about the workgroup with the specified name (link).

update_work_group

Updates the workgroup with the specified name (link). The workgroup's name cannot be changed. The work group utilises parameters from the dbConnect object, to determine the encryption and output location of the work group. The s3_staging_dir, encryption_option and kms_key parameters are gotten from dbConnect

Usage

create_work_group(
  conn,
  work_group = NULL,
  enforce_work_group_config = FALSE,
  publish_cloud_watch_metrics = FALSE,
  bytes_scanned_cut_off = 10000000L,
  requester_pays = FALSE,
  description = NULL,
  tags = tag_options(key = NULL, value = NULL)
)

tag_options(key = NULL, value = NULL)

delete_work_group(conn, work_group = NULL, recursive_delete_option = FALSE)

list_work_groups(conn)

get_work_group(conn, work_group = NULL)

update_work_group(
  conn,
  work_group = NULL,
  remove_output_location = FALSE,
  enforce_work_group_config = FALSE,
  publish_cloud_watch_metrics = FALSE,
  bytes_scanned_cut_off = 10000000L,
  requester_pays = FALSE,
  description = NULL,
  state = c("ENABLED", "DISABLED")
)

Arguments

conn

A dbConnect object, as returned by dbConnect()

work_group

The Athena workgroup name.

enforce_work_group_config

If set to TRUE, the settings for the workgroup override client-side settings. If set to FALSE, client-side settings are used. For more information, see Workgroup Settings Override Client-Side Settings.

publish_cloud_watch_metrics

Indicates that the Amazon CloudWatch metrics are enabled for the workgroup.

bytes_scanned_cut_off

The upper data usage limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan.

requester_pays

If set to TRUE, allows members assigned to a workgroup to reference Amazon S3 Requester Pays buckets in queries. If set to FALSE, workgroup members cannot query data from Requester Pays buckets, and queries that retrieve data from Requester Pays buckets cause an error. The default is false. For more information about Requester Pays buckets, see Requester Pays Buckets in the Amazon Simple Storage Service Developer Guide.

description

The workgroup description.

tags

A tag that you can add to a resource. A tag is a label that you assign to an AWS Athena resource (a workgroup). Each tag consists of a key and an optional value, both of which you define. Tags enable you to categorize workgroups in Athena, for example, by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter workgroups in your account. The maximum tag key length is 128 Unicode characters in UTF-8. The maximum tag value length is 256 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: "+ - = . _ : / @". Tag keys and values are case-sensitive. Tag keys must be unique per resource. Please use the helper function tag_options() to create tags for work group, if no tags are required please put NULL for this parameter.

key

A tag key. The tag key length is from 1 to 128 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: "+ - = . _ : / @". Tag keys are case-sensitive and must be unique per resource.

value

A tag value. The tag value length is from 0 to 256 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: "+ - = . _ : / @". Tag values are case-sensitive.

recursive_delete_option

The option to delete the workgroup and its contents even if the workgroup contains any named queries

remove_output_location

If set to TRUE, indicates that the previously-specified query results location (also known as a client-side setting) for queries in this workgroup should be ignored and set to null. If set to FALSE the out put location in the workgroup's result configuration will be updated with the new value. For more information, see Workgroup Settings Override Client-Side Settings.

state

The workgroup state that will be updated for the given workgroup.

Value

create_work_group

Returns NULL but invisible

tag_options

Returns list but invisible

delete_work_group

Returns NULL but invisible

list_work_groups

Returns list of available work groups

get_work_group

Returns list of work group meta data

update_work_group

Returns NULL but invisible

Examples

## Not run: 
# Note: 
# - Require AWS Account to run below example.
# - Different connection methods can be used please see `RAthena::dbConnect` documnentation

library(RAthena)

# Demo connection to Athena using profile name 
con <- dbConnect(RAthena::athena())

# List current work group available
list_work_groups(con)

# Create a new work group
wg <- create_work_group(con,
                  "demo_work_group",
                   description = "This is a demo work group",
                   tags = tag_options(key= "demo_work_group", value = "demo_01"))
 
# List work groups to see new work group
list_work_groups(con)

# get meta data from work group
wg <- get_work_group(con, "demo_work_group")

# Update work group
wg <- update_work_group(con, "demo_work_group",
                  description = "This is a demo work group update")


# get updated meta data from work group
wg <- get_work_group(con, "demo_work_group") 

# Delete work group
delete_work_group(con, "demo_work_group")

# Disconect from Athena
dbDisconnect(con)

## End(Not run)


RAthena documentation built on Dec. 28, 2022, 1:19 a.m.