val query = s"""#standardsql
| WITH A AS (SELECT * FROM `prefix.andrews_test_table` LIMIT 1000)
| select * from A"""
@BigQueryType.fromQuery(query)
class Test
一直在给我:40: error: Missing query
。关闭legacySql模式后,此查询在BigQuery中运行正常。我不应该期望在BigQuery中运行的每个查询都能与TypeSafe BigQuery一起使用吗?
答案 0 :(得分:1)
运行查询并输出到临时表,然后在scio的repl do
中运行@BigQueryType.fromTable("prefix.andrews_test_table_limited")
class Clazz
Clazz.toPrettyString(2)
应输出
@BigQueryType.toTable
case class Clazz(
.....
)
然后您可以将其用作您的类型。我的解决方案改编自:https://github.com/spotify/scio/wiki/FAQ#how-to-make-intellij-idea-work-with-type-safe-bigquery-classes