title: Idempotency for BigQuery load jobs using Google.Cloud.BigQuery.V2
body: <p>You are able to create a csv load job to load data from a csv file in Google Cloud Storage by using the BigQueryClient in Google.Cloud.BigQuery.V2 which has a CreateLoadJob method.</p>
  
  <p>How can you guarantee idempotency with this API to ensure that say the network dropped before getting a response and you kicked off a retry you would not end up with the same data being loaded into BigQuery multiple times?</p>
  
  <p>Example API usage</p>
  
  <pre><code>    private void LoadCsv(string sourceUri, string tableId, string timePartitionField)
      {
          var tableReference = new TableReference()
          {
              DatasetId = _dataSetId,
              ProjectId = _projectId,
              TableId = tableId
          };
  
          var options = new CreateLoadJobOptions
          {
              WriteDisposition = WriteDisposition.WriteAppend,
              CreateDisposition = CreateDisposition.CreateNever,
              SkipLeadingRows = 1,
              SourceFormat = FileFormat.Csv,
              TimePartitioning = new TimePartitioning
              {
                  Type = _partitionByDayType,
                  Field = timePartitionField
              }
          };
  
          BigQueryJob loadJob = _bigQueryClient.CreateLoadJob(sourceUri: sourceUri,
                                                              destination: tableReference,
                                                              schema: null,
                                                              options: options);
  
          loadJob.PollUntilCompletedAsync().Wait();
          if (loadJob.Status.Errors == null || !loadJob.Status.Errors.Any())
          {
              //Log success
              return;
          }
          //Log error
      }
  </code></pre>