1. Packages
  2. InfluxDB V3
  3. API Docs
  4. Database
InfluxDB3 v1.3.0 published on Tuesday, Mar 11, 2025 by komminarlabs

influxdb3.Database

Explore with Pulumi AI

Creates and manages a database.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as influxdb3 from "@komminarlabs/influxdb3";

const signals = new influxdb3.Database("signals", {
    name: "signals",
    retentionPeriod: 604800,
    partitionTemplates: [
        {
            type: "tag",
            value: "line",
        },
        {
            type: "tag",
            value: "station",
        },
        {
            type: "time",
            value: "%Y-%m-%d",
        },
        {
            type: "bucket",
            value: JSON.stringify({
                tagName: "temperature",
                numberOfBuckets: 10,
            }),
        },
    ],
});
Copy
import pulumi
import json
import komminarlabs_influxdb3 as influxdb3

signals = influxdb3.Database("signals",
    name="signals",
    retention_period=604800,
    partition_templates=[
        {
            "type": "tag",
            "value": "line",
        },
        {
            "type": "tag",
            "value": "station",
        },
        {
            "type": "time",
            "value": "%Y-%m-%d",
        },
        {
            "type": "bucket",
            "value": json.dumps({
                "tagName": "temperature",
                "numberOfBuckets": 10,
            }),
        },
    ])
Copy
package main

import (
	"encoding/json"

	"github.com/komminarlabs/pulumi-influxdb3/sdk/go/influxdb3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"tagName":         "temperature",
			"numberOfBuckets": 10,
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = influxdb3.NewDatabase(ctx, "signals", &influxdb3.DatabaseArgs{
			Name:            pulumi.String("signals"),
			RetentionPeriod: pulumi.Int(604800),
			PartitionTemplates: influxdb3.DatabasePartitionTemplateArray{
				&influxdb3.DatabasePartitionTemplateArgs{
					Type:  pulumi.String("tag"),
					Value: pulumi.String("line"),
				},
				&influxdb3.DatabasePartitionTemplateArgs{
					Type:  pulumi.String("tag"),
					Value: pulumi.String("station"),
				},
				&influxdb3.DatabasePartitionTemplateArgs{
					Type:  pulumi.String("time"),
					Value: pulumi.String("%Y-%m-%d"),
				},
				&influxdb3.DatabasePartitionTemplateArgs{
					Type:  pulumi.String("bucket"),
					Value: pulumi.String(json0),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using InfluxDB3 = KomminarLabs.InfluxDB3;

return await Deployment.RunAsync(() => 
{
    var signals = new InfluxDB3.Database("signals", new()
    {
        Name = "signals",
        RetentionPeriod = 604800,
        PartitionTemplates = new[]
        {
            new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
            {
                Type = "tag",
                Value = "line",
            },
            new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
            {
                Type = "tag",
                Value = "station",
            },
            new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
            {
                Type = "time",
                Value = "%Y-%m-%d",
            },
            new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
            {
                Type = "bucket",
                Value = JsonSerializer.Serialize(new Dictionary<string, object?>
                {
                    ["tagName"] = "temperature",
                    ["numberOfBuckets"] = 10,
                }),
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.influxdb3.Database;
import com.pulumi.influxdb3.DatabaseArgs;
import com.pulumi.influxdb3.inputs.DatabasePartitionTemplateArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 signals = new Database("signals", DatabaseArgs.builder()
            .name("signals")
            .retentionPeriod(604800)
            .partitionTemplates(            
                DatabasePartitionTemplateArgs.builder()
                    .type("tag")
                    .value("line")
                    .build(),
                DatabasePartitionTemplateArgs.builder()
                    .type("tag")
                    .value("station")
                    .build(),
                DatabasePartitionTemplateArgs.builder()
                    .type("time")
                    .value("%Y-%m-%d")
                    .build(),
                DatabasePartitionTemplateArgs.builder()
                    .type("bucket")
                    .value(serializeJson(
                        jsonObject(
                            jsonProperty("tagName", "temperature"),
                            jsonProperty("numberOfBuckets", 10)
                        )))
                    .build())
            .build());

    }
}
Copy
resources:
  signals:
    type: influxdb3:Database
    properties:
      name: signals
      retentionPeriod: 604800
      partitionTemplates:
        - type: tag
          value: line
        - type: tag
          value: station
        - type: time
          value: '%Y-%m-%d'
        - type: bucket
          value:
            fn::toJSON:
              tagName: temperature
              numberOfBuckets: 10
Copy

Create Database Resource

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

Constructor syntax

new Database(name: string, args?: DatabaseArgs, opts?: CustomResourceOptions);
@overload
def Database(resource_name: str,
             args: Optional[DatabaseArgs] = None,
             opts: Optional[ResourceOptions] = None)

@overload
def Database(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             max_columns_per_table: Optional[int] = None,
             max_tables: Optional[int] = None,
             name: Optional[str] = None,
             partition_templates: Optional[Sequence[DatabasePartitionTemplateArgs]] = None,
             retention_period: Optional[int] = 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: influxdb3:Database
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args DatabaseArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args 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 This property is required. 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 This property is required. 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 This property is required. String
The unique name of the resource.
args This property is required. DatabaseArgs
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 databaseResource = new InfluxDB3.Database("databaseResource", new()
{
    MaxColumnsPerTable = 0,
    MaxTables = 0,
    Name = "string",
    PartitionTemplates = new[]
    {
        new InfluxDB3.Inputs.DatabasePartitionTemplateArgs
        {
            Type = "string",
            Value = "string",
        },
    },
    RetentionPeriod = 0,
});
Copy
example, err := influxdb3.NewDatabase(ctx, "databaseResource", &influxdb3.DatabaseArgs{
	MaxColumnsPerTable: pulumi.Int(0),
	MaxTables:          pulumi.Int(0),
	Name:               pulumi.String("string"),
	PartitionTemplates: influxdb3.DatabasePartitionTemplateArray{
		&influxdb3.DatabasePartitionTemplateArgs{
			Type:  pulumi.String("string"),
			Value: pulumi.String("string"),
		},
	},
	RetentionPeriod: pulumi.Int(0),
})
Copy
var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
    .maxColumnsPerTable(0)
    .maxTables(0)
    .name("string")
    .partitionTemplates(DatabasePartitionTemplateArgs.builder()
        .type("string")
        .value("string")
        .build())
    .retentionPeriod(0)
    .build());
Copy
database_resource = influxdb3.Database("databaseResource",
    max_columns_per_table=0,
    max_tables=0,
    name="string",
    partition_templates=[{
        "type": "string",
        "value": "string",
    }],
    retention_period=0)
Copy
const databaseResource = new influxdb3.Database("databaseResource", {
    maxColumnsPerTable: 0,
    maxTables: 0,
    name: "string",
    partitionTemplates: [{
        type: "string",
        value: "string",
    }],
    retentionPeriod: 0,
});
Copy
type: influxdb3:Database
properties:
    maxColumnsPerTable: 0
    maxTables: 0
    name: string
    partitionTemplates:
        - type: string
          value: string
    retentionPeriod: 0
Copy

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

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

The Database resource accepts the following input properties:

MaxColumnsPerTable int
The maximum number of columns per table for the cluster database. The default is 200
MaxTables int
The maximum number of tables for the cluster database. The default is 500
Name string
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
PartitionTemplates List<KomminarLabs.InfluxDB3.Inputs.DatabasePartitionTemplate>
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
RetentionPeriod int
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
MaxColumnsPerTable int
The maximum number of columns per table for the cluster database. The default is 200
MaxTables int
The maximum number of tables for the cluster database. The default is 500
Name string
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
PartitionTemplates []DatabasePartitionTemplateArgs
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
RetentionPeriod int
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
maxColumnsPerTable Integer
The maximum number of columns per table for the cluster database. The default is 200
maxTables Integer
The maximum number of tables for the cluster database. The default is 500
name String
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partitionTemplates List<DatabasePartitionTemplate>
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retentionPeriod Integer
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
maxColumnsPerTable number
The maximum number of columns per table for the cluster database. The default is 200
maxTables number
The maximum number of tables for the cluster database. The default is 500
name string
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partitionTemplates DatabasePartitionTemplate[]
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retentionPeriod number
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
max_columns_per_table int
The maximum number of columns per table for the cluster database. The default is 200
max_tables int
The maximum number of tables for the cluster database. The default is 500
name str
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partition_templates Sequence[DatabasePartitionTemplateArgs]
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retention_period int
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
maxColumnsPerTable Number
The maximum number of columns per table for the cluster database. The default is 200
maxTables Number
The maximum number of tables for the cluster database. The default is 500
name String
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partitionTemplates List<Property Map>
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retentionPeriod Number
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.

Outputs

All input properties are implicitly available as output properties. Additionally, the Database resource produces the following output properties:

AccountId string
The ID of the account that the database belongs to.
ClusterId string
The ID of the cluster that the database belongs to.
Id string
The provider-assigned unique ID for this managed resource.
AccountId string
The ID of the account that the database belongs to.
ClusterId string
The ID of the cluster that the database belongs to.
Id string
The provider-assigned unique ID for this managed resource.
accountId String
The ID of the account that the database belongs to.
clusterId String
The ID of the cluster that the database belongs to.
id String
The provider-assigned unique ID for this managed resource.
accountId string
The ID of the account that the database belongs to.
clusterId string
The ID of the cluster that the database belongs to.
id string
The provider-assigned unique ID for this managed resource.
account_id str
The ID of the account that the database belongs to.
cluster_id str
The ID of the cluster that the database belongs to.
id str
The provider-assigned unique ID for this managed resource.
accountId String
The ID of the account that the database belongs to.
clusterId String
The ID of the cluster that the database belongs to.
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,
        account_id: Optional[str] = None,
        cluster_id: Optional[str] = None,
        max_columns_per_table: Optional[int] = None,
        max_tables: Optional[int] = None,
        name: Optional[str] = None,
        partition_templates: Optional[Sequence[DatabasePartitionTemplateArgs]] = None,
        retention_period: Optional[int] = 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)
resources:  _:    type: influxdb3:Database    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccountId string
The ID of the account that the database belongs to.
ClusterId string
The ID of the cluster that the database belongs to.
MaxColumnsPerTable int
The maximum number of columns per table for the cluster database. The default is 200
MaxTables int
The maximum number of tables for the cluster database. The default is 500
Name string
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
PartitionTemplates List<KomminarLabs.InfluxDB3.Inputs.DatabasePartitionTemplate>
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
RetentionPeriod int
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
AccountId string
The ID of the account that the database belongs to.
ClusterId string
The ID of the cluster that the database belongs to.
MaxColumnsPerTable int
The maximum number of columns per table for the cluster database. The default is 200
MaxTables int
The maximum number of tables for the cluster database. The default is 500
Name string
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
PartitionTemplates []DatabasePartitionTemplateArgs
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
RetentionPeriod int
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
accountId String
The ID of the account that the database belongs to.
clusterId String
The ID of the cluster that the database belongs to.
maxColumnsPerTable Integer
The maximum number of columns per table for the cluster database. The default is 200
maxTables Integer
The maximum number of tables for the cluster database. The default is 500
name String
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partitionTemplates List<DatabasePartitionTemplate>
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retentionPeriod Integer
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
accountId string
The ID of the account that the database belongs to.
clusterId string
The ID of the cluster that the database belongs to.
maxColumnsPerTable number
The maximum number of columns per table for the cluster database. The default is 200
maxTables number
The maximum number of tables for the cluster database. The default is 500
name string
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partitionTemplates DatabasePartitionTemplate[]
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retentionPeriod number
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
account_id str
The ID of the account that the database belongs to.
cluster_id str
The ID of the cluster that the database belongs to.
max_columns_per_table int
The maximum number of columns per table for the cluster database. The default is 200
max_tables int
The maximum number of tables for the cluster database. The default is 500
name str
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partition_templates Sequence[DatabasePartitionTemplateArgs]
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retention_period int
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.
accountId String
The ID of the account that the database belongs to.
clusterId String
The ID of the cluster that the database belongs to.
maxColumnsPerTable Number
The maximum number of columns per table for the cluster database. The default is 200
maxTables Number
The maximum number of tables for the cluster database. The default is 500
name String
The name of the cluster database. The Length should be between [ 1 .. 64 ] characters. Note: Database names can't be updated. An update will result in resource replacement. After a database is deleted, you cannot reuse the same name for a new database.
partitionTemplates List<Property Map>
A template for partitioning a cluster database. Note: A partition template can include up to 7 total tag and tag bucket parts and only 1 time part. You can only apply a partition template when creating a database. You can't update a partition template on an existing database. An update will result in resource replacement.
retentionPeriod Number
The retention period of the cluster database in nanoseconds. The default is 0. If the retention period is not set or is set to 0, the database will have infinite retention.

Supporting Types

DatabasePartitionTemplate
, DatabasePartitionTemplateArgs

Type This property is required. string
The type of template part. Valid values are bucket, tag or time.
Value This property is required. string
The value of template part. Note: For bucket partition template type use jsonencode() function to encode the value to a string.
Type This property is required. string
The type of template part. Valid values are bucket, tag or time.
Value This property is required. string
The value of template part. Note: For bucket partition template type use jsonencode() function to encode the value to a string.
type This property is required. String
The type of template part. Valid values are bucket, tag or time.
value This property is required. String
The value of template part. Note: For bucket partition template type use jsonencode() function to encode the value to a string.
type This property is required. string
The type of template part. Valid values are bucket, tag or time.
value This property is required. string
The value of template part. Note: For bucket partition template type use jsonencode() function to encode the value to a string.
type This property is required. str
The type of template part. Valid values are bucket, tag or time.
value This property is required. str
The value of template part. Note: For bucket partition template type use jsonencode() function to encode the value to a string.
type This property is required. String
The type of template part. Valid values are bucket, tag or time.
value This property is required. String
The value of template part. Note: For bucket partition template type use jsonencode() function to encode the value to a string.

Package Details

Repository
influxdb3 komminarlabs/pulumi-influxdb3
License
Apache-2.0
Notes
This Pulumi package is based on the influxdb3 Terraform Provider.