【发布时间】:2017-05-20 10:49:21
【问题描述】:
我正在使用 Google BigQuery Ruby Client v0.23 并尝试使用参数化查询。我正在关注API docs 以供参考。
当我在没有参数的情况下运行查询时,一切都很好。然而,为了使它们动态化,当我使用数组参数时,我得到了错误。例如。当我运行此查询时
bigquery.query("SELECT COUNT(*) FROM oven.sensor_counts WHERE _PARTITIONTIME = TIMESTAMP('2016-04-04') AND sensor_id IN (@sensor_ids)", params: { sensor_ids: ['48-6', '48-2'] })
我明白了
#<Harley::Response POST https://www.googleapis.com/bigquery/v2/projects/sensors-160421/queries == 400 (413 bytes) 3458ms>
Caught error invalidQuery: No matching signature for operator IN for argument types STRING and {ARRAY<STRING>} at [1:116]
Error - #<Google::Apis::ClientError: invalidQuery: No matching signature for operator IN for argument types STRING and {ARRAY<STRING>} at [1:116]>
Google::Cloud::InvalidArgumentError: invalidQuery: No matching signature for operator IN for argument types STRING and {ARRAY<STRING>} at [1:116]
from /usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/google-cloud-bigquery-0.23.0/lib/google/cloud/bigquery/service.rb:662:in `rescue in execute'
任何见解都将不胜感激。
【问题讨论】:
-
即使是 API 示例,这似乎也是一个问题。 code.google.com/p/google-bigquery/issues/detail?id=873
-
现在在 google-cloud-ruby 中有一个开放的 GitHub 问题:github.com/GoogleCloudPlatform/google-cloud-ruby/issues/1185
标签: ruby google-bigquery