Show / Hide Table of Contents

Namespace Pulumi.Gcp.BigQuery

Classes

AppProfile

App profile is a configuration object describing how Cloud Bigtable should treat traffic from a particular end user application.

AppProfileArgs

AppProfileState

Connection

A connection allows BigQuery connections to external data sources..

To get more information about Connection, see:

  • API documentation
  • How-to Guides
  • Cloud SQL federated queries

Warning: All arguments including cloud_sql.credential.password will be stored in the raw state as plain-text. Read more about sensitive data in state.

ConnectionArgs

ConnectionState

Dataset

Datasets allow you to organize and control access to your tables.

To get more information about Dataset, see:

  • API documentation
  • How-to Guides
  • Datasets Intro

DatasetAccess

Gives dataset access for a single entity. This resource is intended to be used in cases where it is not possible to compile a full list of access blocks to include in a gcp.bigquery.Dataset resource, to enable them to be added separately.

Note: If this resource is used alongside a gcp.bigquery.Dataset resource, the dataset resource must either have no defined access blocks or a lifecycle block with ignore_changes = [access] so they don't fight over which accesses should be on the dataset.

To get more information about DatasetAccess, see:

  • API documentation
  • How-to Guides
  • Controlling access to datasets

Example Usage - Bigquery Dataset Access Basic User

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var dataset = new Gcp.BigQuery.Dataset("dataset", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "example_dataset",
    });
    var bqowner = new Gcp.ServiceAccount.Account("bqowner", new Gcp.ServiceAccount.AccountArgs
    {
        AccountId = "bqowner",
    });
    var access = new Gcp.BigQuery.DatasetAccess("access", new Gcp.BigQuery.DatasetAccessArgs
    {
        DatasetId = dataset.DatasetId,
        Role = "OWNER",
        UserByEmail = bqowner.Email,
    });
}

}

Example Usage - Bigquery Dataset Access View

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var @private = new Gcp.BigQuery.Dataset("private", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "example_dataset",
    });
    var publicDataset = new Gcp.BigQuery.Dataset("publicDataset", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "example_dataset2",
    });
    var publicTable = new Gcp.BigQuery.Table("publicTable", new Gcp.BigQuery.TableArgs
    {
        DatasetId = publicDataset.DatasetId,
        TableId = "example_table",
        View = new Gcp.BigQuery.Inputs.TableViewArgs
        {
            Query = "SELECT state FROM [lookerdata:cdc.project_tycho_reports]",
            UseLegacySql = false,
        },
    });
    var access = new Gcp.BigQuery.DatasetAccess("access", new Gcp.BigQuery.DatasetAccessArgs
    {
        DatasetId = @private.DatasetId,
        View = new Gcp.BigQuery.Inputs.DatasetAccessViewArgs
        {
            ProjectId = publicTable.Project,
            DatasetId = publicDataset.DatasetId,
            TableId = publicTable.TableId,
        },
    });
}

}

DatasetAccessArgs

DatasetAccessState

DatasetArgs

DatasetState

DataTransferConfig

Represents a data transfer configuration. A transfer configuration contains all metadata needed to perform a data transfer.

To get more information about Config, see:

  • API documentation
  • How-to Guides
  • Official Documentation

Example Usage - Scheduled Query

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var project = Output.Create(Gcp.Organizations.GetProject.InvokeAsync());
    var permissions = new Gcp.Projects.IAMMember("permissions", new Gcp.Projects.IAMMemberArgs
    {
        Role = "roles/iam.serviceAccountShortTermTokenMinter",
        Member = project.Apply(project => $"serviceAccount:service-{project.Number}@gcp-sa-bigquerydatatransfer.iam.gserviceaccount.com"),
    });
    var myDataset = new Gcp.BigQuery.Dataset("myDataset", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "my_dataset",
        FriendlyName = "foo",
        Description = "bar",
        Location = "asia-northeast1",
    });
    var queryConfig = new Gcp.BigQuery.DataTransferConfig("queryConfig", new Gcp.BigQuery.DataTransferConfigArgs
    {
        DisplayName = "my-query",
        Location = "asia-northeast1",
        DataSourceId = "scheduled_query",
        Schedule = "first sunday of quarter 00:00",
        DestinationDatasetId = myDataset.DatasetId,
        Params = 
        {
            { "destination_table_name_template", "my-table" },
            { "write_disposition", "WRITE_APPEND" },
            { "query", "SELECT name FROM tabl WHERE x = 'y'" },
        },
    });
}

}

DataTransferConfigArgs

DataTransferConfigState

GetDefaultServiceAccount

GetDefaultServiceAccountArgs

GetDefaultServiceAccountResult

Job

Jobs are actions that BigQuery runs on your behalf to load data, export data, query data, or copy data. Once a BigQuery job is created, it cannot be changed or deleted.

Example Usage - Bigquery Job Query

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var bar = new Gcp.BigQuery.Dataset("bar", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "job_query_dataset",
        FriendlyName = "test",
        Description = "This is a test description",
        Location = "US",
    });
    var foo = new Gcp.BigQuery.Table("foo", new Gcp.BigQuery.TableArgs
    {
        DatasetId = bar.DatasetId,
        TableId = "job_query_table",
    });
    var job = new Gcp.BigQuery.Job("job", new Gcp.BigQuery.JobArgs
    {
        JobId = "job_query",
        Labels = 
        {
            { "example-label", "example-value" },
        },
        Query = new Gcp.BigQuery.Inputs.JobQueryArgs
        {
            Query = "SELECT state FROM [lookerdata:cdc.project_tycho_reports]",
            Destination_table = 
            {
                { "projectId", foo.Project },
                { "datasetId", foo.DatasetId },
                { "tableId", foo.TableId },
            },
            AllowLargeResults = true,
            FlattenResults = true,
            Script_options = 
            {
                { "keyResultStatement", "LAST" },
            },
        },
    });
}

}

Example Usage - Bigquery Job Query Table Reference

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var bar = new Gcp.BigQuery.Dataset("bar", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "job_query_dataset",
        FriendlyName = "test",
        Description = "This is a test description",
        Location = "US",
    });
    var foo = new Gcp.BigQuery.Table("foo", new Gcp.BigQuery.TableArgs
    {
        DatasetId = bar.DatasetId,
        TableId = "job_query_table",
    });
    var job = new Gcp.BigQuery.Job("job", new Gcp.BigQuery.JobArgs
    {
        JobId = "job_query",
        Labels = 
        {
            { "example-label", "example-value" },
        },
        Query = new Gcp.BigQuery.Inputs.JobQueryArgs
        {
            Query = "SELECT state FROM [lookerdata:cdc.project_tycho_reports]",
            Destination_table = 
            {
                { "tableId", foo.Id },
            },
            Default_dataset = 
            {
                { "datasetId", bar.Id },
            },
            AllowLargeResults = true,
            FlattenResults = true,
            Script_options = 
            {
                { "keyResultStatement", "LAST" },
            },
        },
    });
}

}

Example Usage - Bigquery Job Load

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var bar = new Gcp.BigQuery.Dataset("bar", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "job_load_dataset",
        FriendlyName = "test",
        Description = "This is a test description",
        Location = "US",
    });
    var foo = new Gcp.BigQuery.Table("foo", new Gcp.BigQuery.TableArgs
    {
        DatasetId = bar.DatasetId,
        TableId = "job_load_table",
    });
    var job = new Gcp.BigQuery.Job("job", new Gcp.BigQuery.JobArgs
    {
        JobId = "job_load",
        Labels = 
        {
            { "my_job", "load" },
        },
        Load = new Gcp.BigQuery.Inputs.JobLoadArgs
        {
            SourceUris = 
            {
                "gs://cloud-samples-data/bigquery/us-states/us-states-by-date.csv",
            },
            Destination_table = 
            {
                { "projectId", foo.Project },
                { "datasetId", foo.DatasetId },
                { "tableId", foo.TableId },
            },
            SkipLeadingRows = 1,
            SchemaUpdateOptions = 
            {
                "ALLOW_FIELD_RELAXATION",
                "ALLOW_FIELD_ADDITION",
            },
            WriteDisposition = "WRITE_APPEND",
            Autodetect = true,
        },
    });
}

}

Example Usage - Bigquery Job Extract

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var source_oneDataset = new Gcp.BigQuery.Dataset("source-oneDataset", new Gcp.BigQuery.DatasetArgs
    {
        DatasetId = "job_extract_dataset",
        FriendlyName = "test",
        Description = "This is a test description",
        Location = "US",
    });
    var source_oneTable = new Gcp.BigQuery.Table("source-oneTable", new Gcp.BigQuery.TableArgs
    {
        DatasetId = source_oneDataset.DatasetId,
        TableId = "job_extract_table",
        Schema = @"[
{
""name"": ""name"",
""type"": ""STRING"",
""mode"": ""NULLABLE""
},
{
""name"": ""post_abbr"",
""type"": ""STRING"",
""mode"": ""NULLABLE""
},
{
""name"": ""date"",
""type"": ""DATE"",
""mode"": ""NULLABLE""
}
]
",
    });
    var dest = new Gcp.Storage.Bucket("dest", new Gcp.Storage.BucketArgs
    {
        ForceDestroy = true,
    });
    var job = new Gcp.BigQuery.Job("job", new Gcp.BigQuery.JobArgs
    {
        JobId = "job_extract",
        Extract = new Gcp.BigQuery.Inputs.JobExtractArgs
        {
            DestinationUris = 
            {
                dest.Url.Apply(url => $"{url}/extract"),
            },
            Source_table = 
            {
                { "projectId", source_oneTable.Project },
                { "datasetId", source_oneTable.DatasetId },
                { "tableId", source_oneTable.TableId },
            },
            DestinationFormat = "NEWLINE_DELIMITED_JSON",
            Compression = "GZIP",
        },
    });
}

}

JobArgs

JobState

Reservation

A reservation is a mechanism used to guarantee BigQuery slots to users.

To get more information about Reservation, see:

  • API documentation
  • How-to Guides
  • Introduction to Reservations

Example Usage - Bigquery Reservation Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var reservation = new Gcp.BigQuery.Reservation("reservation", new Gcp.BigQuery.ReservationArgs
    {
        Location = "asia-northeast1",
        SlotCapacity = 0,
        IgnoreIdleSlots = false,
    });
}

}

ReservationArgs

ReservationState

Table

Creates a table resource in a dataset for Google BigQuery. For more information see the official documentation and API.

TableArgs

TableState

Back to top Copyright 2016-2020, Pulumi Corporation.