scio type safe BigQuery classes - annotation issue

638 Views Asked by At

I am trying to use type safe BigQuery classes. I have also installed intellij scio plugin. But i get the error,

Error:(37, 21) type arguments [RowElement] do not conform to method typedBigQuery's type parameter bounds [T <: com.spotify.scio.bigquery.types.BigQueryType.HasAnnotation] sc.typedBigQueryRowElement

Here is my scala code:

def main(args: Array[String]): Unit = {

  @BigQueryType.fromQuery("select id, org, env from TABLE") 
  class RowElement

  val (sc: ScioContext, arg) = ContextAndArgs(args)
  sc.typedBigQuery[RowElement]("select id, org, env from TABLE")
    .saveAsTypedBigQuery("TABLE_DEST")
  sc.close()
}
1

There are 1 best solutions below

0
On

All @BigQueryType annotations should be in the top level of an object to avoid any macro expansion issues. For example:

object MyPipeline { @BigQueryType.fromQuery("...") class MyRecord }