1. Packages
  2. Snowflake
  3. API Docs
  4. TableConstraint
Snowflake v0.52.0 published on Thursday, Apr 18, 2024 by Pulumi

snowflake.TableConstraint

Explore with Pulumi AI

snowflake logo
Snowflake v0.52.0 published on Thursday, Apr 18, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as snowflake from "@pulumi/snowflake";
    
    const database = new snowflake.Database("database", {});
    const schema = new snowflake.Schema("schema", {database: database.name});
    const table = new snowflake.Table("table", {
        database: database.name,
        schema: schema.name,
        columns: [
            {
                name: "col1",
                type: "text",
                nullable: false,
            },
            {
                name: "col2",
                type: "text",
                nullable: false,
            },
            {
                name: "col3",
                type: "text",
                nullable: false,
            },
        ],
    });
    const fkT = new snowflake.Table("fkT", {
        database: database.name,
        schema: schema.name,
        columns: [
            {
                name: "fk_col1",
                type: "text",
                nullable: false,
            },
            {
                name: "fk_col2",
                type: "text",
                nullable: false,
            },
        ],
    });
    const primaryKey = new snowflake.TableConstraint("primaryKey", {
        type: "PRIMARY KEY",
        tableId: table.qualifiedName,
        columns: ["col1"],
        comment: "hello world",
    });
    const foreignKey = new snowflake.TableConstraint("foreignKey", {
        type: "FOREIGN KEY",
        tableId: table.qualifiedName,
        columns: ["col2"],
        foreignKeyProperties: {
            references: {
                tableId: fkT.qualifiedName,
                columns: ["fk_col1"],
            },
        },
        enforced: false,
        deferrable: false,
        initially: "IMMEDIATE",
        comment: "hello fk",
    });
    const unique = new snowflake.TableConstraint("unique", {
        type: "UNIQUE",
        tableId: table.qualifiedName,
        columns: ["col3"],
        comment: "hello unique",
    });
    
    import pulumi
    import pulumi_snowflake as snowflake
    
    database = snowflake.Database("database")
    schema = snowflake.Schema("schema", database=database.name)
    table = snowflake.Table("table",
        database=database.name,
        schema=schema.name,
        columns=[
            snowflake.TableColumnArgs(
                name="col1",
                type="text",
                nullable=False,
            ),
            snowflake.TableColumnArgs(
                name="col2",
                type="text",
                nullable=False,
            ),
            snowflake.TableColumnArgs(
                name="col3",
                type="text",
                nullable=False,
            ),
        ])
    fk_t = snowflake.Table("fkT",
        database=database.name,
        schema=schema.name,
        columns=[
            snowflake.TableColumnArgs(
                name="fk_col1",
                type="text",
                nullable=False,
            ),
            snowflake.TableColumnArgs(
                name="fk_col2",
                type="text",
                nullable=False,
            ),
        ])
    primary_key = snowflake.TableConstraint("primaryKey",
        type="PRIMARY KEY",
        table_id=table.qualified_name,
        columns=["col1"],
        comment="hello world")
    foreign_key = snowflake.TableConstraint("foreignKey",
        type="FOREIGN KEY",
        table_id=table.qualified_name,
        columns=["col2"],
        foreign_key_properties=snowflake.TableConstraintForeignKeyPropertiesArgs(
            references=snowflake.TableConstraintForeignKeyPropertiesReferencesArgs(
                table_id=fk_t.qualified_name,
                columns=["fk_col1"],
            ),
        ),
        enforced=False,
        deferrable=False,
        initially="IMMEDIATE",
        comment="hello fk")
    unique = snowflake.TableConstraint("unique",
        type="UNIQUE",
        table_id=table.qualified_name,
        columns=["col3"],
        comment="hello unique")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-snowflake/sdk/go/snowflake"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		database, err := snowflake.NewDatabase(ctx, "database", nil)
    		if err != nil {
    			return err
    		}
    		schema, err := snowflake.NewSchema(ctx, "schema", &snowflake.SchemaArgs{
    			Database: database.Name,
    		})
    		if err != nil {
    			return err
    		}
    		table, err := snowflake.NewTable(ctx, "table", &snowflake.TableArgs{
    			Database: database.Name,
    			Schema:   schema.Name,
    			Columns: snowflake.TableColumnArray{
    				&snowflake.TableColumnArgs{
    					Name:     pulumi.String("col1"),
    					Type:     pulumi.String("text"),
    					Nullable: pulumi.Bool(false),
    				},
    				&snowflake.TableColumnArgs{
    					Name:     pulumi.String("col2"),
    					Type:     pulumi.String("text"),
    					Nullable: pulumi.Bool(false),
    				},
    				&snowflake.TableColumnArgs{
    					Name:     pulumi.String("col3"),
    					Type:     pulumi.String("text"),
    					Nullable: pulumi.Bool(false),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fkT, err := snowflake.NewTable(ctx, "fkT", &snowflake.TableArgs{
    			Database: database.Name,
    			Schema:   schema.Name,
    			Columns: snowflake.TableColumnArray{
    				&snowflake.TableColumnArgs{
    					Name:     pulumi.String("fk_col1"),
    					Type:     pulumi.String("text"),
    					Nullable: pulumi.Bool(false),
    				},
    				&snowflake.TableColumnArgs{
    					Name:     pulumi.String("fk_col2"),
    					Type:     pulumi.String("text"),
    					Nullable: pulumi.Bool(false),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewTableConstraint(ctx, "primaryKey", &snowflake.TableConstraintArgs{
    			Type:    pulumi.String("PRIMARY KEY"),
    			TableId: table.QualifiedName,
    			Columns: pulumi.StringArray{
    				pulumi.String("col1"),
    			},
    			Comment: pulumi.String("hello world"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewTableConstraint(ctx, "foreignKey", &snowflake.TableConstraintArgs{
    			Type:    pulumi.String("FOREIGN KEY"),
    			TableId: table.QualifiedName,
    			Columns: pulumi.StringArray{
    				pulumi.String("col2"),
    			},
    			ForeignKeyProperties: &snowflake.TableConstraintForeignKeyPropertiesArgs{
    				References: &snowflake.TableConstraintForeignKeyPropertiesReferencesArgs{
    					TableId: fkT.QualifiedName,
    					Columns: pulumi.StringArray{
    						pulumi.String("fk_col1"),
    					},
    				},
    			},
    			Enforced:   pulumi.Bool(false),
    			Deferrable: pulumi.Bool(false),
    			Initially:  pulumi.String("IMMEDIATE"),
    			Comment:    pulumi.String("hello fk"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewTableConstraint(ctx, "unique", &snowflake.TableConstraintArgs{
    			Type:    pulumi.String("UNIQUE"),
    			TableId: table.QualifiedName,
    			Columns: pulumi.StringArray{
    				pulumi.String("col3"),
    			},
    			Comment: pulumi.String("hello unique"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Snowflake = Pulumi.Snowflake;
    
    return await Deployment.RunAsync(() => 
    {
        var database = new Snowflake.Database("database");
    
        var schema = new Snowflake.Schema("schema", new()
        {
            Database = database.Name,
        });
    
        var table = new Snowflake.Table("table", new()
        {
            Database = database.Name,
            Schema = schema.Name,
            Columns = new[]
            {
                new Snowflake.Inputs.TableColumnArgs
                {
                    Name = "col1",
                    Type = "text",
                    Nullable = false,
                },
                new Snowflake.Inputs.TableColumnArgs
                {
                    Name = "col2",
                    Type = "text",
                    Nullable = false,
                },
                new Snowflake.Inputs.TableColumnArgs
                {
                    Name = "col3",
                    Type = "text",
                    Nullable = false,
                },
            },
        });
    
        var fkT = new Snowflake.Table("fkT", new()
        {
            Database = database.Name,
            Schema = schema.Name,
            Columns = new[]
            {
                new Snowflake.Inputs.TableColumnArgs
                {
                    Name = "fk_col1",
                    Type = "text",
                    Nullable = false,
                },
                new Snowflake.Inputs.TableColumnArgs
                {
                    Name = "fk_col2",
                    Type = "text",
                    Nullable = false,
                },
            },
        });
    
        var primaryKey = new Snowflake.TableConstraint("primaryKey", new()
        {
            Type = "PRIMARY KEY",
            TableId = table.QualifiedName,
            Columns = new[]
            {
                "col1",
            },
            Comment = "hello world",
        });
    
        var foreignKey = new Snowflake.TableConstraint("foreignKey", new()
        {
            Type = "FOREIGN KEY",
            TableId = table.QualifiedName,
            Columns = new[]
            {
                "col2",
            },
            ForeignKeyProperties = new Snowflake.Inputs.TableConstraintForeignKeyPropertiesArgs
            {
                References = new Snowflake.Inputs.TableConstraintForeignKeyPropertiesReferencesArgs
                {
                    TableId = fkT.QualifiedName,
                    Columns = new[]
                    {
                        "fk_col1",
                    },
                },
            },
            Enforced = false,
            Deferrable = false,
            Initially = "IMMEDIATE",
            Comment = "hello fk",
        });
    
        var unique = new Snowflake.TableConstraint("unique", new()
        {
            Type = "UNIQUE",
            TableId = table.QualifiedName,
            Columns = new[]
            {
                "col3",
            },
            Comment = "hello unique",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.snowflake.Database;
    import com.pulumi.snowflake.Schema;
    import com.pulumi.snowflake.SchemaArgs;
    import com.pulumi.snowflake.Table;
    import com.pulumi.snowflake.TableArgs;
    import com.pulumi.snowflake.inputs.TableColumnArgs;
    import com.pulumi.snowflake.TableConstraint;
    import com.pulumi.snowflake.TableConstraintArgs;
    import com.pulumi.snowflake.inputs.TableConstraintForeignKeyPropertiesArgs;
    import com.pulumi.snowflake.inputs.TableConstraintForeignKeyPropertiesReferencesArgs;
    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 database = new Database("database");
    
            var schema = new Schema("schema", SchemaArgs.builder()        
                .database(database.name())
                .build());
    
            var table = new Table("table", TableArgs.builder()        
                .database(database.name())
                .schema(schema.name())
                .columns(            
                    TableColumnArgs.builder()
                        .name("col1")
                        .type("text")
                        .nullable(false)
                        .build(),
                    TableColumnArgs.builder()
                        .name("col2")
                        .type("text")
                        .nullable(false)
                        .build(),
                    TableColumnArgs.builder()
                        .name("col3")
                        .type("text")
                        .nullable(false)
                        .build())
                .build());
    
            var fkT = new Table("fkT", TableArgs.builder()        
                .database(database.name())
                .schema(schema.name())
                .columns(            
                    TableColumnArgs.builder()
                        .name("fk_col1")
                        .type("text")
                        .nullable(false)
                        .build(),
                    TableColumnArgs.builder()
                        .name("fk_col2")
                        .type("text")
                        .nullable(false)
                        .build())
                .build());
    
            var primaryKey = new TableConstraint("primaryKey", TableConstraintArgs.builder()        
                .type("PRIMARY KEY")
                .tableId(table.qualifiedName())
                .columns("col1")
                .comment("hello world")
                .build());
    
            var foreignKey = new TableConstraint("foreignKey", TableConstraintArgs.builder()        
                .type("FOREIGN KEY")
                .tableId(table.qualifiedName())
                .columns("col2")
                .foreignKeyProperties(TableConstraintForeignKeyPropertiesArgs.builder()
                    .references(TableConstraintForeignKeyPropertiesReferencesArgs.builder()
                        .tableId(fkT.qualifiedName())
                        .columns("fk_col1")
                        .build())
                    .build())
                .enforced(false)
                .deferrable(false)
                .initially("IMMEDIATE")
                .comment("hello fk")
                .build());
    
            var unique = new TableConstraint("unique", TableConstraintArgs.builder()        
                .type("UNIQUE")
                .tableId(table.qualifiedName())
                .columns("col3")
                .comment("hello unique")
                .build());
    
        }
    }
    
    resources:
      database:
        type: snowflake:Database
      schema:
        type: snowflake:Schema
        properties:
          database: ${database.name}
      table:
        type: snowflake:Table
        properties:
          database: ${database.name}
          schema: ${schema.name}
          columns:
            - name: col1
              type: text
              nullable: false
            - name: col2
              type: text
              nullable: false
            - name: col3
              type: text
              nullable: false
      fkT:
        type: snowflake:Table
        properties:
          database: ${database.name}
          schema: ${schema.name}
          columns:
            - name: fk_col1
              type: text
              nullable: false
            - name: fk_col2
              type: text
              nullable: false
      primaryKey:
        type: snowflake:TableConstraint
        properties:
          type: PRIMARY KEY
          tableId: ${table.qualifiedName}
          columns:
            - col1
          comment: hello world
      foreignKey:
        type: snowflake:TableConstraint
        properties:
          type: FOREIGN KEY
          tableId: ${table.qualifiedName}
          columns:
            - col2
          foreignKeyProperties:
            references:
              tableId: ${fkT.qualifiedName}
              columns:
                - fk_col1
          enforced: false
          deferrable: false
          initially: IMMEDIATE
          comment: hello fk
      unique:
        type: snowflake:TableConstraint
        properties:
          type: UNIQUE
          tableId: ${table.qualifiedName}
          columns:
            - col3
          comment: hello unique
    

    Create TableConstraint Resource

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

    Constructor syntax

    new TableConstraint(name: string, args: TableConstraintArgs, opts?: CustomResourceOptions);
    @overload
    def TableConstraint(resource_name: str,
                        args: TableConstraintArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def TableConstraint(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        columns: Optional[Sequence[str]] = None,
                        table_id: Optional[str] = None,
                        type: Optional[str] = None,
                        comment: Optional[str] = None,
                        deferrable: Optional[bool] = None,
                        enable: Optional[bool] = None,
                        enforced: Optional[bool] = None,
                        foreign_key_properties: Optional[TableConstraintForeignKeyPropertiesArgs] = None,
                        initially: Optional[str] = None,
                        name: Optional[str] = None,
                        rely: Optional[bool] = None,
                        validate: Optional[bool] = None)
    func NewTableConstraint(ctx *Context, name string, args TableConstraintArgs, opts ...ResourceOption) (*TableConstraint, error)
    public TableConstraint(string name, TableConstraintArgs args, CustomResourceOptions? opts = null)
    public TableConstraint(String name, TableConstraintArgs args)
    public TableConstraint(String name, TableConstraintArgs args, CustomResourceOptions options)
    
    type: snowflake:TableConstraint
    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 TableConstraintArgs
    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 TableConstraintArgs
    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 TableConstraintArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TableConstraintArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TableConstraintArgs
    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 tableConstraintResource = new Snowflake.TableConstraint("tableConstraintResource", new()
    {
        Columns = new[]
        {
            "string",
        },
        TableId = "string",
        Type = "string",
        Deferrable = false,
        Enable = false,
        Enforced = false,
        ForeignKeyProperties = new Snowflake.Inputs.TableConstraintForeignKeyPropertiesArgs
        {
            Match = "string",
            OnDelete = "string",
            OnUpdate = "string",
            References = new Snowflake.Inputs.TableConstraintForeignKeyPropertiesReferencesArgs
            {
                Columns = new[]
                {
                    "string",
                },
                TableId = "string",
            },
        },
        Initially = "string",
        Name = "string",
        Rely = false,
        Validate = false,
    });
    
    example, err := snowflake.NewTableConstraint(ctx, "tableConstraintResource", &snowflake.TableConstraintArgs{
    	Columns: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	TableId:    pulumi.String("string"),
    	Type:       pulumi.String("string"),
    	Deferrable: pulumi.Bool(false),
    	Enable:     pulumi.Bool(false),
    	Enforced:   pulumi.Bool(false),
    	ForeignKeyProperties: &snowflake.TableConstraintForeignKeyPropertiesArgs{
    		Match:    pulumi.String("string"),
    		OnDelete: pulumi.String("string"),
    		OnUpdate: pulumi.String("string"),
    		References: &snowflake.TableConstraintForeignKeyPropertiesReferencesArgs{
    			Columns: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			TableId: pulumi.String("string"),
    		},
    	},
    	Initially: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    	Rely:      pulumi.Bool(false),
    	Validate:  pulumi.Bool(false),
    })
    
    var tableConstraintResource = new TableConstraint("tableConstraintResource", TableConstraintArgs.builder()        
        .columns("string")
        .tableId("string")
        .type("string")
        .deferrable(false)
        .enable(false)
        .enforced(false)
        .foreignKeyProperties(TableConstraintForeignKeyPropertiesArgs.builder()
            .match("string")
            .onDelete("string")
            .onUpdate("string")
            .references(TableConstraintForeignKeyPropertiesReferencesArgs.builder()
                .columns("string")
                .tableId("string")
                .build())
            .build())
        .initially("string")
        .name("string")
        .rely(false)
        .validate(false)
        .build());
    
    table_constraint_resource = snowflake.TableConstraint("tableConstraintResource",
        columns=["string"],
        table_id="string",
        type="string",
        deferrable=False,
        enable=False,
        enforced=False,
        foreign_key_properties=snowflake.TableConstraintForeignKeyPropertiesArgs(
            match="string",
            on_delete="string",
            on_update="string",
            references=snowflake.TableConstraintForeignKeyPropertiesReferencesArgs(
                columns=["string"],
                table_id="string",
            ),
        ),
        initially="string",
        name="string",
        rely=False,
        validate=False)
    
    const tableConstraintResource = new snowflake.TableConstraint("tableConstraintResource", {
        columns: ["string"],
        tableId: "string",
        type: "string",
        deferrable: false,
        enable: false,
        enforced: false,
        foreignKeyProperties: {
            match: "string",
            onDelete: "string",
            onUpdate: "string",
            references: {
                columns: ["string"],
                tableId: "string",
            },
        },
        initially: "string",
        name: "string",
        rely: false,
        validate: false,
    });
    
    type: snowflake:TableConstraint
    properties:
        columns:
            - string
        deferrable: false
        enable: false
        enforced: false
        foreignKeyProperties:
            match: string
            onDelete: string
            onUpdate: string
            references:
                columns:
                    - string
                tableId: string
        initially: string
        name: string
        rely: false
        tableId: string
        type: string
        validate: false
    

    TableConstraint 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 TableConstraint resource accepts the following input properties:

    Columns List<string>
    Columns to use in foreign key reference
    TableId string
    Name of constraint
    Type string
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    Comment string
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    Deferrable bool
    Whether the constraint is deferrable
    Enable bool
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    Enforced bool
    Whether the constraint is enforced
    ForeignKeyProperties TableConstraintForeignKeyProperties
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    Initially string
    Whether the constraint is initially deferred or immediate
    Name string
    Name of constraint
    Rely bool
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    Validate bool
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    Columns []string
    Columns to use in foreign key reference
    TableId string
    Name of constraint
    Type string
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    Comment string
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    Deferrable bool
    Whether the constraint is deferrable
    Enable bool
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    Enforced bool
    Whether the constraint is enforced
    ForeignKeyProperties TableConstraintForeignKeyPropertiesArgs
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    Initially string
    Whether the constraint is initially deferred or immediate
    Name string
    Name of constraint
    Rely bool
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    Validate bool
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns List<String>
    Columns to use in foreign key reference
    tableId String
    Name of constraint
    type String
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    comment String
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable Boolean
    Whether the constraint is deferrable
    enable Boolean
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced Boolean
    Whether the constraint is enforced
    foreignKeyProperties TableConstraintForeignKeyProperties
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially String
    Whether the constraint is initially deferred or immediate
    name String
    Name of constraint
    rely Boolean
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    validate Boolean
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns string[]
    Columns to use in foreign key reference
    tableId string
    Name of constraint
    type string
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    comment string
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable boolean
    Whether the constraint is deferrable
    enable boolean
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced boolean
    Whether the constraint is enforced
    foreignKeyProperties TableConstraintForeignKeyProperties
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially string
    Whether the constraint is initially deferred or immediate
    name string
    Name of constraint
    rely boolean
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    validate boolean
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns Sequence[str]
    Columns to use in foreign key reference
    table_id str
    Name of constraint
    type str
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    comment str
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable bool
    Whether the constraint is deferrable
    enable bool
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced bool
    Whether the constraint is enforced
    foreign_key_properties TableConstraintForeignKeyPropertiesArgs
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially str
    Whether the constraint is initially deferred or immediate
    name str
    Name of constraint
    rely bool
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    validate bool
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns List<String>
    Columns to use in foreign key reference
    tableId String
    Name of constraint
    type String
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    comment String
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable Boolean
    Whether the constraint is deferrable
    enable Boolean
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced Boolean
    Whether the constraint is enforced
    foreignKeyProperties Property Map
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially String
    Whether the constraint is initially deferred or immediate
    name String
    Name of constraint
    rely Boolean
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    validate Boolean
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TableConstraint 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 TableConstraint Resource

    Get an existing TableConstraint 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?: TableConstraintState, opts?: CustomResourceOptions): TableConstraint
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            columns: Optional[Sequence[str]] = None,
            comment: Optional[str] = None,
            deferrable: Optional[bool] = None,
            enable: Optional[bool] = None,
            enforced: Optional[bool] = None,
            foreign_key_properties: Optional[TableConstraintForeignKeyPropertiesArgs] = None,
            initially: Optional[str] = None,
            name: Optional[str] = None,
            rely: Optional[bool] = None,
            table_id: Optional[str] = None,
            type: Optional[str] = None,
            validate: Optional[bool] = None) -> TableConstraint
    func GetTableConstraint(ctx *Context, name string, id IDInput, state *TableConstraintState, opts ...ResourceOption) (*TableConstraint, error)
    public static TableConstraint Get(string name, Input<string> id, TableConstraintState? state, CustomResourceOptions? opts = null)
    public static TableConstraint get(String name, Output<String> id, TableConstraintState 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:
    Columns List<string>
    Columns to use in foreign key reference
    Comment string
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    Deferrable bool
    Whether the constraint is deferrable
    Enable bool
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    Enforced bool
    Whether the constraint is enforced
    ForeignKeyProperties TableConstraintForeignKeyProperties
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    Initially string
    Whether the constraint is initially deferred or immediate
    Name string
    Name of constraint
    Rely bool
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    TableId string
    Name of constraint
    Type string
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    Validate bool
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    Columns []string
    Columns to use in foreign key reference
    Comment string
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    Deferrable bool
    Whether the constraint is deferrable
    Enable bool
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    Enforced bool
    Whether the constraint is enforced
    ForeignKeyProperties TableConstraintForeignKeyPropertiesArgs
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    Initially string
    Whether the constraint is initially deferred or immediate
    Name string
    Name of constraint
    Rely bool
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    TableId string
    Name of constraint
    Type string
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    Validate bool
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns List<String>
    Columns to use in foreign key reference
    comment String
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable Boolean
    Whether the constraint is deferrable
    enable Boolean
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced Boolean
    Whether the constraint is enforced
    foreignKeyProperties TableConstraintForeignKeyProperties
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially String
    Whether the constraint is initially deferred or immediate
    name String
    Name of constraint
    rely Boolean
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    tableId String
    Name of constraint
    type String
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    validate Boolean
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns string[]
    Columns to use in foreign key reference
    comment string
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable boolean
    Whether the constraint is deferrable
    enable boolean
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced boolean
    Whether the constraint is enforced
    foreignKeyProperties TableConstraintForeignKeyProperties
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially string
    Whether the constraint is initially deferred or immediate
    name string
    Name of constraint
    rely boolean
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    tableId string
    Name of constraint
    type string
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    validate boolean
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns Sequence[str]
    Columns to use in foreign key reference
    comment str
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable bool
    Whether the constraint is deferrable
    enable bool
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced bool
    Whether the constraint is enforced
    foreign_key_properties TableConstraintForeignKeyPropertiesArgs
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially str
    Whether the constraint is initially deferred or immediate
    name str
    Name of constraint
    rely bool
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    table_id str
    Name of constraint
    type str
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    validate bool
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.
    columns List<String>
    Columns to use in foreign key reference
    comment String
    Comment for the table constraint

    Deprecated: Not used. Will be removed.

    deferrable Boolean
    Whether the constraint is deferrable
    enable Boolean
    Specifies whether the constraint is enabled or disabled. These properties are provided for compatibility with Oracle.
    enforced Boolean
    Whether the constraint is enforced
    foreignKeyProperties Property Map
    Additional properties when type is set to foreign key. Not applicable for primary/unique keys
    initially String
    Whether the constraint is initially deferred or immediate
    name String
    Name of constraint
    rely Boolean
    Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.
    tableId String
    Name of constraint
    type String
    Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
    validate Boolean
    Specifies whether to validate existing data on the table when a constraint is created. Only used in conjunction with the ENABLE property.

    Supporting Types

    TableConstraintForeignKeyProperties, TableConstraintForeignKeyPropertiesArgs

    Match string
    The match type for the foreign key. Not applicable for primary/unique keys
    OnDelete string
    Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
    OnUpdate string
    Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
    References TableConstraintForeignKeyPropertiesReferences
    The table and columns that the foreign key references. Not applicable for primary/unique keys
    Match string
    The match type for the foreign key. Not applicable for primary/unique keys
    OnDelete string
    Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
    OnUpdate string
    Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
    References TableConstraintForeignKeyPropertiesReferences
    The table and columns that the foreign key references. Not applicable for primary/unique keys
    match String
    The match type for the foreign key. Not applicable for primary/unique keys
    onDelete String
    Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
    onUpdate String
    Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
    references TableConstraintForeignKeyPropertiesReferences
    The table and columns that the foreign key references. Not applicable for primary/unique keys
    match string
    The match type for the foreign key. Not applicable for primary/unique keys
    onDelete string
    Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
    onUpdate string
    Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
    references TableConstraintForeignKeyPropertiesReferences
    The table and columns that the foreign key references. Not applicable for primary/unique keys
    match str
    The match type for the foreign key. Not applicable for primary/unique keys
    on_delete str
    Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
    on_update str
    Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
    references TableConstraintForeignKeyPropertiesReferences
    The table and columns that the foreign key references. Not applicable for primary/unique keys
    match String
    The match type for the foreign key. Not applicable for primary/unique keys
    onDelete String
    Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
    onUpdate String
    Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
    references Property Map
    The table and columns that the foreign key references. Not applicable for primary/unique keys

    TableConstraintForeignKeyPropertiesReferences, TableConstraintForeignKeyPropertiesReferencesArgs

    Columns List<string>
    Columns to use in foreign key reference
    TableId string
    Name of constraint
    Columns []string
    Columns to use in foreign key reference
    TableId string
    Name of constraint
    columns List<String>
    Columns to use in foreign key reference
    tableId String
    Name of constraint
    columns string[]
    Columns to use in foreign key reference
    tableId string
    Name of constraint
    columns Sequence[str]
    Columns to use in foreign key reference
    table_id str
    Name of constraint
    columns List<String>
    Columns to use in foreign key reference
    tableId String
    Name of constraint

    Import

    $ pulumi import snowflake:index/tableConstraint:TableConstraint example 'myconstraintfk❄️FOREIGN KEY❄️test|test|table'
    

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

    Package Details

    Repository
    Snowflake pulumi/pulumi-snowflake
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the snowflake Terraform Provider.
    snowflake logo
    Snowflake v0.52.0 published on Thursday, Apr 18, 2024 by Pulumi