CreateTable #

Overview #

Creates a table in Athena with the name specified.

Method #


Import parameters #

This method uses the following import parameters.

  • i_table

    Name of the table to be created in Athena.

  • i_database

    Name of the Athena database where the table will be created.

  • i_fields

    Fields of the table that will be created. These fields must be informed with this special format: ‘Field name’ ‘Field formatspace,space

    We want to create a table with two fields, these fields have the name bukrs and belnr. Both fields have string format.
    i_fields = 'bukrs string , belnr string'
  • i_bucket

    This field allows you to indicate the location where the files related to this table will be added to the bucket. The value must be lower case.

    Add files to folder /tables/bkpf/ of the bucket d04-test.
      - i_bucket = 'd04-test/tables/bkpf/'.

Export Parameters #

This method use the following export parameters:

  • e_http_status

    HTTP Status code. Returns 200 if no errors found.

  • e_response_headers

    Returns information about the request in format Name/Value pair values.

  • e_response_content

    Returns response information.

Example #

DATA: lo_athena_tables TYPE REF TO /lnkaws/cl_aws_athena_tables,
      lo_cx_aws_s3     TYPE REF TO /lnkaws/cx_aws_s3,
      lv_http_status   TYPE i,
      lv_headers       TYPE tihttpnvp,
      lv_content       TYPE string.
    CREATE OBJECT lo_athena_tables
        i_region    = 'eu-west-1'
        i_user_name = 'userawsconnector'.

    CALL METHOD lo_athena_tables->create_table
        i_table            = 'bkpfdemo'
        i_database         = 'athenadb1'
        i_fields           = 'bukrs string , belnr string'
        i_bucket           = 'd04-test/tables/bkpf/'
        e_http_status      = lv_status
        e_response_headers = lv_headers
        e_response_content = lv_content.
  CATCH /lnkaws/cx_aws_s3 INTO lo_cx_aws_s3.
    RAISE EXCEPTION lo_cx_aws_s3.