Trait for case classes with generated companion objects.
Trait for companion objects of case classes generated with SELECT query.
Trait for companion objects of case classes generated with schema.
Trait for companion objects of case classes generated with table.
Trait for companion objects of case classes generated with table description.
Macro annotation for a BigQuery SELECT query.
Macro annotation for a BigQuery SELECT query.
Generate case classes for a BigQuery SELECT query. Note that query
must be a string
literal of the SELECT query with optional .stripMargin
at the end. For example:
@BigQueryType.fromQuery("SELECT field1, field2 FROM [project:dataset.table]")
String formatting syntax can be used in query
when additional args
are supplied. For
example:
@BigQueryType.fromQuery("SELECT field1, field2 FROM [%s]", "table")
"$LATEST" can be used as a placeholder for table partitions. The latest common partition available for all tables with the placeholder will be used. For example:
@BigQueryType.fromQuery( "SELECT field1, field2 FROM [project:d1.t1_%s] JOIN [project:d2.t2_%s] USING field3", "$LATEST", "$LATEST")
Also generate a companion object with convenience methods.
Both Legacy SQL and
Standard SQL dialects are
supported. By default the query dialect will be automatically detected. To override this
behavior, start the query string with #legacysql
or #standardsql
.
Macro annotation for a BigQuery schema.
Macro annotation for a BigQuery schema.
Generate case classes for a BigQuery schema. Note that schema
must be a string literal of
the JSON schema with optional .stripMargin
at the end. For example:
@BigQueryType.fromSchema( """ |{ | "fields": [ | {"mode": "REQUIRED", "name": "f1", "type": "INTEGER"}, | {"mode": "REQUIRED", "name": "f2", "type": "FLOAT"}, | {"mode": "REQUIRED", "name": "f3", "type": "STRING"}, | {"mode": "REQUIRED", "name": "f4", "type": "TIMESTAMP"} | ] |} """.stripMargin) class MyRecord
Also generate a companion object with convenience methods.
Macro annotation for a BigQuery table.
Macro annotation for a BigQuery table.
Generate case classes for a BigQuery table. Note that tableSpec
must be a string literal in
the form of project:dataset.table
with optional .stripMargin
at the end. For example:
@BigQueryType.fromTable("project:dataset.table") class MyRecord
String formatting syntax can be used in tableSpec
when additional args
are supplied. For
example:
@BigQueryType.fromTable("project:dataset.%s", "table")
"$LATEST" can be used as a placeholder for table partitions. The latest partition available will be used. For example:
@BigQueryType.fromTable("project:dataset.table_%s", "$LATEST")
Also generate a companion object with convenience methods.
Macro annotation for case classes to be saved to a BigQuery table.
Macro annotation for case classes to be saved to a BigQuery table.
Note that this annotation does not generate case classes, only a companion object with convenience methods. You need to define a complete case class for as output record. For example:
@BigQueryType.toTable case class Result(name: String, score: Double)
Create a new BigQueryType instance.
Generate a converter function from TableRow to the given case class T
.
Generate TableSchema for a case class.
Generate a converter function from the given case class T
to TableRow.
Macro annotations and converter generators for BigQuery types.
The following table lists each legacy SQL data type, its standard SQL equivalent and Scala type.