Show / Hide Table of Contents

Class 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",
        },
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Job
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.BigQuery
Assembly: Pulumi.Gcp.dll
Syntax
public class Job : CustomResource

Constructors

View Source

Job(String, JobArgs, CustomResourceOptions)

Create a Job resource with the given unique name, arguments, and options.

Declaration
public Job(string name, JobArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

JobArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Copy

Copies a table. Structure is documented below.

Declaration
public Output<JobCopy> Copy { get; }
Property Value
Type Description
Output<JobCopy>
View Source

Extract

Configures an extract job. Structure is documented below.

Declaration
public Output<JobExtract> Extract { get; }
Property Value
Type Description
Output<JobExtract>
View Source

JobId

The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.

Declaration
public Output<string> JobId { get; }
Property Value
Type Description
Output<System.String>
View Source

JobTimeoutMs

Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.

Declaration
public Output<string> JobTimeoutMs { get; }
Property Value
Type Description
Output<System.String>
View Source

JobType

The type of the job.

Declaration
public Output<string> JobType { get; }
Property Value
Type Description
Output<System.String>
View Source

Labels

The labels associated with this job. You can use these to organize and group your jobs.

Declaration
public Output<ImmutableDictionary<string, string>> Labels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>>
View Source

Load

Configures a load job. Structure is documented below.

Declaration
public Output<JobLoad> Load { get; }
Property Value
Type Description
Output<JobLoad>
View Source

Location

The geographic location of the job. The default value is US.

Declaration
public Output<string> Location { get; }
Property Value
Type Description
Output<System.String>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

Query

Configures a query job. Structure is documented below.

Declaration
public Output<JobQuery> Query { get; }
Property Value
Type Description
Output<JobQuery>
View Source

UserEmail

Email address of the user who ran the job.

Declaration
public Output<string> UserEmail { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, JobState, CustomResourceOptions)

Get an existing Job resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Job Get(string name, Input<string> id, JobState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

JobState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Job
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.