public abstract class JobCreationOptionsReference documentation and code samples for the Google BigQuery v2 API class JobCreationOptions.
Base class for options for operations that create jobs.
Derived Types
Namespace
Google.Cloud.BigQuery.V2Assembly
Google.Cloud.BigQuery.V2.dll
Properties
JobConfigurationModifier
public Action<JobConfiguration> JobConfigurationModifier { get; set; }Optional action to perform after preparing the request. If this property is non-null, the JobConfiguration used for a request will be passed to the delegate before the request is executed. This allows for fine-grained modifications which aren't otherwise directly supported by the properties in this options type or derived option types.
| Property Value | |
|---|---|
| Type | Description |
ActionJobConfiguration |
|
Prefer the properties on this type over this modifier to prepare the request. Only use this modifier to configure aspects for which there are no properties available. This modifier is applied to the request after all properties on this type have been applied. The delegate is only called once per operation, even if the request is automatically retried.
JobId
public string JobId { get; set; }If specified, this ID will be used to create the job. It is an error to set both this property and JobIdPrefix.
| Property Value | |
|---|---|
| Type | Description |
string |
|
JobIdPrefix
public string JobIdPrefix { get; set; }If specified, use this prefix when generating a job ID. (Job IDs are always generated client-side by this library, to allow insertion to be retried where necessary.) It is an error to set both this property and JobId.
| Property Value | |
|---|---|
| Type | Description |
string |
|
JobLocation
public string JobLocation { get; set; }If specified, the job will be created in this location. Otherwise, it will be created in the client's default location.
| Property Value | |
|---|---|
| Type | Description |
string |
|
Labels
public IDictionary<string, string> Labels { get; set; }The labels associated with the job to be created.
Labels are key-value pairs.
You can use these to organize and group your jobs.
Label keys and values can be no longer than 63 characters,
can only contain lowercase letters, numeric characters,
underscores and dashes. International characters are allowed.
If a label value is
null, it won't be added to the job's labels. A label value can be Empty. Label keys must start with a letter.
| Property Value | |
|---|---|
| Type | Description |
IDictionarystringstring |
|
IDictionary<string, string> labels = new Dictionary<string, string>()
{
{"label-key", "label-value" }
};
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(projectId, datasetId, tableId);
string destinationUri = $"gs://{bucketName}/{objectName}";
// Just a couple examples of jobs marked with labels:
// (These jobs will most certainly be created somewhere else.)
// Running a query on a given table.
BigQueryJob oneLabeledJob = client.CreateQueryJob(
$"SELECT * FROM {table}", null,
new QueryOptions { Labels = labels });
// Extracting data from a table to GCS.
BigQueryJob anotherLabeledJob = client.CreateExtractJob(
projectId, datasetId, tableId, destinationUri,
new CreateExtractJobOptions { Labels = labels });
// Find jobs marked with a certain label.
KeyValuePair<string, string> labelToBeFound = labels.First();
// Specify full projection to make sure that
// label information, if it exists, is returned for listed jobs.
ListJobsOptions options = new ListJobsOptions { Projection = ProjectionEnum.Full };
List <BigQueryJob> jobs = client
.ListJobs(options)
.Where(job => job.Resource.Configuration.Labels?.Contains(labelToBeFound) ?? false)
.Take(2)
.ToList();
foreach (BigQueryJob job in jobs)
{
Console.WriteLine(job.Reference.JobId);
}
ProjectId
public string ProjectId { get; set; }The ID of the project in which to create the job. If this is not set, it defaults to the project ID of the client.
| Property Value | |
|---|---|
| Type | Description |
string |
|