コード例 #1
0
        // 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 ?? GetSchema(tableReference);

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

            options?.ModifyConfiguration(configuration);

            return(UploadData(configuration, input, "text/csv"));
        }
コード例 #2
0
        /// <inheritdoc />
        public override async Task <BigqueryJob> UploadCsvAsync(TableReference tableReference, TableSchema schema, Stream input, UploadCsvOptions 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     = "CSV",
                Schema           = schema,
            };

            options?.ModifyConfiguration(configuration);

            return(await UploadDataAsync(configuration, input, "text/csv", cancellationToken).ConfigureAwait(false));
        }