/// <inheritdoc /> public override async Task<BigQueryJob> UploadJsonAsync(TableReference tableReference, TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default) { GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference)); GaxPreconditions.CheckNotNull(input, nameof(input)); schema = schema ?? (options?.Autodetect == true ? null : 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", options, cancellationToken).ConfigureAwait(false); }
/// <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);
/// <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) => _client.UploadJsonAsync(Reference, Schema, input, options, cancellationToken);
/// <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) => _client.UploadJsonAsync(Reference, Schema, rows, options, cancellationToken);
/// <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);
/// <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) => _client.UploadJsonAsync(GetTableReference(tableId), schema, input, options, cancellationToken);
/// <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, 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="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 Task <BigQueryJob> UploadJsonAsync(string tableId, TableSchema schema, IEnumerable <string> rows, UploadJsonOptions options = null, CancellationToken cancellationToken = default) => _client.UploadJsonAsync(GetTableReference(tableId), schema, rows, options, cancellationToken);
/// <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, 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="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 BigQueryJob UploadJson(string tableId, TableSchema schema, IEnumerable <string> rows, UploadJsonOptions options = null) => _client.UploadJson(GetTableReference(tableId), schema, rows, options);
/// <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) => UploadJsonAsync(tableReference, schema, CreateJsonStream(rows), options, cancellationToken);
/// <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 ?? (options?.Autodetect == true ? null : GetSchema(tableReference)); var configuration = new JobConfigurationLoad { DestinationTable = tableReference, SourceFormat = "NEWLINE_DELIMITED_JSON", Schema = schema }; options?.ModifyConfiguration(configuration); return UploadData(configuration, input, "text/json", options); }