数据流 insertAll api 使用不等于实际插入的行

Data streaming insertAll api usage not equal to actually inserted rows

我们正在使用 google-php-client-api 以将网站页面浏览日志流式传输到 table 有 9 列。 (由基本数据类型组成

10 小时或 运行 脚本后,我们观察到 bigquery api 用法(对于 insertAll 方法)变为 300K 但在那段时间 35K 行仅记录到 table...

当我们查看 google 云控制台 时,返回了这 300K api 使用量中的大约 299K "成功代码";我的意思是流式传输似乎运行良好。

我们不明白的是,在 299K 次成功请求后,如何只向 table 插入 35K 行?

这个问题是因为google-php-client-api还是bigquery还没有将发送的数据保存到table?

如果第二个为真,我们需要多少时间才能看到发送到 bigquery 的实际(所有)行?

用于流数据的代码:

    $rows = array();
    $data = json_decode($rawjson);
    $row = new Google_Service_Bigquery_TableDataInsertAllRequestRows();
    $row->setJson($data);
    $row->setInsertId(strtotime('now'));
    $rows[0] = $row;

    $req = new Google_Service_Bigquery_TableDataInsertAllRequest();
    $req->setKind('bigquery#tableDataInsertAllRequest');
    $req->setRows($rows);

    $this->service->tabledata->insertAll($projectid, $datasetid, $tableid, $req);

提前谢谢你,

慈涵

我们解决了这个问题。 我们看到是因为这行代码导致的:

$row->setInsertId(strtotime('now'));

因为我们每秒至少有 10-20 个请求;因为这个 "insertID",发送到 BigQuery,这取决于当前时间戳; BigQuery 每秒仅保存 1 个请求,并且拒绝所有其他请求而不将它们保存到 table.

我们删除了这一行,现在数字是连贯的。