/// <summary>
 /// Asynchronously creates a job to copy data from this table to another.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigQueryClient.CreateCopyJobAsync(TableReference, TableReference, CreateCopyJobOptions, CancellationToken)"/>.
 /// </summary>
 /// <remarks>
 /// This method only allows one table (this one) to be used as the source table. To copy multiple tables to one destination table,
 /// use <see cref="BigQueryClient.CreateCopyJobAsync(IEnumerable{TableReference}, TableReference, CreateCopyJobOptions, CancellationToken)"/>.
 /// </remarks>
 /// <param name="destination">The destination table to copy to. 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 the job created for the copy operation.</returns>
 public Task <BigQueryJob> CreateCopyJobAsync(TableReference destination, CreateCopyJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 _client.CreateCopyJobAsync(Reference, destination, options, cancellationToken);
示例#2
0
 /// <summary>
 /// Creates a job to copy data from this table to another.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigQueryClient.CreateCopyJob(TableReference, TableReference, CreateCopyJobOptions)"/>.
 /// </summary>
 /// <remarks>
 /// This method only allows one table (this one) to be used as the source table. To copy multiple tables to one destination table,
 /// use <see cref="BigQueryClient.CreateCopyJob(IEnumerable{TableReference}, TableReference, CreateCopyJobOptions)"/>.
 /// </remarks>
 /// <param name="destination">The destination table to copy to. 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>The job created for the copy operation.</returns>
 public BigQueryJob CreateCopyJob(TableReference destination, CreateCopyJobOptions options = null) =>
 _client.CreateCopyJob(Reference, destination, options);
示例#3
0
        /// <inheritdoc />
        public override async Task <BigQueryJob> CreateCopyJobAsync(IEnumerable <TableReference> sources, TableReference destination, CreateCopyJobOptions options = null, CancellationToken cancellationToken = default)
        {
            var job = await CreateCopyJobRequest(sources, destination, options).ExecuteAsync(cancellationToken).ConfigureAwait(false);

            return(new BigQueryJob(this, job));
        }
示例#4
0
        private InsertRequest CreateCopyJobRequest(IEnumerable <TableReference> sources, TableReference destination, CreateCopyJobOptions options)
        {
            GaxPreconditions.CheckNotNull(sources, nameof(sources));
            GaxPreconditions.CheckNotNull(destination, nameof(destination));
            List <TableReference> sourceList = sources.ToList();

            GaxPreconditions.CheckArgument(sourceList.Count != 0, nameof(sources), "Sources cannot be empty");

            var copy = new JobConfigurationTableCopy {
                SourceTables = sourceList, DestinationTable = destination
            };

            options?.ModifyRequest(copy);
            return(CreateInsertJobRequest(new JobConfiguration {
                Copy = copy
            }, options));
        }
示例#5
0
        /// <inheritdoc />
        public override BigQueryJob CreateCopyJob(IEnumerable <TableReference> sources, TableReference destination, CreateCopyJobOptions options = null)
        {
            var job = CreateCopyJobRequest(sources, destination, options).Execute();

            return(new BigQueryJob(this, job));
        }
示例#6
0
 /// <summary>
 /// Asynchronously creates a job to copy data from at least one table to another.
 /// </summary>
 /// <remarks>
 /// To avoid confusion between source and destination tables, overloads are not provided that take the
 /// individual components of table references. Instead, use <see cref="GetTableReference(string, string)"/> or
 /// <see cref="GetTableReference(string, string, string)"/> to create table references.
 /// </remarks>
 /// <param name="sources">The source tables to copy. Must not be null or empty.</param>
 /// <param name="destination">The destination to copy to. 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 the job created for the copy operation.</returns>
 public virtual Task <BigQueryJob> CreateCopyJobAsync(IEnumerable <TableReference> sources, TableReference destination, CreateCopyJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
示例#7
0
 /// <summary>
 /// Asynchronously creates a job to copy one table to another.
 /// This method creates a single-element array and delegates to <see cref="CreateCopyJobAsync(IEnumerable{TableReference}, TableReference, CreateCopyJobOptions, CancellationToken)"/>.
 /// </summary>
 /// <remarks>
 /// To avoid confusion between source and destination tables, overloads are not provided that take the
 /// individual components of table references. Instead, use <see cref="GetTableReference(string, string)"/> or
 /// <see cref="GetTableReference(string, string, string)"/> to create table references.
 /// </remarks>
 /// <param name="source">The source table to copy. Must not be null.</param>
 /// <param name="destination">The destination to copy to. 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 the job created for the copy operation.</returns>
 public virtual Task <BigQueryJob> CreateCopyJobAsync(TableReference source, TableReference destination, CreateCopyJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 => CreateCopyJobAsync(new[] { GaxPreconditions.CheckNotNull(source, nameof(source)) }, destination, options, cancellationToken);
示例#8
0
 /// <summary>
 /// Creates a job to copy data from at least one table to another.
 /// </summary>
 /// <remarks>
 /// To avoid confusion between source and destination tables, overloads are not provided that take the
 /// individual components of table references. Instead, use <see cref="GetTableReference(string, string)"/> or
 /// <see cref="GetTableReference(string, string, string)"/> to create table references.
 /// </remarks>
 /// <param name="sources">The source tables to copy. Must not be null or empty.</param>
 /// <param name="destination">The destination to copy to. 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>The job created for the copy operation.</returns>
 public virtual BigQueryJob CreateCopyJob(IEnumerable <TableReference> sources, TableReference destination, CreateCopyJobOptions options = null)
 {
     throw new NotImplementedException();
 }
示例#9
0
 /// <summary>
 /// Creates a job to copy one table to another.
 /// This method creates a single-element array and delegates to <see cref="CreateCopyJob(IEnumerable{TableReference}, TableReference, CreateCopyJobOptions)"/>.
 /// </summary>
 /// <remarks>
 /// To avoid confusion between source and destination tables, overloads are not provided that take the
 /// individual components of table references. Instead, use <see cref="GetTableReference(string, string)"/> or
 /// <see cref="GetTableReference(string, string, string)"/> to create table references.
 /// </remarks>
 /// <param name="source">The source table to copy. Must not be null.</param>
 /// <param name="destination">The destination to copy to. 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>The job created for the copy operation.</returns>
 public virtual BigQueryJob CreateCopyJob(TableReference source, TableReference destination, CreateCopyJobOptions options = null)
 => CreateCopyJob(new[] { GaxPreconditions.CheckNotNull(source, nameof(source)) }, destination, options);