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.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" },
            },
        },
    });

});
Copy
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
	})
}
Copy
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());

    }
}
Copy
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",
        },
    ],
});
Copy
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",
        },
    ])
Copy
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
Copy

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 This property is required. string
The unique name of the resource.
args This property is required. TableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. TableArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. TableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TableArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor 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",
});
Copy
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"),
})
Copy
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());
Copy
table_resource = astra.Table("tableResource",
    clustering_columns="string",
    column_definitions=[{
        "string": "string",
    }],
    database_id="string",
    keyspace="string",
    partition_keys="string",
    region="string",
    table="string")
Copy
const tableResource = new astra.Table("tableResource", {
    clusteringColumns: "string",
    columnDefinitions: [{
        string: "string",
    }],
    databaseId: "string",
    keyspace: "string",
    partitionKeys: "string",
    region: "string",
    table: "string",
});
Copy
type: astra:Table
properties:
    clusteringColumns: string
    columnDefinitions:
        - string: string
    databaseId: string
    keyspace: string
    partitionKeys: string
    region: string
    table: string
Copy

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

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Table resource accepts the following input properties:

AstraTable
This property is required.
Changes to this property will trigger replacement.
string
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
ClusteringColumns
This property is required.
Changes to this property will trigger replacement.
string
Clustering column(s), separated by :
ColumnDefinitions
This property is required.
Changes to this property will trigger replacement.
List<ImmutableDictionary<string, string>>
A list of table Definitions
DatabaseId
This property is required.
Changes to this property will trigger replacement.
string
Astra database to create the keyspace.
Keyspace
This property is required.
Changes to this property will trigger replacement.
string
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
PartitionKeys
This property is required.
Changes to this property will trigger replacement.
string
Partition key(s), separated by :
Region
This property is required.
Changes to this property will trigger replacement.
string
region.
ClusteringColumns
This property is required.
Changes to this property will trigger replacement.
string
Clustering column(s), separated by :
ColumnDefinitions
This property is required.
Changes to this property will trigger replacement.
[]map[string]string
A list of table Definitions
DatabaseId
This property is required.
Changes to this property will trigger replacement.
string
Astra database to create the keyspace.
Keyspace
This property is required.
Changes to this property will trigger replacement.
string
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
PartitionKeys
This property is required.
Changes to this property will trigger replacement.
string
Partition key(s), separated by :
Region
This property is required.
Changes to this property will trigger replacement.
string
region.
Table
This property is required.
Changes to this property will trigger replacement.
string
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clusteringColumns
This property is required.
Changes to this property will trigger replacement.
String
Clustering column(s), separated by :
columnDefinitions
This property is required.
Changes to this property will trigger replacement.
List<Map<String,String>>
A list of table Definitions
databaseId
This property is required.
Changes to this property will trigger replacement.
String
Astra database to create the keyspace.
keyspace
This property is required.
Changes to this property will trigger replacement.
String
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partitionKeys
This property is required.
Changes to this property will trigger replacement.
String
Partition key(s), separated by :
region
This property is required.
Changes to this property will trigger replacement.
String
region.
table
This property is required.
Changes to this property will trigger replacement.
String
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clusteringColumns
This property is required.
Changes to this property will trigger replacement.
string
Clustering column(s), separated by :
columnDefinitions
This property is required.
Changes to this property will trigger replacement.
{[key: string]: string}[]
A list of table Definitions
databaseId
This property is required.
Changes to this property will trigger replacement.
string
Astra database to create the keyspace.
keyspace
This property is required.
Changes to this property will trigger replacement.
string
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partitionKeys
This property is required.
Changes to this property will trigger replacement.
string
Partition key(s), separated by :
region
This property is required.
Changes to this property will trigger replacement.
string
region.
table
This property is required.
Changes to this property will trigger replacement.
string
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clustering_columns
This property is required.
Changes to this property will trigger replacement.
str
Clustering column(s), separated by :
column_definitions
This property is required.
Changes to this property will trigger replacement.
Sequence[Mapping[str, str]]
A list of table Definitions
database_id
This property is required.
Changes to this property will trigger replacement.
str
Astra database to create the keyspace.
keyspace
This property is required.
Changes to this property will trigger replacement.
str
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partition_keys
This property is required.
Changes to this property will trigger replacement.
str
Partition key(s), separated by :
region
This property is required.
Changes to this property will trigger replacement.
str
region.
table
This property is required.
Changes to this property will trigger replacement.
str
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clusteringColumns
This property is required.
Changes to this property will trigger replacement.
String
Clustering column(s), separated by :
columnDefinitions
This property is required.
Changes to this property will trigger replacement.
List<Map<String>>
A list of table Definitions
databaseId
This property is required.
Changes to this property will trigger replacement.
String
Astra database to create the keyspace.
keyspace
This property is required.
Changes to this property will trigger replacement.
String
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partitionKeys
This property is required.
Changes to this property will trigger replacement.
String
Partition key(s), separated by :
region
This property is required.
Changes to this property will trigger replacement.
String
region.
table
This property is required.
Changes to this property will trigger replacement.
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)
resources:  _:    type: astra:Table    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 Changes to this property will trigger replacement. string
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
ClusteringColumns Changes to this property will trigger replacement. string
Clustering column(s), separated by :
ColumnDefinitions Changes to this property will trigger replacement. List<ImmutableDictionary<string, string>>
A list of table Definitions
DatabaseId Changes to this property will trigger replacement. string
Astra database to create the keyspace.
Keyspace Changes to this property will trigger replacement. string
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
PartitionKeys Changes to this property will trigger replacement. string
Partition key(s), separated by :
Region Changes to this property will trigger replacement. string
region.
ClusteringColumns Changes to this property will trigger replacement. string
Clustering column(s), separated by :
ColumnDefinitions Changes to this property will trigger replacement. []map[string]string
A list of table Definitions
DatabaseId Changes to this property will trigger replacement. string
Astra database to create the keyspace.
Keyspace Changes to this property will trigger replacement. string
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
PartitionKeys Changes to this property will trigger replacement. string
Partition key(s), separated by :
Region Changes to this property will trigger replacement. string
region.
Table Changes to this property will trigger replacement. string
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clusteringColumns Changes to this property will trigger replacement. String
Clustering column(s), separated by :
columnDefinitions Changes to this property will trigger replacement. List<Map<String,String>>
A list of table Definitions
databaseId Changes to this property will trigger replacement. String
Astra database to create the keyspace.
keyspace Changes to this property will trigger replacement. String
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partitionKeys Changes to this property will trigger replacement. String
Partition key(s), separated by :
region Changes to this property will trigger replacement. String
region.
table Changes to this property will trigger replacement. String
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clusteringColumns Changes to this property will trigger replacement. string
Clustering column(s), separated by :
columnDefinitions Changes to this property will trigger replacement. {[key: string]: string}[]
A list of table Definitions
databaseId Changes to this property will trigger replacement. string
Astra database to create the keyspace.
keyspace Changes to this property will trigger replacement. string
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partitionKeys Changes to this property will trigger replacement. string
Partition key(s), separated by :
region Changes to this property will trigger replacement. string
region.
table Changes to this property will trigger replacement. string
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clustering_columns Changes to this property will trigger replacement. str
Clustering column(s), separated by :
column_definitions Changes to this property will trigger replacement. Sequence[Mapping[str, str]]
A list of table Definitions
database_id Changes to this property will trigger replacement. str
Astra database to create the keyspace.
keyspace Changes to this property will trigger replacement. str
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partition_keys Changes to this property will trigger replacement. str
Partition key(s), separated by :
region Changes to this property will trigger replacement. str
region.
table Changes to this property will trigger replacement. str
Table name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
clusteringColumns Changes to this property will trigger replacement. String
Clustering column(s), separated by :
columnDefinitions Changes to this property will trigger replacement. List<Map<String>>
A list of table Definitions
databaseId Changes to this property will trigger replacement. String
Astra database to create the keyspace.
keyspace Changes to this property will trigger replacement. String
Keyspace name can have up to 48 alpha-numeric characters and contain underscores; only letters are supported as the first character.
partitionKeys Changes to this property will trigger replacement. String
Partition key(s), separated by :
region Changes to this property will trigger replacement. String
region.
table Changes to this property will trigger replacement. 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
Copy

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.