Skip to content

Athena Create Table #3665

Open
Open
@rhboyd

Description

@rhboyd
  • I'm submitting a ...

    • 🪲 bug report
    • 🚀 feature request
    • 📚 construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior?
    Athena Cfn and SDKs don't expose a friendly way to create tables

  • What is the expected behavior (or behavior of feature suggested)?
    I'd propose a construct that takes

  • bucket name

  • path

  • columns: list of tuples (name, type)

  • data format (probably best as an enum)

  • partitions (subset of columns)

Then uses the AWS SDK Custom Resource on the Athena SDK to execute

querystring = """
  CREATE EXTERNAL TABLE IF NOT EXISTS mydb.table_name (
    `columns[0][0]` columns[0][1],
    `columns[1][0]` columns[1][1]
    etc...
  )
  ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
  WITH SERDEPROPERTIES (
    {data_format}
  ) LOCATION 's3://{bucket_name}/{path}'
  TBLPROPERTIES ('has_encrypted_data'='false');
"""
response = client.start_query_execution(
    QueryString=querystring,
    ClientRequestToken='string',
    QueryExecutionContext={
        'Database': 'string'
    },
    ResultConfiguration={
        'OutputLocation': 'string',
        'EncryptionConfiguration': {
            'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
            'KmsKey': 'string'
        }
    },
    WorkGroup='string'
)
  • What is the motivation / use case for changing the behavior or adding this feature?
    Athena is the goddess of wisdom and civilization, how can we be a civilized developer tool if we don't support her?

  • Please tell us about your environment:
    All of them

  • Other information
    <3

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-athenaRelated to AWS Athenaeffort/largeLarge work item – several weeks of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions