Class CatalogTable


  • public class CatalogTable
    extends com.pulumi.resources.CustomResource
    Provides a Glue Catalog Table Resource. You can refer to the [Glue Developer Guide](http://docs.aws.amazon.com/glue/latest/dg/populate-data-catalog.html) for a full explanation of the Glue Data Catalog functionality. ## Example Usage ### Basic Table
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.glue.CatalogTable;
     import com.pulumi.aws.glue.CatalogTableArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new CatalogTable("example", CatalogTableArgs.builder()
                 .name("MyCatalogTable")
                 .databaseName("MyCatalogDatabase")
                 .build());
     
         }
     }
     
     
    ### Parquet Table for Athena
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.glue.CatalogTable;
     import com.pulumi.aws.glue.CatalogTableArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableStorageDescriptorArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableStorageDescriptorSerDeInfoArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableStorageDescriptorColumnArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new CatalogTable("example", CatalogTableArgs.builder()
                 .storageDescriptor(CatalogTableStorageDescriptorArgs.builder()
                     .serDeInfo(CatalogTableStorageDescriptorSerDeInfoArgs.builder()
                         .name("my-stream")
                         .serializationLibrary("org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe")
                         .parameters(Map.of("serialization.format", "1"))
                         .build())
                     .columns(                
                         CatalogTableStorageDescriptorColumnArgs.builder()
                             .name("my_string")
                             .type("string")
                             .build(),
                         CatalogTableStorageDescriptorColumnArgs.builder()
                             .name("my_double")
                             .type("double")
                             .build(),
                         CatalogTableStorageDescriptorColumnArgs.builder()
                             .name("my_date")
                             .type("date")
                             .comment("")
                             .build(),
                         CatalogTableStorageDescriptorColumnArgs.builder()
                             .name("my_bigint")
                             .type("bigint")
                             .comment("")
                             .build(),
                         CatalogTableStorageDescriptorColumnArgs.builder()
                             .name("my_struct")
                             .type("struct<my_nested_string:string>")
                             .comment("")
                             .build())
                     .location("s3://my-bucket/event-streams/my-stream")
                     .inputFormat("org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat")
                     .outputFormat("org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat")
                     .build())
                 .name("MyCatalogTable")
                 .databaseName("MyCatalogDatabase")
                 .tableType("EXTERNAL_TABLE")
                 .parameters(Map.ofEntries(
                     Map.entry("EXTERNAL", "TRUE"),
                     Map.entry("parquet.compression", "SNAPPY")
                 ))
                 .build());
     
         }
     }
     
     
    ### Iceberg Table
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.glue.CatalogTable;
     import com.pulumi.aws.glue.CatalogTableArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSchemaArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSchemaFieldArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputPartitionSpecArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputPartitionSpecFieldArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSortOrderArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSortOrderFieldArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new CatalogTable("example", CatalogTableArgs.builder()
                 .openTableFormatInput(CatalogTableOpenTableFormatInputArgs.builder()
                     .icebergInput(CatalogTableOpenTableFormatInputIcebergInputArgs.builder()
                         .icebergTableInput(CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputArgs.builder()
                             .schema(CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSchemaArgs.builder()
                                 .fields(                            
                                     CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSchemaFieldArgs.builder()
                                         .id(1)
                                         .name("transaction_id")
                                         .required(true)
                                         .type("""
                 \"string\"
                                         """)
                                         .build(),
                                     CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSchemaFieldArgs.builder()
                                         .id(2)
                                         .name("transaction_date")
                                         .required(true)
                                         .type("""
                 \"date\"
                                         """)
                                         .build(),
                                     CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSchemaFieldArgs.builder()
                                         .id(3)
                                         .name("monthly_balance")
                                         .required(true)
                                         .type("""
                 \"float\"
                                         """)
                                         .build())
                                 .schemaId(0)
                                 .type("struct")
                                 .build())
                             .partitionSpec(CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputPartitionSpecArgs.builder()
                                 .fields(CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputPartitionSpecFieldArgs.builder()
                                     .name("by_year")
                                     .sourceId(2)
                                     .transform("year")
                                     .build())
                                 .specId(0)
                                 .build())
                             .sortOrder(CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSortOrderArgs.builder()
                                 .fields(CatalogTableOpenTableFormatInputIcebergInputIcebergTableInputSortOrderFieldArgs.builder()
                                     .direction("asc")
                                     .nullOrder("nulls-last")
                                     .sourceId(1)
                                     .transform("none")
                                     .build())
                                 .orderId(1)
                                 .build())
                             .location("s3://sampledatabucket/bankdataiceberg/transactiontable1/")
                             .build())
                         .metadataOperation("CREATE")
                         .version("2")
                         .build())
                     .build())
                 .name("transactiontable1")
                 .databaseName("bankdata_icebergdb")
                 .build());
     
         }
     }
     
     
    ### Protected View
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.glue.CatalogTable;
     import com.pulumi.aws.glue.CatalogTableArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableViewDefinitionArgs;
     import com.pulumi.aws.glue.inputs.CatalogTableViewDefinitionRepresentationArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new CatalogTable("example", CatalogTableArgs.builder()
                 .viewDefinition(CatalogTableViewDefinitionArgs.builder()
                     .representations(CatalogTableViewDefinitionRepresentationArgs.builder()
                         .dialect("ATHENA")
                         .dialectVersion("3")
                         .viewOriginalText("SELECT * FROM catalog_database.base_table")
                         .validationConnection(exampleAwsGlueConnection.name())
                         .build())
                     .isProtected(true)
                     .build())
                 .name("multidialect_view")
                 .databaseName("catalog_database")
                 .tableType("VIRTUAL_VIEW")
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `catalogId` - (String) ID of the Glue Catalog. * `databaseName` - (String) Name of the Glue Catalog Database. * `name` - (String) Name of the Glue Catalog Table. #### Optional * `accountId` - (String) AWS Account where this resource is managed. * `region` - (String) Region where this resource is managed. Using `pulumi import`, import Glue Tables using the catalog ID (usually AWS account ID), database name, and table name. For example: ```sh $ pulumi import aws:glue/catalogTable:CatalogTable MyTable 123456789012:MyDatabase:MyTable ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Detail

      • CatalogTable

        public CatalogTable​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • CatalogTable

        public CatalogTable​(java.lang.String name,
                            CatalogTableArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • CatalogTable

        public CatalogTable​(java.lang.String name,
                            CatalogTableArgs args,
                            @Nullable
                            com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the Glue Table.
      • catalogId

        public com.pulumi.core.Output<java.lang.String> catalogId()
        Returns:
        ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
      • databaseName

        public com.pulumi.core.Output<java.lang.String> databaseName()
        Returns:
        Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
      • description

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
        Returns:
        Description of the table.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the table. For Hive compatibility, this must be entirely lowercase. The following arguments are optional:
      • openTableFormatInput

        public com.pulumi.core.Output<java.util.Optional<CatalogTableOpenTableFormatInput>> openTableFormatInput()
        Returns:
        Configuration block for open table formats. See `openTableFormatInput` below.
      • owner

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> owner()
        Returns:
        Owner of the table.
      • parameters

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> parameters()
        Returns:
        Properties associated with this table, as a map of key-value pairs.
      • partitionIndices

        public com.pulumi.core.Output<java.util.List<CatalogTablePartitionIndex>> partitionIndices()
        Returns:
        Configuration block for a maximum of 3 partition indexes. See `partitionIndex` below.
      • partitionKeys

        public com.pulumi.core.Output<java.util.Optional<java.util.List<CatalogTablePartitionKey>>> partitionKeys()
        Returns:
        Configuration block of columns by which the table is partitioned. Only primitive types are supported as partition keys. See `partitionKeys` below.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • retention

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> retention()
        Returns:
        Retention time for this table.
      • storageDescriptor

        public com.pulumi.core.Output<CatalogTableStorageDescriptor> storageDescriptor()
        Returns:
        Configuration block for information about the physical storage of this table. For more information, refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor). See `storageDescriptor` below.
      • tableType

        public com.pulumi.core.Output<java.lang.String> tableType()
        Returns:
        Type of this table (EXTERNAL_TABLE, VIRTUAL_VIEW, etc.). While optional, some Athena DDL queries such as `ALTER TABLE` and `SHOW CREATE TABLE` will fail if this argument is empty.
      • targetTable

        public com.pulumi.core.Output<java.util.Optional<CatalogTableTargetTable>> targetTable()
        Returns:
        Configuration block of a target table for resource linking. See `targetTable` below.
      • viewDefinition

        public com.pulumi.core.Output<CatalogTableViewDefinition> viewDefinition()
        Returns:
        Structure that contains all the information that defines the view, including the dialect or dialects for the view, and the query. See `viewDefinition` below.
      • viewExpandedText

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> viewExpandedText()
        Returns:
        If the table is a view, the expanded text of the view; otherwise null.
      • viewOriginalText

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> viewOriginalText()
        Returns:
        If the table is a view, the original text of the view; otherwise null.
      • get

        public static CatalogTable get​(java.lang.String name,
                                       com.pulumi.core.Output<java.lang.String> id,
                                       @Nullable
                                       CatalogTableState state,
                                       @Nullable
                                       com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.