# Google BigQuery v2 API - Class BigQueryRoutine (3.12.0)

3.12.0 (latest) 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.4.0 2.3.0 2.2.0

    public sealed class BigQueryRoutine

Reference documentation and code samples for the Google BigQuery v2 API class BigQueryRoutine.

A routine within a BigQuery dataset.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> BigQueryRoutine

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.BigQuery.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2)

## Assembly

Google.Cloud.BigQuery.V2.dll

## Remarks

This class wraps the underlying REST API resource and retains a reference to the original
client, allowing for simpler routine-oriented operations.

## Constructors

### BigQueryRoutine(BigQueryClient, Routine)

    public BigQueryRoutine(BigQueryClient client, Routine resource)

Constructs a new routine.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `client` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient` The client to use for operations on the routine. Must not be null. |
| `resource` | `https://googleapis.dev/dotnet/Google.Apis.Bigquery.v2/1.74.0.4090/api/Google.Apis.Bigquery.v2.Data.Routine.html` The REST-ful resource representing the routine. Must not be null. |

**Remarks** This is public to allow tests to construct instances for production code to consume;
production code should not normally construct instances itself.

## Properties

### FullyQualifiedId

    public string FullyQualifiedId { get; }

The fully-qualified identifier for the routine in a string form of `project.dataset.routine`.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Reference

    public RoutineReference Reference { get; }

The fully-qualified identifier for the routine, as an object which can be used for other operations
within this API.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://googleapis.dev/dotnet/Google.Apis.Bigquery.v2/1.74.0.4090/api/Google.Apis.Bigquery.v2.Data.RoutineReference.html` |   |

**Remarks** The properties within the reference can be used to determine the project ID,
dataset ID and routine ID components.

### Resource

    public Routine Resource { get; }

The underlying REST-ful resource for the routine.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://googleapis.dev/dotnet/Google.Apis.Bigquery.v2/1.74.0.4090/api/Google.Apis.Bigquery.v2.Data.Routine.html` |   |

**Remarks** The data within the resource may be incomplete, depending on how it was obtained,
because for both get and list operations, a read mask can be specified that determines
which fields are populated on the returned resource.

## Methods

### Delete(DeleteRoutineOptions)

    public void Delete(DeleteRoutineOptions options = null)

Deletes this routine.
This method just creates a [RoutineReference](https://googleapis.dev/dotnet/Google.Apis.Bigquery.v2/1.74.0.4090/api/Google.Apis.Bigquery.v2.Data.RoutineReference.html) and delegates to [DeleteRoutine(RoutineReference, DeleteRoutineOptions)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient#Google_Cloud_BigQuery_V2_BigQueryClient_DeleteRoutine_Google_Apis_Bigquery_v2_Data_RoutineReference_Google_Cloud_BigQuery_V2_DeleteRoutineOptions_).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.DeleteRoutineOptions` The options for the operation. May be null, in which case defaults will be supplied. |

### DeleteAsync(DeleteRoutineOptions, CancellationToken)

    public Task DeleteAsync(DeleteRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes this routine.
This method just creates a [RoutineReference](https://googleapis.dev/dotnet/Google.Apis.Bigquery.v2/1.74.0.4090/api/Google.Apis.Bigquery.v2.Data.RoutineReference.html) and delegates to [DeleteRoutineAsync(RoutineReference, DeleteRoutineOptions, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient#Google_Cloud_BigQuery_V2_BigQueryClient_DeleteRoutineAsync_Google_Apis_Bigquery_v2_Data_RoutineReference_Google_Cloud_BigQuery_V2_DeleteRoutineOptions_System_Threading_CancellationToken_).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.DeleteRoutineOptions` The options for the operation. May be null, in which case defaults will be supplied. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The token to monitor for cancellation requests. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous operation. |

### Update(Routine, UpdateRoutineOptions)

    public BigQueryRoutine Update(Routine resource = null, UpdateRoutineOptions options = null)

Updates this routine to match the specified resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `resource` | `https://googleapis.dev/dotnet/Google.Apis.Bigquery.v2/1.74.0.4090/api/Google.Apis.Bigquery.v2.Data.Routine.html` The resource to update with. If null, the [Resource](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine#Google_Cloud_BigQuery_V2_BigQueryRoutine_Resource) property is used. |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.UpdateRoutineOptions` The options for the operation. May be null, in which case defaults will be supplied. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine` | The updated routine. |

**Remarks** This method delegates to [UpdateRoutine(RoutineReference, Routine, UpdateRoutineOptions)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient#Google_Cloud_BigQuery_V2_BigQueryClient_UpdateRoutine_Google_Apis_Bigquery_v2_Data_RoutineReference_Google_Apis_Bigquery_v2_Data_Routine_Google_Cloud_BigQuery_V2_UpdateRoutineOptions_).
A simple way of updating the routine is to modify [Resource](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine#Google_Cloud_BigQuery_V2_BigQueryRoutine_Resource) and then call this method with no arguments.
This is convenient, but it's important to understand that modifying [Resource](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine#Google_Cloud_BigQuery_V2_BigQueryRoutine_Resource) in this way leaves this object
in an unusual state - it represents "the table as it was when fetched, but then modified locally". For example, the etag
will be the original etag, rather than the one associated with the updated routine. To avoid this causing confusion,
we recommend only taking this approach if the object will not be used afterwards. Use the value returned by this method
as the new, self-consistent representation of the routine.

### UpdateAsync(Routine, UpdateRoutineOptions, CancellationToken)

    public Task<BigQueryRoutine> UpdateAsync(Routine resource = null, UpdateRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously updates this routine to match the specified resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `resource` | `https://googleapis.dev/dotnet/Google.Apis.Bigquery.v2/1.74.0.4090/api/Google.Apis.Bigquery.v2.Data.Routine.html` The resource to update with. If null, the [Resource](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine#Google_Cloud_BigQuery_V2_BigQueryRoutine_Resource) property is used. |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.UpdateRoutineOptions` The options for the operation. May be null, in which case defaults will be supplied. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The token to monitor for cancellation requests. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine` | A task representing the asynchronous operation. When complete, the result is the updated routine. |

**Remarks** This method delegates to [UpdateRoutineAsync(RoutineReference, Routine, UpdateRoutineOptions, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient#Google_Cloud_BigQuery_V2_BigQueryClient_UpdateRoutineAsync_Google_Apis_Bigquery_v2_Data_RoutineReference_Google_Apis_Bigquery_v2_Data_Routine_Google_Cloud_BigQuery_V2_UpdateRoutineOptions_System_Threading_CancellationToken_).
A simple way of updating the routine is to modify [Resource](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine#Google_Cloud_BigQuery_V2_BigQueryRoutine_Resource) and then call this method with no arguments.
This is convenient, but it's important to understand that modifying [Resource](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryRoutine#Google_Cloud_BigQuery_V2_BigQueryRoutine_Resource) in this way leaves this object
in an unusual state - it represents "the table as it was when fetched, but then modified locally". For example, the etag
will be the original etag, rather than the one associated with the updated routine. To avoid this causing confusion,
we recommend only taking this approach if the object will not be used afterwards. Use the value returned by this method
as the new, self-consistent representation of the routine.