コード例 #1
0
        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);
        }
コード例 #2
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));
        }
コード例 #3
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));
        }
コード例 #4
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));
        }