dqg63264 2018-02-02 16:36
浏览 30

BigQuery - 同步RunQuery

I am trying to create a job in GoogleBigQuery, that returns a JobId instantly whilst the Job continues to run without making the user wait.

From reading the documentation runQuery suggests this should be possible. maxRetries has been set as well as a very small timeoutMs.

The idea being that the user will get a JobId and an alert notifying them the Job is being processed and they will receive a further notification when it's complete.

Installed via Composer Version: google/cloud: ^0.53.0

Sample code included below.

runQuery

Runs a BigQuery SQL query in a synchronous fashion.

Unless $options.maxRetries is specified, this method will block until the query completes, at which time the result set will be returned.

http://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/v0.53.0/bigquery/bigqueryclient?method=runQuery

    $client = new BigQueryClient([
        'projectId' => 'XXXX',
    ]);
    $client->dataset('XXXX');
    if (!$dataset->exists()) {
        throw new \Exception(sprintf('Dataset does not exist'));
    }
    $options = [
            'timeoutMs' => 1000,
            'maxRetries' => 2,
    ];
    $queryJob = $client->queryConfig($sql, $options); //tried options here
    $queryResult = $client->runQuery($queryJob,$options); //and tried options here together and individually
    echo $queryResult->job()->id();
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
    • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
    • ¥15 linux驱动,linux应用,多线程
    • ¥20 我要一个分身加定位两个功能的安卓app
    • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
    • ¥15 IAR程序莫名变量多重定义
    • ¥15 (标签-UDP|关键词-client)
    • ¥15 关于库卡officelite无法与虚拟机通讯的问题