1. Packages
  2. Astra DB
  3. API Docs
  4. Table
Astra DB v1.0.42 published on Tuesday, Jun 6, 2023 by pulumiverse

astra.Table

Explore with Pulumi AI

astra logo
Astra DB v1.0.42 published on Tuesday, Jun 6, 2023 by pulumiverse

    astra.Table provides a table resource which represents a table in cassandra.

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using Astra = Pulumiverse.Astra;
    
    return await Deployment.RunAsync(() => 
    {
        var dev = new Astra.Database("dev", new()
        {
            Keyspace = "puppies",
            CloudProvider = "gcp",
            Regions = new[]
            {
                "us-east1",
            },
        });
    
        var table_1 = new Astra.Table("table-1", new()
        {
            AstraTable = "mytable",
            Keyspace = "puppies",
            DatabaseId = dev.Id,
            Region = "us-east1",
            ClusteringColumns = "a:b",
            PartitionKeys = "c:d",
            ColumnDefinitions = new[]
            {
                
                {
                    { "Name", "a" },
                    { "Static", "false" },
                    { "TypeDefinition", "text" },
                },
                
                {
                    { "Name", "b" },
                    { "Static", "false" },
                    { "TypeDefinition", "text" },
                },
                
                {
                    { "Name", "c" },
                    { "Static", "false" },
                    { "TypeDefinition", "text" },
                },
                
                {
                    { "Name", "d" },
                    { "Static", "false" },
                    { "TypeDefinition", "text" },
                },
                
                {
                    { "Name", "e" },
                    { "Static", "false" },
                    { "TypeDefinition", "text" },
                },
                
                {
                    { "Name", "f" },
                    { "Static", "false" },
                    { "TypeDefinition", "text" },
                },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-astra/sdk/go/astra"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		dev, err := astra.NewDatabase(ctx, "dev", &astra.DatabaseArgs{
    			Keyspace:      pulumi.String("puppies"),
    			CloudProvider: pulumi.String("gcp"),
    			Regions: pulumi.StringArray{
    				pulumi.String("us-east1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = astra.NewTable(ctx, "table-1", &astra.TableArgs{
    			Table:             pulumi.String("mytable"),
    			Keyspace:          pulumi.String("puppies"),
    			DatabaseId:        dev.ID(),
    			Region:            pulumi.String("us-east1"),
    			ClusteringColumns: pulumi.String("a:b"),
    			PartitionKeys:     pulumi.String("c:d"),
    			ColumnDefinitions: pulumi.StringMapArray{
    				pulumi.StringMap{
    					"Name":           pulumi.String("a"),
    					"Static":         pulumi.String("false"),
    					"TypeDefinition": pulumi.String("text"),
    				},
    				pulumi.StringMap{
    					"Name":           pulumi.String("b"),
    					"Static":         pulumi.String("false"),
    					"TypeDefinition": pulumi.String("text"),
    				},
    				pulumi.StringMap{
    					"Name":           pulumi.String("c"),
    					"Static":         pulumi.String("false"),
    					"TypeDefinition": pulumi.String("text"),
    				},
    				pulumi.StringMap{
    					"Name":           pulumi.String("d"),
    					"Static":         pulumi.String("false"),
    					"TypeDefinition": pulumi.String("text"),
    				},
    				pulumi.StringMap{
    					"Name":           pulumi.String("e"),
    					"Static":         pulumi.String("false"),
    					"TypeDefinition": pulumi.String("text"),
    				},
    				pulumi.StringMap{
    					"Name":           pulumi.String("f"),
    					"Static":         pulumi.String("false"),
    					"TypeDefinition": pulumi.String("text"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.astra.Database;
    import com.pulumi.astra.DatabaseArgs;
    import com.pulumi.astra.Table;
    import com.pulumi.astra.TableArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 dev = new Database("dev", DatabaseArgs.builder()        
                .keyspace("puppies")
                .cloudProvider("gcp")
                .regions("us-east1")
                .build());
    
            var table_1 = new Table("table-1", TableArgs.builder()        
                .table("mytable")
                .keyspace("puppies")
                .databaseId(dev.id())
                .region("us-east1")
                .clusteringColumns("a:b")
                .partitionKeys("c:d")
                .columnDefinitions(            
                    Map.ofEntries(
                        Map.entry("Name", "a"),
                        Map.entry("Static", false),
                        Map.entry("TypeDefinition", "text")
                    ),
                    Map.ofEntries(
                        Map.entry("Name", "b"),
                        Map.entry("Static", false),
                        Map.entry("TypeDefinition", "text")
                    ),
                    Map.ofEntries(
                        Map.entry("Name", "c"),
                        Map.entry("Static", false),
                        Map.entry("TypeDefinition", "text")
                    ),
                    Map.ofEntries(
                        Map.entry("Name", "d"),
                        Map.entry("Static", false),
                        Map.entry("TypeDefinition", "text")
                    ),
                    Map.ofEntries(
                        Map.entry("Name", "e"),
                        Map.entry("Static", false),
                        Map.entry("TypeDefinition", "text")
                    ),
                    Map.ofEntries(
                        Map.entry("Name", "f"),
                        Map.entry("Static", false),
                        Map.entry("TypeDefinition", "text")
                    ))
                .build());
    
        }
    }
    
    import pulumi
    import pulumiverse_astra as astra
    
    dev = astra.Database("dev",
        keyspace="puppies",
        cloud_provider="gcp",
        regions=["us-east1"])
    table_1 = astra.Table("table-1",
        table="mytable",
        keyspace="puppies",
        database_id=dev.id,
        region="us-east1",
        clustering_columns="a:b",
        partition_keys="c:d",
        column_definitions=[
            {
                "Name": "a",
                "Static": "false",
                "TypeDefinition": "text",
            },
            {
                "Name": "b",
                "Static": "false",
                "TypeDefinition": "text",
            },
            {
                "Name": "c",
                "Static": "false",
                "TypeDefinition": "text",
            },
            {
                "Name": "d",
                "Static": "false",
                "TypeDefinition": "text",
            },
            {
                "Name": "e",
                "Static": "false",
                "TypeDefinition": "text",
            },
            {
                "Name": "f",
                "Static": "false",
                "TypeDefinition": "text",
            },
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as astra from "@pulumiverse/astra";
    
    const dev = new astra.Database("dev", {
        keyspace: "puppies",
        cloudProvider: "gcp",
        regions: ["us-east1"],
    });
    const table_1 = new astra.Table("table-1", {
        table: "mytable",
        keyspace: "puppies",
        databaseId: dev.id,
        region: "us-east1",
        clusteringColumns: "a:b",
        partitionKeys: "c:d",
        columnDefinitions: [
            {
                Name: "a",
                Static: "false",
                TypeDefinition: "text",
            },
            {
                Name: "b",
                Static: "false",
                TypeDefinition: "text",
            },
            {
                Name: "c",
                Static: "false",
                TypeDefinition: "text",
            },
            {
                Name: "d",
                Static: "false",
                TypeDefinition: "text",
            },
            {
                Name: "e",
                Static: "false",
                TypeDefinition: "text",
            },
            {
                Name: "f",
                Static: "false",
                TypeDefinition: "text",
            },
        ],
    });
    
    resources:
      dev:
        type: astra:Database
        properties:
          keyspace: puppies
          cloudProvider: gcp
          regions:
            - us-east1
      table-1:
        type: astra:Table
        properties:
          table: mytable
          keyspace: puppies
          databaseId: ${dev.id}
          region: us-east1
          clusteringColumns: a:b
          partitionKeys: c:d
          columnDefinitions:
            - Name: a
              Static: false
              TypeDefinition: text
            - Name: b
              Static: false
              TypeDefinition: text
            - Name: c
              Static: false
              TypeDefinition: text
            - Name: d
              Static: false
              TypeDefinition: text
            - Name: e
              Static: false
              TypeDefinition: text
            - Name: f
              Static: false
              TypeDefinition: text
    

    Create Table Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Table(name: string, args: TableArgs, opts?: CustomResourceOptions);
    @overload
    def Table(resource_name: str,
              args: TableArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Table(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              clustering_columns: Optional[str] = None,
              column_definitions: Optional[Sequence[Mapping[str, str]]] = None,
              database_id: Optional[str] = None,
              keyspace: Optional[str] = None,
              partition_keys: Optional[str] = None,
              region: Optional[str] = None,
              table: Optional[str] = None)
    func NewTable(ctx *Context, name string, args TableArgs, opts ...ResourceOption) (*Table, error)
    public Table(string name, TableArgs args, CustomResourceOptions? opts = null)
    public Table(String name, TableArgs args)
    public Table(String name, TableArgs args, CustomResourceOptions options)
    
    type: astra:Table
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args TableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args TableArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args TableArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TableArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var tableResource = new Astra.Table("tableResource", new()
    {
        ClusteringColumns = "string",
        ColumnDefinitions = new[]
        {
            
            {
                { "string", "string" },
            },
        },
        DatabaseId = "string",
        Keyspace = "string",
        PartitionKeys = "string",
        Region = "string",
        AstraTable = "string",
    });
    
    example, err := astra.NewTable(ctx, "tableResource", &astra.TableArgs{
    	ClusteringColumns: pulumi.String("string"),
    	ColumnDefinitions: pulumi.StringMapArray{
    		pulumi.StringMap{
    			"string": pulumi.String("string"),
    		},
    	},
    	DatabaseId:    pulumi.String("string"),
    	Keyspace:      pulumi.String("string"),
    	PartitionKeys: pulumi.String("string"),
    	Region:        pulumi.String("string"),
    	Table:         pulumi.String("string"),
    })
    
    var tableResource = new Table("tableResource", TableArgs.builder()        
        .clusteringColumns("string")
        .columnDefinitions(Map.of("string", "string"))
        .databaseId("string")
        .keyspace("string")
        .partitionKeys("string")
        .region("string")
        .table("string")
        .build());
    
    table_resource = astra.Table("tableResource",
        clustering_columns="string",
        column_definitions=[{
            "string": "string",
        }],
        database_id="string",
        keyspace="string",
        partition_keys="string",
        region="string",
        table="string")
    
    const tableResource = new astra.Table("tableResource", {
        clusteringColumns: "string",
        columnDefinitions: [{
            string: "string",
        }],
        databaseId: "string",
        keyspace: "string",
        partitionKeys: "string",
        region: "string",
        table: "string",
    });
    
    type: astra:Table
    properties:
        clusteringColumns: string
        columnDefinitions:
            - string: string
        databaseId: string
        keyspace: string
        partitionKeys: string
        region: string
        table: string
    

    Table Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Table resource accepts the following input properties:

    AstraTable string
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    ClusteringColumns string
    Clustering column(s), separated by :
    ColumnDefinitions List<ImmutableDictionary<string, string>>
    A list of table Definitions
    DatabaseId string
    Astra database to create the keyspace.
    Keyspace string
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    PartitionKeys string
    Partition key(s), separated by :
    Region string
    region.
    ClusteringColumns string
    Clustering column(s), separated by :
    ColumnDefinitions []map[string]string
    A list of table Definitions
    DatabaseId string
    Astra database to create the keyspace.
    Keyspace string
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    PartitionKeys string
    Partition key(s), separated by :
    Region string
    region.
    Table string
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clusteringColumns String
    Clustering column(s), separated by :
    columnDefinitions List<Map<String,String>>
    A list of table Definitions
    databaseId String
    Astra database to create the keyspace.
    keyspace String
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partitionKeys String
    Partition key(s), separated by :
    region String
    region.
    table String
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clusteringColumns string
    Clustering column(s), separated by :
    columnDefinitions {[key: string]: string}[]
    A list of table Definitions
    databaseId string
    Astra database to create the keyspace.
    keyspace string
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partitionKeys string
    Partition key(s), separated by :
    region string
    region.
    table string
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clustering_columns str
    Clustering column(s), separated by :
    column_definitions Sequence[Mapping[str, str]]
    A list of table Definitions
    database_id str
    Astra database to create the keyspace.
    keyspace str
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partition_keys str
    Partition key(s), separated by :
    region str
    region.
    table str
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clusteringColumns String
    Clustering column(s), separated by :
    columnDefinitions List<Map<String>>
    A list of table Definitions
    databaseId String
    Astra database to create the keyspace.
    keyspace String
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partitionKeys String
    Partition key(s), separated by :
    region String
    region.
    table String
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Table resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Table Resource

    Get an existing Table resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: TableState, opts?: CustomResourceOptions): Table
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            clustering_columns: Optional[str] = None,
            column_definitions: Optional[Sequence[Mapping[str, str]]] = None,
            database_id: Optional[str] = None,
            keyspace: Optional[str] = None,
            partition_keys: Optional[str] = None,
            region: Optional[str] = None,
            table: Optional[str] = None) -> Table
    func GetTable(ctx *Context, name string, id IDInput, state *TableState, opts ...ResourceOption) (*Table, error)
    public static Table Get(string name, Input<string> id, TableState? state, CustomResourceOptions? opts = null)
    public static Table get(String name, Output<String> id, TableState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AstraTable string
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    ClusteringColumns string
    Clustering column(s), separated by :
    ColumnDefinitions List<ImmutableDictionary<string, string>>
    A list of table Definitions
    DatabaseId string
    Astra database to create the keyspace.
    Keyspace string
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    PartitionKeys string
    Partition key(s), separated by :
    Region string
    region.
    ClusteringColumns string
    Clustering column(s), separated by :
    ColumnDefinitions []map[string]string
    A list of table Definitions
    DatabaseId string
    Astra database to create the keyspace.
    Keyspace string
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    PartitionKeys string
    Partition key(s), separated by :
    Region string
    region.
    Table string
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clusteringColumns String
    Clustering column(s), separated by :
    columnDefinitions List<Map<String,String>>
    A list of table Definitions
    databaseId String
    Astra database to create the keyspace.
    keyspace String
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partitionKeys String
    Partition key(s), separated by :
    region String
    region.
    table String
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clusteringColumns string
    Clustering column(s), separated by :
    columnDefinitions {[key: string]: string}[]
    A list of table Definitions
    databaseId string
    Astra database to create the keyspace.
    keyspace string
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partitionKeys string
    Partition key(s), separated by :
    region string
    region.
    table string
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clustering_columns str
    Clustering column(s), separated by :
    column_definitions Sequence[Mapping[str, str]]
    A list of table Definitions
    database_id str
    Astra database to create the keyspace.
    keyspace str
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partition_keys str
    Partition key(s), separated by :
    region str
    region.
    table str
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    clusteringColumns String
    Clustering column(s), separated by :
    columnDefinitions List<Map<String>>
    A list of table Definitions
    databaseId String
    Astra database to create the keyspace.
    keyspace String
    Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
    partitionKeys String
    Partition key(s), separated by :
    region String
    region.
    table String
    Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.

    Import

    the import id includes the database_id, keyspace name, and table name.

     $ pulumi import astra:index/table:Table example 48bfc13b-c1a5-48db-b70f-b6ef9709872b/kayspacename/tablename
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    astra pulumiverse/pulumi-astra
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the astra Terraform Provider.
    astra logo
    Astra DB v1.0.42 published on Tuesday, Jun 6, 2023 by pulumiverse