1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. bigtable
  5. LogicalView
Google Cloud v8.30.1 published on Tuesday, May 13, 2025 by Pulumi

gcp.bigtable.LogicalView

Explore with Pulumi AI

gcp logo
Google Cloud v8.30.1 published on Tuesday, May 13, 2025 by Pulumi

    A logical view object that can be referenced in SQL queries.

    To get more information about LogicalView, see:

    Example Usage

    Bigtable Logical View

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const instance = new gcp.bigtable.Instance("instance", {
        name: "bt-instance",
        clusters: [{
            clusterId: "cluster-1",
            zone: "us-east1-b",
            numNodes: 3,
            storageType: "HDD",
        }],
        deletionProtection: false,
    });
    const table = new gcp.bigtable.Table("table", {
        name: "bt-table",
        instanceName: instance.name,
        columnFamilies: [{
            family: "CF",
        }],
    });
    const logicalView = new gcp.bigtable.LogicalView("logical_view", {
        logicalViewId: "bt-logical-view",
        instance: instance.name,
        query: `SELECT _key, CF
    FROM \` + "\`bt-table\`" + \`
    `,
    }, {
        dependsOn: [table],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    instance = gcp.bigtable.Instance("instance",
        name="bt-instance",
        clusters=[{
            "cluster_id": "cluster-1",
            "zone": "us-east1-b",
            "num_nodes": 3,
            "storage_type": "HDD",
        }],
        deletion_protection=False)
    table = gcp.bigtable.Table("table",
        name="bt-table",
        instance_name=instance.name,
        column_families=[{
            "family": "CF",
        }])
    logical_view = gcp.bigtable.LogicalView("logical_view",
        logical_view_id="bt-logical-view",
        instance=instance.name,
        query="""SELECT _key, CF
    FROM ` + "`bt-table`" + `
    """,
        opts = pulumi.ResourceOptions(depends_on=[table]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/bigtable"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		instance, err := bigtable.NewInstance(ctx, "instance", &bigtable.InstanceArgs{
    			Name: pulumi.String("bt-instance"),
    			Clusters: bigtable.InstanceClusterArray{
    				&bigtable.InstanceClusterArgs{
    					ClusterId:   pulumi.String("cluster-1"),
    					Zone:        pulumi.String("us-east1-b"),
    					NumNodes:    pulumi.Int(3),
    					StorageType: pulumi.String("HDD"),
    				},
    			},
    			DeletionProtection: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		table, err := bigtable.NewTable(ctx, "table", &bigtable.TableArgs{
    			Name:         pulumi.String("bt-table"),
    			InstanceName: instance.Name,
    			ColumnFamilies: bigtable.TableColumnFamilyArray{
    				&bigtable.TableColumnFamilyArgs{
    					Family: pulumi.String("CF"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = bigtable.NewLogicalView(ctx, "logical_view", &bigtable.LogicalViewArgs{
    			LogicalViewId: pulumi.String("bt-logical-view"),
    			Instance:      instance.Name,
    			Query:         pulumi.String("SELECT _key, CF\nFROM ` + \"`bt-table`\" + `\n"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			table,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var instance = new Gcp.BigTable.Instance("instance", new()
        {
            Name = "bt-instance",
            Clusters = new[]
            {
                new Gcp.BigTable.Inputs.InstanceClusterArgs
                {
                    ClusterId = "cluster-1",
                    Zone = "us-east1-b",
                    NumNodes = 3,
                    StorageType = "HDD",
                },
            },
            DeletionProtection = false,
        });
    
        var table = new Gcp.BigTable.Table("table", new()
        {
            Name = "bt-table",
            InstanceName = instance.Name,
            ColumnFamilies = new[]
            {
                new Gcp.BigTable.Inputs.TableColumnFamilyArgs
                {
                    Family = "CF",
                },
            },
        });
    
        var logicalView = new Gcp.BigTable.LogicalView("logical_view", new()
        {
            LogicalViewId = "bt-logical-view",
            Instance = instance.Name,
            Query = @"SELECT _key, CF
    FROM ` + ""`bt-table`"" + `
    ",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                table,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.bigtable.Instance;
    import com.pulumi.gcp.bigtable.InstanceArgs;
    import com.pulumi.gcp.bigtable.inputs.InstanceClusterArgs;
    import com.pulumi.gcp.bigtable.Table;
    import com.pulumi.gcp.bigtable.TableArgs;
    import com.pulumi.gcp.bigtable.inputs.TableColumnFamilyArgs;
    import com.pulumi.gcp.bigtable.LogicalView;
    import com.pulumi.gcp.bigtable.LogicalViewArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 instance = new Instance("instance", InstanceArgs.builder()
                .name("bt-instance")
                .clusters(InstanceClusterArgs.builder()
                    .clusterId("cluster-1")
                    .zone("us-east1-b")
                    .numNodes(3)
                    .storageType("HDD")
                    .build())
                .deletionProtection(false)
                .build());
    
            var table = new Table("table", TableArgs.builder()
                .name("bt-table")
                .instanceName(instance.name())
                .columnFamilies(TableColumnFamilyArgs.builder()
                    .family("CF")
                    .build())
                .build());
    
            var logicalView = new LogicalView("logicalView", LogicalViewArgs.builder()
                .logicalViewId("bt-logical-view")
                .instance(instance.name())
                .query("""
    SELECT _key, CF
    FROM ` + "`bt-table`" + `
                """)
                .build(), CustomResourceOptions.builder()
                    .dependsOn(table)
                    .build());
    
        }
    }
    
    resources:
      instance:
        type: gcp:bigtable:Instance
        properties:
          name: bt-instance
          clusters:
            - clusterId: cluster-1
              zone: us-east1-b
              numNodes: 3
              storageType: HDD
          deletionProtection: false
      table:
        type: gcp:bigtable:Table
        properties:
          name: bt-table
          instanceName: ${instance.name}
          columnFamilies:
            - family: CF
      logicalView:
        type: gcp:bigtable:LogicalView
        name: logical_view
        properties:
          logicalViewId: bt-logical-view
          instance: ${instance.name}
          query: |
            SELECT _key, CF
            FROM ` + "`bt-table`" + `        
        options:
          dependsOn:
            - ${table}
    

    Create LogicalView Resource

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

    Constructor syntax

    new LogicalView(name: string, args: LogicalViewArgs, opts?: CustomResourceOptions);
    @overload
    def LogicalView(resource_name: str,
                    args: LogicalViewArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def LogicalView(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    logical_view_id: Optional[str] = None,
                    query: Optional[str] = None,
                    instance: Optional[str] = None,
                    project: Optional[str] = None)
    func NewLogicalView(ctx *Context, name string, args LogicalViewArgs, opts ...ResourceOption) (*LogicalView, error)
    public LogicalView(string name, LogicalViewArgs args, CustomResourceOptions? opts = null)
    public LogicalView(String name, LogicalViewArgs args)
    public LogicalView(String name, LogicalViewArgs args, CustomResourceOptions options)
    
    type: gcp:bigtable:LogicalView
    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 LogicalViewArgs
    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 LogicalViewArgs
    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 LogicalViewArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LogicalViewArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LogicalViewArgs
    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 logicalViewResource = new Gcp.BigTable.LogicalView("logicalViewResource", new()
    {
        LogicalViewId = "string",
        Query = "string",
        Instance = "string",
        Project = "string",
    });
    
    example, err := bigtable.NewLogicalView(ctx, "logicalViewResource", &bigtable.LogicalViewArgs{
    	LogicalViewId: pulumi.String("string"),
    	Query:         pulumi.String("string"),
    	Instance:      pulumi.String("string"),
    	Project:       pulumi.String("string"),
    })
    
    var logicalViewResource = new LogicalView("logicalViewResource", LogicalViewArgs.builder()
        .logicalViewId("string")
        .query("string")
        .instance("string")
        .project("string")
        .build());
    
    logical_view_resource = gcp.bigtable.LogicalView("logicalViewResource",
        logical_view_id="string",
        query="string",
        instance="string",
        project="string")
    
    const logicalViewResource = new gcp.bigtable.LogicalView("logicalViewResource", {
        logicalViewId: "string",
        query: "string",
        instance: "string",
        project: "string",
    });
    
    type: gcp:bigtable:LogicalView
    properties:
        instance: string
        logicalViewId: string
        project: string
        query: string
    

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

    LogicalViewId string
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    Query string
    The logical view's select query.
    Instance string
    The name of the instance to create the logical view within.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    LogicalViewId string
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    Query string
    The logical view's select query.
    Instance string
    The name of the instance to create the logical view within.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    logicalViewId String
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    query String
    The logical view's select query.
    instance String
    The name of the instance to create the logical view within.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    logicalViewId string
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    query string
    The logical view's select query.
    instance string
    The name of the instance to create the logical view within.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    logical_view_id str
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    query str
    The logical view's select query.
    instance str
    The name of the instance to create the logical view within.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    logicalViewId String
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    query String
    The logical view's select query.
    instance String
    The name of the instance to create the logical view within.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.

    Look up Existing LogicalView Resource

    Get an existing LogicalView 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?: LogicalViewState, opts?: CustomResourceOptions): LogicalView
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            instance: Optional[str] = None,
            logical_view_id: Optional[str] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            query: Optional[str] = None) -> LogicalView
    func GetLogicalView(ctx *Context, name string, id IDInput, state *LogicalViewState, opts ...ResourceOption) (*LogicalView, error)
    public static LogicalView Get(string name, Input<string> id, LogicalViewState? state, CustomResourceOptions? opts = null)
    public static LogicalView get(String name, Output<String> id, LogicalViewState state, CustomResourceOptions options)
    resources:  _:    type: gcp:bigtable:LogicalView    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.
    The following state arguments are supported:
    Instance string
    The name of the instance to create the logical view within.
    LogicalViewId string
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    Name string
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Query string
    The logical view's select query.
    Instance string
    The name of the instance to create the logical view within.
    LogicalViewId string
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    Name string
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Query string
    The logical view's select query.
    instance String
    The name of the instance to create the logical view within.
    logicalViewId String
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    name String
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    query String
    The logical view's select query.
    instance string
    The name of the instance to create the logical view within.
    logicalViewId string
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    name string
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    query string
    The logical view's select query.
    instance str
    The name of the instance to create the logical view within.
    logical_view_id str
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    name str
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    query str
    The logical view's select query.
    instance String
    The name of the instance to create the logical view within.
    logicalViewId String
    The unique name of the logical view in the form [_a-zA-Z0-9][-_.a-zA-Z0-9]*.


    name String
    The unique name of the requested logical view. Values are of the form projects/<project>/instances/<instance>/logicalViews/<logicalViewId>.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    query String
    The logical view's select query.

    Import

    LogicalView can be imported using any of these accepted formats:

    • projects/{{project}}/instances/{{instance}}/logicalViews/{{logical_view_id}}

    • {{project}}/{{instance}}/{{logical_view_id}}

    • {{instance}}/{{logical_view_id}}

    When using the pulumi import command, LogicalView can be imported using one of the formats above. For example:

    $ pulumi import gcp:bigtable/logicalView:LogicalView default projects/{{project}}/instances/{{instance}}/logicalViews/{{logical_view_id}}
    
    $ pulumi import gcp:bigtable/logicalView:LogicalView default {{project}}/{{instance}}/{{logical_view_id}}
    
    $ pulumi import gcp:bigtable/logicalView:LogicalView default {{instance}}/{{logical_view_id}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud v8.30.1 published on Tuesday, May 13, 2025 by Pulumi