1. Packages
  2. Snowflake
  3. API Docs
  4. Database
Snowflake v0.49.0 published on Monday, Feb 19, 2024 by Pulumi

snowflake.Database

Explore with Pulumi AI

snowflake logo
Snowflake v0.49.0 published on Monday, Feb 19, 2024 by Pulumi

    Import

     $ pulumi import snowflake:index/database:Database example name
    

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Snowflake = Pulumi.Snowflake;
    
    return await Deployment.RunAsync(() => 
    {
        var simple = new Snowflake.Database("simple", new()
        {
            Comment = "test comment",
            DataRetentionTimeInDays = 3,
        });
    
        var withReplication = new Snowflake.Database("withReplication", new()
        {
            Comment = "test comment 2",
            ReplicationConfiguration = new Snowflake.Inputs.DatabaseReplicationConfigurationArgs
            {
                Accounts = new[]
                {
                    "test_account1",
                    "test_account_2",
                },
                IgnoreEditionCheck = true,
            },
        });
    
        var fromReplica = new Snowflake.Database("fromReplica", new()
        {
            Comment = "test comment",
            DataRetentionTimeInDays = 3,
            FromReplica = "org1\".\"account1\".\"primary_db_name",
        });
    
        var fromShare = new Snowflake.Database("fromShare", new()
        {
            Comment = "test comment",
            FromShare = 
            {
                { "provider", "org1.account1" },
                { "share", "share1" },
            },
        });
    
    });
    
    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 {
    		_, err := snowflake.NewDatabase(ctx, "simple", &snowflake.DatabaseArgs{
    			Comment:                 pulumi.String("test comment"),
    			DataRetentionTimeInDays: pulumi.Int(3),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewDatabase(ctx, "withReplication", &snowflake.DatabaseArgs{
    			Comment: pulumi.String("test comment 2"),
    			ReplicationConfiguration: &snowflake.DatabaseReplicationConfigurationArgs{
    				Accounts: pulumi.StringArray{
    					pulumi.String("test_account1"),
    					pulumi.String("test_account_2"),
    				},
    				IgnoreEditionCheck: pulumi.Bool(true),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewDatabase(ctx, "fromReplica", &snowflake.DatabaseArgs{
    			Comment:                 pulumi.String("test comment"),
    			DataRetentionTimeInDays: pulumi.Int(3),
    			FromReplica:             pulumi.String("org1\".\"account1\".\"primary_db_name"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = snowflake.NewDatabase(ctx, "fromShare", &snowflake.DatabaseArgs{
    			Comment: pulumi.String("test comment"),
    			FromShare: pulumi.StringMap{
    				"provider": pulumi.String("org1.account1"),
    				"share":    pulumi.String("share1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.snowflake.Database;
    import com.pulumi.snowflake.DatabaseArgs;
    import com.pulumi.snowflake.inputs.DatabaseReplicationConfigurationArgs;
    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 simple = new Database("simple", DatabaseArgs.builder()        
                .comment("test comment")
                .dataRetentionTimeInDays(3)
                .build());
    
            var withReplication = new Database("withReplication", DatabaseArgs.builder()        
                .comment("test comment 2")
                .replicationConfiguration(DatabaseReplicationConfigurationArgs.builder()
                    .accounts(                
                        "test_account1",
                        "test_account_2")
                    .ignoreEditionCheck(true)
                    .build())
                .build());
    
            var fromReplica = new Database("fromReplica", DatabaseArgs.builder()        
                .comment("test comment")
                .dataRetentionTimeInDays(3)
                .fromReplica("org1\".\"account1\".\"primary_db_name")
                .build());
    
            var fromShare = new Database("fromShare", DatabaseArgs.builder()        
                .comment("test comment")
                .fromShare(Map.ofEntries(
                    Map.entry("provider", "org1.account1"),
                    Map.entry("share", "share1")
                ))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_snowflake as snowflake
    
    simple = snowflake.Database("simple",
        comment="test comment",
        data_retention_time_in_days=3)
    with_replication = snowflake.Database("withReplication",
        comment="test comment 2",
        replication_configuration=snowflake.DatabaseReplicationConfigurationArgs(
            accounts=[
                "test_account1",
                "test_account_2",
            ],
            ignore_edition_check=True,
        ))
    from_replica = snowflake.Database("fromReplica",
        comment="test comment",
        data_retention_time_in_days=3,
        from_replica="org1\".\"account1\".\"primary_db_name")
    from_share = snowflake.Database("fromShare",
        comment="test comment",
        from_share={
            "provider": "org1.account1",
            "share": "share1",
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as snowflake from "@pulumi/snowflake";
    
    const simple = new snowflake.Database("simple", {
        comment: "test comment",
        dataRetentionTimeInDays: 3,
    });
    const withReplication = new snowflake.Database("withReplication", {
        comment: "test comment 2",
        replicationConfiguration: {
            accounts: [
                "test_account1",
                "test_account_2",
            ],
            ignoreEditionCheck: true,
        },
    });
    const fromReplica = new snowflake.Database("fromReplica", {
        comment: "test comment",
        dataRetentionTimeInDays: 3,
        fromReplica: "org1\".\"account1\".\"primary_db_name",
    });
    const fromShare = new snowflake.Database("fromShare", {
        comment: "test comment",
        fromShare: {
            provider: "org1.account1",
            share: "share1",
        },
    });
    
    resources:
      simple:
        type: snowflake:Database
        properties:
          comment: test comment
          dataRetentionTimeInDays: 3
      withReplication:
        type: snowflake:Database
        properties:
          comment: test comment 2
          replicationConfiguration:
            accounts:
              - test_account1
              - test_account_2
            ignoreEditionCheck: true
      fromReplica:
        type: snowflake:Database
        properties:
          comment: test comment
          dataRetentionTimeInDays: 3
          fromReplica: org1"."account1"."primary_db_name
      fromShare:
        type: snowflake:Database
        properties:
          comment: test comment
          fromShare:
            provider: org1.account1
            share: share1
    

    Create Database Resource

    new Database(name: string, args?: DatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def Database(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 comment: Optional[str] = None,
                 data_retention_time_in_days: Optional[int] = None,
                 from_database: Optional[str] = None,
                 from_replica: Optional[str] = None,
                 from_share: Optional[Mapping[str, str]] = None,
                 is_transient: Optional[bool] = None,
                 name: Optional[str] = None,
                 replication_configuration: Optional[DatabaseReplicationConfigurationArgs] = None)
    @overload
    def Database(resource_name: str,
                 args: Optional[DatabaseArgs] = None,
                 opts: Optional[ResourceOptions] = None)
    func NewDatabase(ctx *Context, name string, args *DatabaseArgs, opts ...ResourceOption) (*Database, error)
    public Database(string name, DatabaseArgs? args = null, CustomResourceOptions? opts = null)
    public Database(String name, DatabaseArgs args)
    public Database(String name, DatabaseArgs args, CustomResourceOptions options)
    
    type: snowflake:Database
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args DatabaseArgs
    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 DatabaseArgs
    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 DatabaseArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DatabaseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DatabaseArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    Comment string
    DataRetentionTimeInDays int
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    FromDatabase string
    Specify a database to create a clone from.
    FromReplica string
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    FromShare Dictionary<string, string>
    Specify a provider and a share in this map to create a database from a share.
    IsTransient bool
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    Name string
    ReplicationConfiguration DatabaseReplicationConfiguration
    When set, specifies the configurations for database replication.
    Comment string
    DataRetentionTimeInDays int
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    FromDatabase string
    Specify a database to create a clone from.
    FromReplica string
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    FromShare map[string]string
    Specify a provider and a share in this map to create a database from a share.
    IsTransient bool
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    Name string
    ReplicationConfiguration DatabaseReplicationConfigurationArgs
    When set, specifies the configurations for database replication.
    comment String
    dataRetentionTimeInDays Integer
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    fromDatabase String
    Specify a database to create a clone from.
    fromReplica String
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    fromShare Map<String,String>
    Specify a provider and a share in this map to create a database from a share.
    isTransient Boolean
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name String
    replicationConfiguration DatabaseReplicationConfiguration
    When set, specifies the configurations for database replication.
    comment string
    dataRetentionTimeInDays number
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    fromDatabase string
    Specify a database to create a clone from.
    fromReplica string
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    fromShare {[key: string]: string}
    Specify a provider and a share in this map to create a database from a share.
    isTransient boolean
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name string
    replicationConfiguration DatabaseReplicationConfiguration
    When set, specifies the configurations for database replication.
    comment str
    data_retention_time_in_days int
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    from_database str
    Specify a database to create a clone from.
    from_replica str
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    from_share Mapping[str, str]
    Specify a provider and a share in this map to create a database from a share.
    is_transient bool
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name str
    replication_configuration DatabaseReplicationConfigurationArgs
    When set, specifies the configurations for database replication.
    comment String
    dataRetentionTimeInDays Number
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    fromDatabase String
    Specify a database to create a clone from.
    fromReplica String
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    fromShare Map<String>
    Specify a provider and a share in this map to create a database from a share.
    isTransient Boolean
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name String
    replicationConfiguration Property Map
    When set, specifies the configurations for database replication.

    Outputs

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

    Get an existing Database 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?: DatabaseState, opts?: CustomResourceOptions): Database
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            comment: Optional[str] = None,
            data_retention_time_in_days: Optional[int] = None,
            from_database: Optional[str] = None,
            from_replica: Optional[str] = None,
            from_share: Optional[Mapping[str, str]] = None,
            is_transient: Optional[bool] = None,
            name: Optional[str] = None,
            replication_configuration: Optional[DatabaseReplicationConfigurationArgs] = None) -> Database
    func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
    public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
    public static Database get(String name, Output<String> id, DatabaseState 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:
    Comment string
    DataRetentionTimeInDays int
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    FromDatabase string
    Specify a database to create a clone from.
    FromReplica string
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    FromShare Dictionary<string, string>
    Specify a provider and a share in this map to create a database from a share.
    IsTransient bool
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    Name string
    ReplicationConfiguration DatabaseReplicationConfiguration
    When set, specifies the configurations for database replication.
    Comment string
    DataRetentionTimeInDays int
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    FromDatabase string
    Specify a database to create a clone from.
    FromReplica string
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    FromShare map[string]string
    Specify a provider and a share in this map to create a database from a share.
    IsTransient bool
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    Name string
    ReplicationConfiguration DatabaseReplicationConfigurationArgs
    When set, specifies the configurations for database replication.
    comment String
    dataRetentionTimeInDays Integer
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    fromDatabase String
    Specify a database to create a clone from.
    fromReplica String
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    fromShare Map<String,String>
    Specify a provider and a share in this map to create a database from a share.
    isTransient Boolean
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name String
    replicationConfiguration DatabaseReplicationConfiguration
    When set, specifies the configurations for database replication.
    comment string
    dataRetentionTimeInDays number
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    fromDatabase string
    Specify a database to create a clone from.
    fromReplica string
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    fromShare {[key: string]: string}
    Specify a provider and a share in this map to create a database from a share.
    isTransient boolean
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name string
    replicationConfiguration DatabaseReplicationConfiguration
    When set, specifies the configurations for database replication.
    comment str
    data_retention_time_in_days int
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    from_database str
    Specify a database to create a clone from.
    from_replica str
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    from_share Mapping[str, str]
    Specify a provider and a share in this map to create a database from a share.
    is_transient bool
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name str
    replication_configuration DatabaseReplicationConfigurationArgs
    When set, specifies the configurations for database replication.
    comment String
    dataRetentionTimeInDays Number
    Number of days for which Snowflake retains historical data for performing Time Travel actions (SELECT, CLONE, UNDROP) on the object. A value of 0 effectively disables Time Travel for the specified database, schema, or table. For more information, see Understanding & Using Time Travel.
    fromDatabase String
    Specify a database to create a clone from.
    fromReplica String
    Specify a fully-qualified path to a database to create a replica from. A fully qualified path follows the format of "\n\n"."\n\n"."\n\n". An example would be: "myorg1"."account1"."db1"
    fromShare Map<String>
    Specify a provider and a share in this map to create a database from a share.
    isTransient Boolean
    Specifies a database as transient. Transient databases do not have a Fail-safe period so they do not incur additional storage costs once they leave Time Travel; however, this means they are also not protected by Fail-safe in the event of a data loss.
    name String
    replicationConfiguration Property Map
    When set, specifies the configurations for database replication.

    Supporting Types

    DatabaseReplicationConfiguration, DatabaseReplicationConfigurationArgs

    Accounts List<string>
    IgnoreEditionCheck bool
    accounts List<String>
    ignoreEditionCheck Boolean
    accounts Sequence[str]
    ignore_edition_check bool
    accounts List<String>
    ignoreEditionCheck Boolean

    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.49.0 published on Monday, Feb 19, 2024 by Pulumi