2
val query = s"""#standardsql
     | WITH A AS (SELECT * FROM `prefix.andrews_test_table` LIMIT 1000)
     | select * from A"""

@BigQueryType.fromQuery(query)
class Test

Is consistently giving me :40: error: Missing query. This query runs fine in BigQuery once I turn off legacySql mode. Should I not expect EVERY query that runs in BigQuery to work with TypeSafe BigQuery?

Andrew Cassidy
  • 2,940
  • 1
  • 22
  • 46

1 Answers1

1

Run your query and output to a temporary table, then in scio's repl do

@BigQueryType.fromTable("prefix.andrews_test_table_limited")
class Clazz

Clazz.toPrettyString(2)

It should output

@BigQueryType.toTable
case class Clazz(
.....
)

which you can then use as your type. My solution was adapted from: https://github.com/spotify/scio/wiki/FAQ#how-to-make-intellij-idea-work-with-type-safe-bigquery-classes

Andrew Cassidy
  • 2,940
  • 1
  • 22
  • 46