/// <inheritdoc />
        public override async Task <BigQueryJob> CreateQueryJobAsync(string sql, CreateQueryJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(sql, nameof(sql));
            var query = new JobConfigurationQuery {
                Query = sql, UseLegacySql = false
            };
            var job = await CreateInsertQueryJobRequest(query, options).ExecuteAsync(cancellationToken).ConfigureAwait(false);

            return(new BigQueryJob(this, job));
        }
        /// <inheritdoc />
        public override BigQueryJob CreateQueryJob(string sql, CreateQueryJobOptions options = null)
        {
            GaxPreconditions.CheckNotNull(sql, nameof(sql));
            var query = new JobConfigurationQuery {
                Query = sql, UseLegacySql = false
            };
            var job = CreateInsertQueryJobRequest(query, options).Execute();

            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));
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public override BigQueryJob CreateQueryJob(string sql, CreateQueryJobOptions options = null)
        {
            GaxPreconditions.CheckNotNull(sql, nameof(sql));
            var query = new JobConfigurationQuery {
                Query = sql, UseLegacySql = false
            };

            options?.ModifyRequest(query);
            var job = Service.Jobs.Insert(new Job
            {
                Configuration = new JobConfiguration
                {
                    Query = query
                },
            }, ProjectId).Execute();

            return(new BigQueryJob(this, job));
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public override async Task <BigQueryJob> CreateQueryJobAsync(string sql, CreateQueryJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(sql, nameof(sql));
            var query = new JobConfigurationQuery {
                Query = sql, UseLegacySql = false
            };

            options?.ModifyRequest(query);
            var job = await Service.Jobs.Insert(new Job
            {
                Configuration = new JobConfiguration
                {
                    Query = query
                },
            }, ProjectId).ExecuteAsync(cancellationToken).ConfigureAwait(false);

            return(new BigQueryJob(this, job));
        }
Exemplo n.º 6
0
        /// <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));
        }
        private JobsResource.InsertRequest CreateInsertQueryJobRequest(JobConfigurationQuery query, CreateQueryJobOptions options)
        {
            options?.ModifyRequest(query);
            var request = Service.Jobs.Insert(new Job
            {
                Configuration = new JobConfiguration
                {
                    Query = query,
                    // It's slightly annoying that this is set here rather than in ModifyRequest, but at least it's in a single place.
                    DryRun = options?.DryRun
                },
            }, ProjectId);

            request.ModifyRequest += _versionHeaderAction;
            return(request);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a job for a query/command, with more facilities than <see cref="ExecuteQuery(BigQueryCommand, ExecuteQueryOptions)"/>,
 /// including the option to store the results in a persistent table. This overload allows query parameterization, and is preferred over
 /// <see cref="CreateQueryJob(string, CreateQueryJobOptions)"/> 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, CreateQueryJobOptions options = null)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a job for a SQL query, with more facilities than <see cref="ExecuteQuery(string, ExecuteQueryOptions)"/>, including the option
 /// to store the results in a persistent table.
 /// </summary>
 /// <param name="sql">The SQL query. 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(string sql, CreateQueryJobOptions options = null)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 /// <summary>
 /// Asynchronously creates a job for a query/command, with more facilities than <see cref="ExecuteQueryAsync(BigQueryCommand, ExecuteQueryOptions,CancellationToken)"/>,
 /// including the option to store the results in a persistent table. This overload allows query parameterization, and is preferred over
 /// <see cref="CreateQueryJobAsync(string, CreateQueryJobOptions,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, CreateQueryJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }