コード例 #1
0
 /// <summary>
 /// Uploads a stream of CSV data to this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadCsv(TableReference, TableSchema, Stream, UploadCsvOptions)"/>.
 /// </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 UploadCsv(Stream input, UploadCsvOptions options = null) => _client.UploadCsv(Reference, Schema, input, options);
コード例 #2
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"));
        }
コード例 #3
0
 /// <summary>
 /// Asynchronously uploads a stream of CSV data to this table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions, 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> UploadCsvAsync(Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.UploadCsvAsync(Reference, Schema, input, options, cancellationToken);
コード例 #4
0
 /// <summary>
 /// Uploads a stream of CSV 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 UploadCsv(TableReference tableReference, TableSchema schema, Stream input, UploadCsvOptions options = null)
 {
     throw new NotImplementedException();
 }
コード例 #5
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));
        }
コード例 #6
0
 /// <summary>
 /// Uploads a stream of CSV data to a table in this project specified by dataset ID and table ID.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="UploadCsv(TableReference, TableSchema, Stream, UploadCsvOptions)"/>.
 /// </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 UploadCsv(string datasetId, string tableId,
                                      TableSchema schema, Stream input, UploadCsvOptions options = null) =>
 UploadCsv(GetTableReference(datasetId, tableId), schema, input, options);
コード例 #7
0
 /// <summary>
 /// Asynchronously uploads a stream of CSV 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> UploadCsvAsync(TableReference tableReference, TableSchema schema, Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 /// <summary>
 /// Asynchronously uploads a stream of CSV data to a table in this project specified by dataset ID and table ID.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions,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> UploadCsvAsync(string datasetId, string tableId,
                                                  TableSchema schema, Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 UploadCsvAsync(GetTableReference(datasetId, tableId), schema, input, options, cancellationToken);
コード例 #9
0
 /// <summary>
 /// Uploads a stream of CSV data to a table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadCsv(TableReference, TableSchema, Stream, UploadCsvOptions)"/>.
 /// </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 UploadCsv(string tableId, TableSchema schema, Stream input, UploadCsvOptions options = null) =>
 _client.UploadCsv(GetTableReference(tableId), schema, input, options);
コード例 #10
0
 /// <summary>
 /// Asynchronously uploads a stream of CSV data to a table.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions, 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> UploadCsvAsync(string tableId, TableSchema schema, Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.UploadCsvAsync(GetTableReference(tableId), schema, input, options, cancellationToken);