/// <inheritdoc />
        public override async Task InsertAsync(TableReference tableReference, IEnumerable <InsertRow> rows,
                                               InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            GaxPreconditions.CheckNotNull(rows, nameof(rows));

            var body = new TableDataInsertAllRequest
            {
                Rows = rows.Select(row =>
                {
                    GaxPreconditions.CheckArgument(row != null, nameof(rows), "Entries must not be null");
                    return(row.ToRowsData());
                }).ToList()
            };

            options?.ModifyRequest(body);
            var request  = Service.Tabledata.InsertAll(body, tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);
            var response = await request.ExecuteAsync(cancellationToken).ConfigureAwait(false);

            HandleInsertAllResponse(response);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Asynchronously inserts all the given rows of data into this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.InsertAsync(TableReference, IEnumerable{InsertRow}, InsertOptions, CancellationToken)"/>.
 /// </summary>
 /// <param name="rows">The rows to insert. Must not be null or contain null entries.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation.</returns>
 public Task InsertAsync(IEnumerable <InsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.InsertAsync(Reference, rows, options, cancellationToken);
Ejemplo n.º 3
0
 /// <summary>
 /// Asynchronously inserts a single row of data into this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.InsertAsync(TableReference, InsertRow, InsertOptions, CancellationToken)"/>.
 /// </summary>
 /// <param name="row">The data to insert. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation.</returns>
 public Task InsertAsync(InsertRow row, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.InsertAsync(Reference, row, options, cancellationToken);
Ejemplo n.º 4
0
 /// <summary>
 /// Inserts all the given rows of data into this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.Insert(TableReference, IEnumerable{InsertRow}, InsertOptions)"/>.
 /// </summary>
 /// <param name="rows">The rows to insert. Must not be null or contain null entries.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 public void Insert(IEnumerable <InsertRow> rows, InsertOptions options = null) =>
 _client.Insert(Reference, rows, options);
Ejemplo n.º 5
0
 /// <summary>
 /// Inserts a single row of data into this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.Insert(TableReference, InsertRow, InsertOptions)"/>.
 /// </summary>
 /// <param name="row">The data to insert. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 public void Insert(InsertRow row, InsertOptions options = null) =>
 _client.Insert(Reference, row, options);
        /// <inheritdoc />
        public override void Insert(TableReference tableReference, IEnumerable <InsertRow> rows, InsertOptions options = null)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            GaxPreconditions.CheckNotNull(rows, nameof(rows));

            var body = new TableDataInsertAllRequest
            {
                Rows = rows.Select(row =>
                {
                    GaxPreconditions.CheckArgument(row != null, nameof(rows), "Entries must not be null");
                    return(row.ToRowsData());
                }).ToList()
            };

            options?.ModifyRequest(body);
            var request  = Service.Tabledata.InsertAll(body, tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);
            var response = request.Execute();

            HandleInsertAllResponse(response);
        }
 /// <summary>
 /// Asynchronously inserts all the given rows of data into a table.
 /// </summary>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="rows">The data to insert. Must not be null, or contain null entries.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation.</returns>
 public virtual Task InsertAsync(TableReference tableReference, IEnumerable <InsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Asynchronously inserts a single row of data into a table.
 /// This method just creates an array with the single element and delegates to <see cref="InsertAsync(TableReference, IEnumerable{InsertRow}, InsertOptions,CancellationToken)"/>.
 /// </summary>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="row">The data to insert. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation.</returns>
 public virtual Task InsertAsync(TableReference tableReference, InsertRow row, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 InsertAsync(tableReference, new[] { GaxPreconditions.CheckNotNull(row, nameof(row)) }, options, cancellationToken);
 /// <summary>
 /// Asynchronously inserts all the given rows of data into a table in this client's project specified by dataset ID and table ID.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="InsertAsync(TableReference, IEnumerable{InsertRow}, InsertOptions,CancellationToken)"/>.
 /// </summary>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="tableId">The table ID. Must not be null.</param>
 /// <param name="rows">The data to insert. Must not be null, or contain null entries.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation.</returns>
 public virtual Task InsertAsync(string datasetId, string tableId, IEnumerable <InsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 InsertAsync(GetTableReference(datasetId, tableId), rows, options, cancellationToken);
 /// <summary>
 /// Asynchronously inserts a single row of data into a table specified by project ID, dataset ID and table ID.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="InsertAsync(TableReference, InsertRow, InsertOptions,CancellationToken)"/>.
 /// </summary>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="tableId">The table ID. Must not be null.</param>
 /// <param name="row">The data to insert. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation.</returns>
 public virtual Task InsertAsync(string projectId, string datasetId, string tableId, InsertRow row, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 InsertAsync(GetTableReference(projectId, datasetId, tableId), row, options, cancellationToken);
 /// <summary>
 /// Inserts all the given rows of data into a table.
 /// </summary>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="rows">The data to insert. Must not be null, or contain null entries.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 public virtual void Insert(TableReference tableReference, IEnumerable <InsertRow> rows, InsertOptions options = null)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Inserts all the given rows of data into a table in this client's project specified by dataset ID and table ID.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="Insert(TableReference, IEnumerable{InsertRow}, InsertOptions)"/>.
 /// </summary>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="tableId">The table ID. Must not be null.</param>
 /// <param name="rows">The data to insert. Must not be null, or contain null entries.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 public virtual void Insert(string datasetId, string tableId, IEnumerable <InsertRow> rows, InsertOptions options = null) =>
 Insert(GetTableReference(datasetId, tableId), rows, options);
 /// <summary>
 /// Inserts a single row of data into a table.
 /// This method just creates an array with the single element and delegates to <see cref="Insert(TableReference, IEnumerable{InsertRow}, InsertOptions)"/>.
 /// </summary>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="row">The data to insert. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 public virtual void Insert(TableReference tableReference, InsertRow row, InsertOptions options = null) =>
 Insert(tableReference, new[] { GaxPreconditions.CheckNotNull(row, nameof(row)) }, options);
 /// <summary>
 /// Inserts a single row of data into a table specified by project ID, dataset ID and table ID.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="Insert(TableReference, InsertRow, InsertOptions)"/>.
 /// </summary>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="tableId">The table ID. Must not be null.</param>
 /// <param name="row">The data to insert. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 public virtual void Insert(string projectId, string datasetId, string tableId, InsertRow row, InsertOptions options = null) =>
 Insert(GetTableReference(projectId, datasetId, tableId), row, options);