// TODO: Allow JSON and CSV to be loaded from a TextReader? Tricky, but useful. /// <inheritdoc /> public override BigQueryJob UploadCsv(TableReference tableReference, TableSchema schema, Stream input, UploadCsvOptions 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 = "CSV", Schema = schema, }; options?.ModifyConfiguration(configuration); return UploadData(configuration, input, "text/csv", options); }
/// <inheritdoc /> public override async Task<BigQueryJob> UploadCsvAsync(TableReference tableReference, TableSchema schema, Stream input, UploadCsvOptions 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 = "CSV", Schema = schema, }; options?.ModifyConfiguration(configuration); return await UploadDataAsync(configuration, input, "text/csv", options, cancellationToken).ConfigureAwait(false); }