【问题标题】:Google BigQuery Catchable fatal error: Argument 2 passedGoogle BigQuery Catchable 致命错误:参数 2 通过
【发布时间】:2014-12-15 15:46:08
【问题描述】:

我目前正在将 PHP 与 Google BigQuery 一起使用并收到以下错误 -

可捕获的致命错误:传递给 Google_Service_Bigquery_Jobs_Resource::query() 的参数 2 必须是 Google_Service_Bigquery_QueryRequest 的实例,没有给出,在第 34 行的 /a/a/a.com/a/a/a.php 中调用并定义在 /a/a/a.com/a/a/google-api-php-client/src/Google/Service/Bigquery.php 第 722 行

这是围绕它的代码 -

$service = new Google_Service_Bigquery($client);
$results = $service->jobs->query('SELECT * FROM [table.table] LIMIT 50'); // line 34

以前从未使用过 Google BigQuery,所以我不确定我在这里做错了什么

【问题讨论】:

    标签: php google-bigquery


    【解决方案1】:

    正如错误所说,您需要传递 Google_Service_Bigquery_QueryRequest 对象而不是字符串作为第二个参数。

    $query = new Google_Service_Bigquery_QueryRequest(); 
    $sql = "SELECT account_number, customer_name, FROM [mydatabase] ORDER BY sales_value DESC, sales_value DESC, sales_value DESC LIMIT 10"; 
    $query->setQuery($sql); 
    $response = $service->jobs->query($project_id, $query); 
    echo json_encode($response);
    

    更多信息:http://vcert.blogspot.ro/2014/06/integrating-googles-bigquery-into-your.html

    【讨论】:

    • 这修复了它!谢谢你,我正用头撞墙!
    猜你喜欢
    • 2013-11-24
    • 1970-01-01
    • 2013-03-07
    • 2021-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多