snowflake.TableConstraint
Explore with Pulumi AI
Import
$ pulumi import snowflake:index/tableConstraint:TableConstraint example 'myconstraintfk❄️FOREIGN KEY❄️databaseName|schemaName|tableName'
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.
Constructor 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
{
References = new Snowflake.Inputs.TableConstraintForeignKeyPropertiesReferencesArgs
{
Columns = new[]
{
"string",
},
TableId = "string",
},
Match = "string",
OnDelete = "string",
OnUpdate = "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{
References: &snowflake.TableConstraintForeignKeyPropertiesReferencesArgs{
Columns: pulumi.StringArray{
pulumi.String("string"),
},
TableId: pulumi.String("string"),
},
Match: pulumi.String("string"),
OnDelete: pulumi.String("string"),
OnUpdate: 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()
.references(TableConstraintForeignKeyPropertiesReferencesArgs.builder()
.columns("string")
.tableId("string")
.build())
.match("string")
.onDelete("string")
.onUpdate("string")
.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={
"references": {
"columns": ["string"],
"table_id": "string",
},
"match": "string",
"on_delete": "string",
"on_update": "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: {
references: {
columns: ["string"],
tableId: "string",
},
match: "string",
onDelete: "string",
onUpdate: "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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The TableConstraint resource accepts the following input properties:
- Columns List<string>
- Columns to use in constraint key
- Table
Id string - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- Type string
- Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
- Comment string
- Comment for the table constraint
- 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 TableProperties Constraint Foreign Key Properties - 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 constraint key
- Table
Id string - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- Type string
- Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
- Comment string
- Comment for the table constraint
- 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 TableProperties Constraint Foreign Key Properties Args - 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 constraint key
- table
Id String - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- type String
- Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
- comment String
- Comment for the table constraint
- 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
- foreign
Key TableProperties Constraint Foreign Key Properties - 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 constraint key
- table
Id string - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- type string
- Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
- comment string
- Comment for the table constraint
- 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
- foreign
Key TableProperties Constraint Foreign Key Properties - 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 constraint key
- table_
id str - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- type str
- Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
- comment str
- Comment for the table constraint
- 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_ Tableproperties Constraint Foreign Key Properties Args - 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 constraint key
- table
Id String - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- type String
- Type of constraint, one of 'UNIQUE', 'PRIMARY KEY', or 'FOREIGN KEY'
- comment String
- Comment for the table constraint
- 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
- foreign
Key Property MapProperties - 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.
- Columns List<string>
- Columns to use in constraint key
- Comment string
- Comment for the table constraint
- 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 TableProperties Constraint Foreign Key Properties - 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.
- Table
Id string - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- 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 constraint key
- Comment string
- Comment for the table constraint
- 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 TableProperties Constraint Foreign Key Properties Args - 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.
- Table
Id string - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- 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 constraint key
- comment String
- Comment for the table constraint
- 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
- foreign
Key TableProperties Constraint Foreign Key Properties - 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.
- table
Id String - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- 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 constraint key
- comment string
- Comment for the table constraint
- 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
- foreign
Key TableProperties Constraint Foreign Key Properties - 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.
- table
Id string - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- 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 constraint key
- comment str
- Comment for the table constraint
- 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_ Tableproperties Constraint Foreign Key Properties Args - 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 - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- 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 constraint key
- comment String
- Comment for the table constraint
- 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
- foreign
Key Property MapProperties - 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.
- table
Id String - Identifier for table to create constraint on. Format must follow: ""<dbname>"."<schemaname>"."<tablename>"" or "<dbname>.<schemaname>.<tablename>" (snowflaketable.mytable.id)
- 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
- References
Table
Constraint Foreign Key Properties References - The table and columns that the foreign key references.
- Match string
- The match type for the foreign key. Not applicable for primary/unique keys
- On
Delete string - Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
- On
Update string - Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
- References
Table
Constraint Foreign Key Properties References - The table and columns that the foreign key references.
- Match string
- The match type for the foreign key. Not applicable for primary/unique keys
- On
Delete string - Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
- On
Update string - Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
- references
Table
Constraint Foreign Key Properties References - The table and columns that the foreign key references.
- match String
- The match type for the foreign key. Not applicable for primary/unique keys
- on
Delete String - Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
- on
Update String - Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
- references
Table
Constraint Foreign Key Properties References - The table and columns that the foreign key references.
- match string
- The match type for the foreign key. Not applicable for primary/unique keys
- on
Delete string - Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
- on
Update string - Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
- references
Table
Constraint Foreign Key Properties References - The table and columns that the foreign key references.
- 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 Property Map
- The table and columns that the foreign key references.
- match String
- The match type for the foreign key. Not applicable for primary/unique keys
- on
Delete String - Specifies the action performed when the primary/unique key for the foreign key is deleted. Not applicable for primary/unique keys
- on
Update String - Specifies the action performed when the primary/unique key for the foreign key is updated. Not applicable for primary/unique keys
TableConstraintForeignKeyPropertiesReferences, TableConstraintForeignKeyPropertiesReferencesArgs
Package Details
- Repository
- Snowflake pulumi/pulumi-snowflake
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
snowflake
Terraform Provider.