/// <inheritdoc />
        public override async Task <BigqueryJob> UploadJsonAsync(TableReference tableReference, TableSchema schema, Stream input,
                                                                 UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            GaxPreconditions.CheckNotNull(input, nameof(input));
            schema = schema ?? await GetSchemaAsync(tableReference, cancellationToken).ConfigureAwait(false);

            var configuration = new JobConfigurationLoad
            {
                DestinationTable = tableReference,
                SourceFormat     = "NEWLINE_DELIMITED_JSON",
                Schema           = schema
            };

            options?.ModifyConfiguration(configuration);

            return(await UploadDataAsync(configuration, input, "text/json", cancellationToken).ConfigureAwait(false));
        }
Example #2
0
 /// <summary>
 /// Asynchronously uploads a stream of JSON data to this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadJsonAsync(TableReference, TableSchema, IEnumerable{String}, UploadJsonOptions, CancellationToken)"/>.
 /// </summary>
 /// <remarks>
 /// Each element of <paramref name="rows"/> is converted into a single line of text by replacing carriage returns and line
 /// feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the
 /// original JSON can be formatted however you choose.
 /// </remarks>
 /// <param name="rows">The sequence of JSON strings to upload. Must not be null, and must not contain null elements.</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. When complete, the result is
 /// a data upload job.</returns>
 public Task <BigqueryJob> UploadJsonAsync(IEnumerable <string> rows, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.UploadJsonAsync(Reference, Schema, rows, options, cancellationToken);
Example #3
0
 /// <summary>
 /// Uploads a sequence of JSON rows to this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadJson(TableReference, TableSchema, IEnumerable{String}, UploadJsonOptions)"/>.
 /// </summary>
 /// <remarks>
 /// Each element of <paramref name="rows"/> is converted into a single line of text by replacing carriage returns and line
 /// feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the
 /// original JSON can be formatted however you choose.
 /// </remarks>
 /// <param name="rows">The sequence of JSON strings to upload. Must not be null, and must not contain null elements.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A data upload job.</returns>
 public BigqueryJob UploadJson(IEnumerable <string> rows, UploadJsonOptions options = null) => _client.UploadJson(Reference, Schema, rows, options);
        /// <inheritdoc />
        public override BigqueryJob UploadJson(TableReference tableReference, TableSchema schema, Stream input, UploadJsonOptions options = null)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            GaxPreconditions.CheckNotNull(input, nameof(input));
            schema = schema ?? GetSchema(tableReference);

            var configuration = new JobConfigurationLoad
            {
                DestinationTable = tableReference,
                SourceFormat     = "NEWLINE_DELIMITED_JSON",
                Schema           = schema
            };

            options?.ModifyConfiguration(configuration);

            return(UploadData(configuration, input, "text/json"));
        }
 /// <summary>
 /// Asynchronously uploads a stream of JSON data to a table.
 /// </summary>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="input">The stream of input data. 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. When complete, the result is
 /// a data upload job.</returns>
 public virtual Task <BigqueryJob> UploadJsonAsync(TableReference tableReference,
                                                   TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Uploads a stream of JSON data to 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="UploadJson(TableReference, TableSchema, Stream, UploadJsonOptions)"/>.
 /// </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="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="input">The stream of input data. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A data upload job.</returns>
 public virtual BigqueryJob UploadJson(string datasetId, string tableId,
                                       TableSchema schema, Stream input, UploadJsonOptions options = null) =>
 UploadJson(GetTableReference(datasetId, tableId), schema, input, options);
 /// <summary>
 /// Uploads a stream of JSON data to a table.
 /// </summary>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="input">The stream of input data. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A data upload job.</returns>
 public virtual BigqueryJob UploadJson(TableReference tableReference,
                                       TableSchema schema, Stream input, UploadJsonOptions options = null)
 {
     throw new NotImplementedException();
 }
Example #8
0
 /// <summary>
 /// Uploads a sequence of JSON rows to a table.
 /// </summary>
 /// <remarks>
 /// Each element of <paramref name="rows"/> is converted into a single line of text by replacing carriage returns and line
 /// feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the
 /// original JSON can be formatted however you choose.
 /// </remarks>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="rows">The sequence of JSON strings to upload. Must not be null, and must not contain null elements.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A data upload job.</returns>
 public virtual BigqueryJob UploadJson(TableReference tableReference,
                                       TableSchema schema, IEnumerable <string> rows, UploadJsonOptions options = null)
 {
     throw new NotImplementedException();
 }
Example #9
0
 /// <summary>
 /// Asynchronously uploads a stream of JSON data to a table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions, CancellationToken)"/>.
 /// </summary>
 /// <param name="tableId">The table ID. Must not be null.</param>
 /// <param name="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="input">The stream of input data. 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. When complete, the result is
 /// a data upload job.</returns>
 public Task <BigqueryJob> UploadJsonAsync(string tableId, TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.UploadJsonAsync(GetTableReference(tableId), schema, input, options, cancellationToken);
Example #10
0
 /// <summary>
 /// Uploads a stream of JSON data to a table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadJson(TableReference, TableSchema, Stream, UploadJsonOptions)"/>.
 /// </summary>
 /// <param name="tableId">The table ID. Must not be null.</param>
 /// <param name="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="input">The stream of input data. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A data upload job.</returns>
 public BigqueryJob UploadJson(string tableId, TableSchema schema, Stream input, UploadJsonOptions options = null) =>
 _client.UploadJson(GetTableReference(tableId), schema, input, options);
 /// <inheritdoc />
 public override BigqueryJob UploadJson(TableReference tableReference, TableSchema schema, IEnumerable <string> rows, UploadJsonOptions options = null)
 => UploadJson(tableReference, schema, CreateJsonStream(rows), options);
 /// <inheritdoc />
 public override Task <BigqueryJob> UploadJsonAsync(TableReference tableReference, TableSchema schema, IEnumerable <string> rows,
                                                    UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 => UploadJsonAsync(tableReference, schema, CreateJsonStream(rows), options, cancellationToken);
Example #13
0
 /// <summary>
 /// Asynchronously uploads a sequence of JSON rows to a table specified by project ID, dataset ID and table ID.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="UploadJsonAsync(TableReference, TableSchema, IEnumerable{String}, UploadJsonOptions, CancellationToken)"/>.
 /// </summary>
 /// <remarks>
 /// Each element of <paramref name="rows"/> is converted into a single line of text by replacing carriage returns and line
 /// feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the
 /// original JSON can be formatted however you choose.
 /// </remarks>
 /// <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="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="rows">The sequence of JSON strings to upload. Must not be null, and must not contain null elements.</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. When complete, the result is
 /// A data upload job.</returns>
 public virtual Task <BigqueryJob> UploadJsonAsync(string projectId, string datasetId, string tableId,
                                                   TableSchema schema, IEnumerable <string> rows, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 UploadJsonAsync(GetTableReference(projectId, datasetId, tableId), schema, rows, options, cancellationToken);
Example #14
0
 /// <summary>
 /// Asynchronously uploads a sequence of JSON rows to this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions, CancellationToken)"/>.
 /// </summary>
 /// <param name="input">The stream of input data. 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. When complete, the result is
 /// a data upload job.</returns>
 public Task <BigqueryJob> UploadJsonAsync(Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.UploadJsonAsync(Reference, Schema, input, options, cancellationToken);
 /// <summary>
 /// Asynchronously uploads a stream of JSON data to 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="UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions,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="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="input">The stream of input data. 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. When complete, the result is
 /// a data upload job.</returns>
 public virtual Task <BigqueryJob> UploadJsonAsync(string datasetId, string tableId,
                                                   TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 UploadJsonAsync(GetTableReference(datasetId, tableId), schema, input, options, cancellationToken);
Example #16
0
 /// <summary>
 /// Uploads a stream of JSON data to this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadJson(TableReference, TableSchema, Stream, UploadJsonOptions)"/>.
 /// </summary>
 /// <param name="input">The stream of input data. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A data upload job.</returns>
 public BigqueryJob UploadJson(Stream input, UploadJsonOptions options = null) => _client.UploadJson(Reference, Schema, input, options);
Example #17
0
 /// <summary>
 /// Uploads a sequence of JSON rows to 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="UploadJson(TableReference, TableSchema, IEnumerable{String}, UploadJsonOptions)"/>.
 /// </summary>
 /// <remarks>
 /// Each element of <paramref name="rows"/> is converted into a single line of text by replacing carriage returns and line
 /// feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the
 /// original JSON can be formatted however you choose.
 /// </remarks>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="tableId">The table ID. Must not be null.</param>
 /// <param name="schema">The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.</param>
 /// <param name="rows">The sequence of JSON strings to upload. Must not be null, and must not contain null elements.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A data upload job.</returns>
 public virtual BigqueryJob UploadJson(string datasetId, string tableId,
                                       TableSchema schema, IEnumerable <string> rows, UploadJsonOptions options = null) =>
 UploadJson(GetTableReference(datasetId, tableId), schema, rows, options);