published on Thursday, Feb 26, 2026 by Pulumi
published on Thursday, Feb 26, 2026 by Pulumi
!> Caution: Preview Feature This feature is considered a preview feature in the provider, regardless of the state of the resource in Snowflake. We do not guarantee its stability. It will be reworked and marked as a stable feature in future releases. Breaking changes are expected, even without bumping the major version. To use this feature, add the relevant feature name to preview_features_enabled field in the provider configuration. Please always refer to the Getting Help section in our Github repo to best determine how to get help for your questions.
Important The
or_replaceparameter controls whether the provider usesCREATE OR REPLACE MATERIALIZED VIEWduring create and recreate operations. However, any change to the fields causing recreation will always trigger delete and create operations of the materialized view, regardless of theor_replacesetting. This means settingor_replace </span>= truedoes not enable in-place updates when you modify thestatementfield specifically. Changes tostatementwill cause downtime as the view is dropped and recreated. Theor_replaceparameter is primarily useful to overwrite an existing view during initial resource creation. This behavior is a known limitation and may be improved in future versions of the provider.
!> Sensitive values This resource’s statement field is not marked as sensitive in the provider. Ensure that no personal data, sensitive data, export-controlled data, or other regulated data is entered as metadata when using the provider. If you use one of these fields, they may be present in logs, so ensure that the provider logs are properly restricted. For more information, see Sensitive values limitations and Metadata fields in Snowflake.
Example Usage
Note Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult identifiers guide.
import * as pulumi from "@pulumi/pulumi";
import * as snowflake from "@pulumi/snowflake";
const view = new snowflake.MaterializedView("view", {
database: "db",
schema: "schema",
name: "view",
warehouse: "warehouse",
comment: "comment",
statement: "select * from foo;\n",
orReplace: false,
isSecure: false,
});
import pulumi
import pulumi_snowflake as snowflake
view = snowflake.MaterializedView("view",
database="db",
schema="schema",
name="view",
warehouse="warehouse",
comment="comment",
statement="select * from foo;\n",
or_replace=False,
is_secure=False)
package main
import (
"github.com/pulumi/pulumi-snowflake/sdk/v2/go/snowflake"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := snowflake.NewMaterializedView(ctx, "view", &snowflake.MaterializedViewArgs{
Database: pulumi.String("db"),
Schema: pulumi.String("schema"),
Name: pulumi.String("view"),
Warehouse: pulumi.String("warehouse"),
Comment: pulumi.String("comment"),
Statement: pulumi.String("select * from foo;\n"),
OrReplace: pulumi.Bool(false),
IsSecure: pulumi.Bool(false),
})
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 view = new Snowflake.MaterializedView("view", new()
{
Database = "db",
Schema = "schema",
Name = "view",
Warehouse = "warehouse",
Comment = "comment",
Statement = @"select * from foo;
",
OrReplace = false,
IsSecure = false,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.snowflake.MaterializedView;
import com.pulumi.snowflake.MaterializedViewArgs;
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 view = new MaterializedView("view", MaterializedViewArgs.builder()
.database("db")
.schema("schema")
.name("view")
.warehouse("warehouse")
.comment("comment")
.statement("""
select * from foo;
""")
.orReplace(false)
.isSecure(false)
.build());
}
}
resources:
view:
type: snowflake:MaterializedView
properties:
database: db
schema: schema
name: view
warehouse: warehouse
comment: comment
statement: |
select * from foo;
orReplace: false
isSecure: false
Note If a field has a default value, it is shown next to the type in the schema.
Create MaterializedView Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MaterializedView(name: string, args: MaterializedViewArgs, opts?: CustomResourceOptions);@overload
def MaterializedView(resource_name: str,
args: MaterializedViewArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MaterializedView(resource_name: str,
opts: Optional[ResourceOptions] = None,
database: Optional[str] = None,
schema: Optional[str] = None,
statement: Optional[str] = None,
warehouse: Optional[str] = None,
comment: Optional[str] = None,
is_secure: Optional[bool] = None,
name: Optional[str] = None,
or_replace: Optional[bool] = None,
tags: Optional[Sequence[MaterializedViewTagArgs]] = None)func NewMaterializedView(ctx *Context, name string, args MaterializedViewArgs, opts ...ResourceOption) (*MaterializedView, error)public MaterializedView(string name, MaterializedViewArgs args, CustomResourceOptions? opts = null)
public MaterializedView(String name, MaterializedViewArgs args)
public MaterializedView(String name, MaterializedViewArgs args, CustomResourceOptions options)
type: snowflake:MaterializedView
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 MaterializedViewArgs
- 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 MaterializedViewArgs
- 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 MaterializedViewArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MaterializedViewArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MaterializedViewArgs
- 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 materializedViewResource = new Snowflake.MaterializedView("materializedViewResource", new()
{
Database = "string",
Schema = "string",
Statement = "string",
Warehouse = "string",
Comment = "string",
IsSecure = false,
Name = "string",
OrReplace = false,
});
example, err := snowflake.NewMaterializedView(ctx, "materializedViewResource", &snowflake.MaterializedViewArgs{
Database: pulumi.String("string"),
Schema: pulumi.String("string"),
Statement: pulumi.String("string"),
Warehouse: pulumi.String("string"),
Comment: pulumi.String("string"),
IsSecure: pulumi.Bool(false),
Name: pulumi.String("string"),
OrReplace: pulumi.Bool(false),
})
var materializedViewResource = new MaterializedView("materializedViewResource", MaterializedViewArgs.builder()
.database("string")
.schema("string")
.statement("string")
.warehouse("string")
.comment("string")
.isSecure(false)
.name("string")
.orReplace(false)
.build());
materialized_view_resource = snowflake.MaterializedView("materializedViewResource",
database="string",
schema="string",
statement="string",
warehouse="string",
comment="string",
is_secure=False,
name="string",
or_replace=False)
const materializedViewResource = new snowflake.MaterializedView("materializedViewResource", {
database: "string",
schema: "string",
statement: "string",
warehouse: "string",
comment: "string",
isSecure: false,
name: "string",
orReplace: false,
});
type: snowflake:MaterializedView
properties:
comment: string
database: string
isSecure: false
name: string
orReplace: false
schema: string
statement: string
warehouse: string
MaterializedView 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 MaterializedView resource accepts the following input properties:
- Database string
- The database in which to create the view. Don't use the | character.
- Schema string
- The schema in which to create the view. Don't use the | character.
- Statement string
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
- Warehouse string
- The warehouse name.
- Comment string
- Specifies a comment for the view.
- Is
Secure bool - (Default:
false) Specifies that the view is secure. - Name string
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- Or
Replace bool - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. -
List<Materialized
View Tag> - Definitions of a tag to associate with the resource.
- Database string
- The database in which to create the view. Don't use the | character.
- Schema string
- The schema in which to create the view. Don't use the | character.
- Statement string
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
- Warehouse string
- The warehouse name.
- Comment string
- Specifies a comment for the view.
- Is
Secure bool - (Default:
false) Specifies that the view is secure. - Name string
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- Or
Replace bool - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. -
[]Materialized
View Tag Args - Definitions of a tag to associate with the resource.
- database String
- The database in which to create the view. Don't use the | character.
- schema String
- The schema in which to create the view. Don't use the | character.
- statement String
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
- warehouse String
- The warehouse name.
- comment String
- Specifies a comment for the view.
- is
Secure Boolean - (Default:
false) Specifies that the view is secure. - name String
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or
Replace Boolean - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. -
List<Materialized
View Tag> - Definitions of a tag to associate with the resource.
- database string
- The database in which to create the view. Don't use the | character.
- schema string
- The schema in which to create the view. Don't use the | character.
- statement string
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
- warehouse string
- The warehouse name.
- comment string
- Specifies a comment for the view.
- is
Secure boolean - (Default:
false) Specifies that the view is secure. - name string
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or
Replace boolean - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. -
Materialized
View Tag[] - Definitions of a tag to associate with the resource.
- database str
- The database in which to create the view. Don't use the | character.
- schema str
- The schema in which to create the view. Don't use the | character.
- statement str
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
- warehouse str
- The warehouse name.
- comment str
- Specifies a comment for the view.
- is_
secure bool - (Default:
false) Specifies that the view is secure. - name str
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or_
replace bool - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. -
Sequence[Materialized
View Tag Args] - Definitions of a tag to associate with the resource.
- database String
- The database in which to create the view. Don't use the | character.
- schema String
- The schema in which to create the view. Don't use the | character.
- statement String
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
- warehouse String
- The warehouse name.
- comment String
- Specifies a comment for the view.
- is
Secure Boolean - (Default:
false) Specifies that the view is secure. - name String
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or
Replace Boolean - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. - List<Property Map>
- Definitions of a tag to associate with the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the MaterializedView resource produces the following output properties:
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Id string
- The provider-assigned unique ID for this managed resource.
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Id string
- The provider-assigned unique ID for this managed resource.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- id String
- The provider-assigned unique ID for this managed resource.
- fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- id string
- The provider-assigned unique ID for this managed resource.
- fully_
qualified_ strname - Fully qualified name of the resource. For more information, see object name resolution.
- id str
- The provider-assigned unique ID for this managed resource.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing MaterializedView Resource
Get an existing MaterializedView 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?: MaterializedViewState, opts?: CustomResourceOptions): MaterializedView@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
comment: Optional[str] = None,
database: Optional[str] = None,
fully_qualified_name: Optional[str] = None,
is_secure: Optional[bool] = None,
name: Optional[str] = None,
or_replace: Optional[bool] = None,
schema: Optional[str] = None,
statement: Optional[str] = None,
tags: Optional[Sequence[MaterializedViewTagArgs]] = None,
warehouse: Optional[str] = None) -> MaterializedViewfunc GetMaterializedView(ctx *Context, name string, id IDInput, state *MaterializedViewState, opts ...ResourceOption) (*MaterializedView, error)public static MaterializedView Get(string name, Input<string> id, MaterializedViewState? state, CustomResourceOptions? opts = null)public static MaterializedView get(String name, Output<String> id, MaterializedViewState state, CustomResourceOptions options)resources: _: type: snowflake:MaterializedView get: id: ${id}- 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.
- Comment string
- Specifies a comment for the view.
- Database string
- The database in which to create the view. Don't use the | character.
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Is
Secure bool - (Default:
false) Specifies that the view is secure. - Name string
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- Or
Replace bool - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. - Schema string
- The schema in which to create the view. Don't use the | character.
- Statement string
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
-
List<Materialized
View Tag> - Definitions of a tag to associate with the resource.
- Warehouse string
- The warehouse name.
- Comment string
- Specifies a comment for the view.
- Database string
- The database in which to create the view. Don't use the | character.
- Fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- Is
Secure bool - (Default:
false) Specifies that the view is secure. - Name string
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- Or
Replace bool - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. - Schema string
- The schema in which to create the view. Don't use the | character.
- Statement string
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
-
[]Materialized
View Tag Args - Definitions of a tag to associate with the resource.
- Warehouse string
- The warehouse name.
- comment String
- Specifies a comment for the view.
- database String
- The database in which to create the view. Don't use the | character.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- is
Secure Boolean - (Default:
false) Specifies that the view is secure. - name String
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or
Replace Boolean - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. - schema String
- The schema in which to create the view. Don't use the | character.
- statement String
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
-
List<Materialized
View Tag> - Definitions of a tag to associate with the resource.
- warehouse String
- The warehouse name.
- comment string
- Specifies a comment for the view.
- database string
- The database in which to create the view. Don't use the | character.
- fully
Qualified stringName - Fully qualified name of the resource. For more information, see object name resolution.
- is
Secure boolean - (Default:
false) Specifies that the view is secure. - name string
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or
Replace boolean - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. - schema string
- The schema in which to create the view. Don't use the | character.
- statement string
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
-
Materialized
View Tag[] - Definitions of a tag to associate with the resource.
- warehouse string
- The warehouse name.
- comment str
- Specifies a comment for the view.
- database str
- The database in which to create the view. Don't use the | character.
- fully_
qualified_ strname - Fully qualified name of the resource. For more information, see object name resolution.
- is_
secure bool - (Default:
false) Specifies that the view is secure. - name str
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or_
replace bool - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. - schema str
- The schema in which to create the view. Don't use the | character.
- statement str
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
-
Sequence[Materialized
View Tag Args] - Definitions of a tag to associate with the resource.
- warehouse str
- The warehouse name.
- comment String
- Specifies a comment for the view.
- database String
- The database in which to create the view. Don't use the | character.
- fully
Qualified StringName - Fully qualified name of the resource. For more information, see object name resolution.
- is
Secure Boolean - (Default:
false) Specifies that the view is secure. - name String
- Specifies the identifier for the view; must be unique for the schema in which the view is created.
- or
Replace Boolean - (Default:
false) Specifies whether to use CREATE OR REPLACE when creating the materialized view. Note: this does not enable in-place updates when other fields forcing object recreation change; such fields always trigger delete and create operations in pulumi preview. - schema String
- The schema in which to create the view. Don't use the | character.
- statement String
- Specifies the query used to create the view. Changing this value will trigger a drop and recreate of the materialized view.
- List<Property Map>
- Definitions of a tag to associate with the resource.
- warehouse String
- The warehouse name.
Supporting Types
MaterializedViewTag, MaterializedViewTagArgs
Import
format is database name | schema name | view name
$ pulumi import snowflake:index/materializedView:MaterializedView example 'dbName|schemaName|viewName'
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
snowflakeTerraform Provider.
published on Thursday, Feb 26, 2026 by Pulumi
