/// <inheritdoc /> public override async Task <BigQueryJob> CreateQueryJobAsync(BigQueryCommand command, CreateQueryJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { GaxPreconditions.CheckNotNull(command, nameof(command)); var query = new JobConfigurationQuery { UseLegacySql = false }; command.PopulateJobConfigurationQuery(query); var job = await CreateInsertQueryJobRequest(query, options).ExecuteAsync(cancellationToken).ConfigureAwait(false); return(new BigQueryJob(this, job)); }
/// <inheritdoc /> public override BigQueryJob CreateQueryJob(BigQueryCommand command, CreateQueryJobOptions options = null) { GaxPreconditions.CheckNotNull(command, nameof(command)); var query = new JobConfigurationQuery { UseLegacySql = false }; command.PopulateJobConfigurationQuery(query); var job = CreateInsertQueryJobRequest(query, options).Execute(); return(new BigQueryJob(this, job)); }
/// <inheritdoc /> public override BigQueryResults ExecuteQuery(BigQueryCommand command, ExecuteQueryOptions options = null) { GaxPreconditions.CheckNotNull(command, nameof(command)); var queryRequest = new QueryRequest { UseLegacySql = false }; command.PopulateQueryRequest(queryRequest); options?.ModifyRequest(queryRequest); var request = Service.Jobs.Query(queryRequest, ProjectId); var queryResponse = request.Execute(); return(new BigQueryResults(this, queryResponse, options)); }
/// <inheritdoc /> public override async Task <BigQueryResults> ExecuteQueryAsync(BigQueryCommand command, ExecuteQueryOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { GaxPreconditions.CheckNotNull(command, nameof(command)); var queryRequest = new QueryRequest { UseLegacySql = false }; command.PopulateQueryRequest(queryRequest); options?.ModifyRequest(queryRequest); var request = Service.Jobs.Query(queryRequest, ProjectId); var queryResponse = await request.ExecuteAsync(cancellationToken).ConfigureAwait(false); return(new BigQueryResults(this, queryResponse, options)); }
/// <inheritdoc /> public override BigQueryJob CreateQueryJob(BigQueryCommand command, CreateQueryJobOptions options = null) { GaxPreconditions.CheckNotNull(command, nameof(command)); var query = new JobConfigurationQuery { UseLegacySql = false }; command.PopulateJobConfigurationQuery(query); options?.ModifyRequest(query); var job = Service.Jobs.Insert(new Job { Configuration = new JobConfiguration { Query = query }, }, ProjectId).Execute(); return(new BigQueryJob(this, job)); }
/// <summary> /// Creates a job for a query/command. This overload allows query parameterization, and is preferred over /// <see cref="CreateQueryJob(string, QueryOptions)"/> when values need to be passed in. /// </summary> /// <param name="command">The command to execute. 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 query job created. Use <see cref="GetQueryResults(JobReference,GetQueryResultsOptions)"/> to retrieve /// the results of the query.</returns> public virtual BigQueryJob CreateQueryJob(BigQueryCommand command, QueryOptions options = null) { throw new NotImplementedException(); }
/// <summary> /// Executes a command. This overload allows query parameterization, and is preferred over /// <see cref="ExecuteQuery(string, QueryOptions, GetQueryResultsOptions)"/> when values need to be passed in. /// </summary> /// <remarks> /// <para> /// This method will only return when the query has completed. It simply delegates to <see cref="CreateQueryJob(BigQueryCommand, QueryOptions)"/> /// and then <see cref="BigQueryJob.GetQueryResults(GetQueryResultsOptions)"/>. /// </para> /// </remarks> /// <param name="command">The command to execute. Must not be null.</param> /// <param name="queryOptions">The options for the query. May be null, in which case defaults will be supplied.</param> /// <param name="resultsOptions">The options for retrieving query results. May be null, in which case defaults will be supplied.</param> /// <returns>The result of the query.</returns> public virtual BigQueryResults ExecuteQuery(BigQueryCommand command, QueryOptions queryOptions = null, GetQueryResultsOptions resultsOptions = null) => CreateQueryJob(command, queryOptions).GetQueryResults(resultsOptions);
/// <summary> /// Asynchronously creates a job for a query/command. This overload allows query parameterization, and is preferred over /// <see cref="CreateQueryJobAsync(string, QueryOptions,CancellationToken)"/> when values need to be passed in. /// </summary> /// <param name="command">The command to execute. 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 query job created. Use <see cref="GetQueryResultsAsync(JobReference,GetQueryResultsOptions,CancellationToken)"/> to retrieve /// the results of the query.</returns> public virtual Task <BigQueryJob> CreateQueryJobAsync(BigQueryCommand command, QueryOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { throw new NotImplementedException(); }
/// <summary> /// Asynchronously executes a command. This overload allows query parameterization, and is preferred over /// <see cref="ExecuteQueryAsync(string, QueryOptions, GetQueryResultsOptions, CancellationToken)"/> when values need to be passed in. /// </summary> /// <remarks> /// <para> /// The task returned by this method will only complete when the query has completed. /// This method simply delegates to <see cref="CreateQueryJobAsync(BigQueryCommand, QueryOptions, CancellationToken)"/> /// and then <see cref="BigQueryJob.GetQueryResultsAsync(GetQueryResultsOptions, CancellationToken)"/>. /// </para> /// </remarks> /// <param name="command">The command to execute. Must not be null.</param> /// <param name="queryOptions">The options for the query. May be null, in which case defaults will be supplied.</param> /// <param name="resultsOptions">The options for retrieving query results. 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 <see cref="BigQueryResults"/> representing the query.</returns> public virtual async Task <BigQueryResults> ExecuteQueryAsync(BigQueryCommand command, QueryOptions queryOptions = null, GetQueryResultsOptions resultsOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { var job = await CreateQueryJobAsync(command, queryOptions, cancellationToken).ConfigureAwait(false); return(await job.GetQueryResultsAsync(resultsOptions, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Executes a command. This overload allows query parameterization, and is preferred over /// <see cref="ExecuteQuery(string, ExecuteQueryOptions)"/> when values need to be passed in. /// </summary> /// <param name="command">The command to execute. 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 result of the query.</returns> public virtual BigQueryResults ExecuteQuery(BigQueryCommand command, ExecuteQueryOptions options = null) { throw new NotImplementedException(); }
/// <summary> /// Asynchronously executes a command. This overload allows query parameterization, and is preferred over /// <see cref="ExecuteQueryAsync(string, ExecuteQueryOptions,CancellationToken)"/> when values need to be passed in. /// </summary> /// <param name="command">The command to execute. 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 <see cref="BigQueryResults"/> representing the query.</returns> public virtual Task <BigQueryResults> ExecuteQueryAsync(BigQueryCommand command, ExecuteQueryOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { throw new NotImplementedException(); }