public int IndexOf(TableDataInsertAllRequest.RowsData item) { for (int i = 0; i < _insertRows.Count; i++) { if (_insertRows[i].ToRowsData(_allowEmptyInsertIds).Equals(item)) { return(i); } } return(-1); }
private string AddNewPhotoBigQuery(Photo photo) { try { GoogleCredential credential; using (Stream stream = new FileStream(bigqueryFileKey, FileMode.Open, FileAccess.Read, FileShare.Read)) { credential = GoogleCredential.FromStream(stream); } string[] scopes = new string[] { BigqueryService.Scope.Bigquery, BigqueryService.Scope.CloudPlatform, }; credential = credential.CreateScoped(scopes); BaseClientService.Initializer initializer = new BaseClientService.Initializer() { HttpClientInitializer = (IConfigurableHttpClientInitializer)credential, ApplicationName = bigqueryApplicationName, GZipEnabled = true, }; BigqueryService service = new BigqueryService(initializer); var rowList = new List <TableDataInsertAllRequest.RowsData>(); // Check @ https://developers.google.com/bigquery/streaming-data-into-bigquery for InsertId usage var row = new TableDataInsertAllRequest.RowsData(); row.Json = new Dictionary <string, object>(); row.Json.Add("Id", photo.Id); row.Json.Add("Title", photo.Title); row.Json.Add("Url", photo.Url); rowList.Add(row); var content = new TableDataInsertAllRequest(); content.Rows = rowList; content.Kind = "bigquery#tableDataInsertAllRequest"; content.IgnoreUnknownValues = true; content.SkipInvalidRows = true; var requestResponse = service.Tabledata.InsertAll(content, bigqueryProjectId, "dsbigquery", "Photo").Execute(); return("true"); } catch (Exception ex) { return(ex.Message); } }
public bool Remove(TableDataInsertAllRequest.RowsData item) => throw new NotSupportedException();
public void Insert(int index, TableDataInsertAllRequest.RowsData item) => throw new NotSupportedException();
public bool Contains(TableDataInsertAllRequest.RowsData item) => IndexOf(item) >= 0;
public void Add(TableDataInsertAllRequest.RowsData item) => throw new NotSupportedException();