object BigQueryType
Macro annotations and converter generators for BigQuery types.
The following table lists each legacy SQL data type, its standard SQL equivalent and Scala type.
Legacy SQL | Standard SQL | Scala type |
---|---|---|
BOOLEAN | BOOL | |
INTEGER | INT64 | |
FLOAT | FLOAT64 | |
STRING | STRING | |
NUMERIC | NUMERIC | |
BYTES | BYTES | |
RECORD | STRUCT | Nested case class |
REPEATED | ARRAY | |
TIMESTAMP | TIMESTAMP | |
DATE | DATE | |
TIME | TIME | |
DATETIME | DATETIME | |
- Source
- BigQueryType.scala
- Alphabetic
- By Inheritance
- BigQueryType
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait HasAnnotation extends AnyRef
Trait for case classes with generated companion objects.
- trait HasQuery extends AnyRef
Trait for companion objects of case classes generated with SELECT query.
- trait HasSchema[T] extends AnyRef
Trait for companion objects of case classes generated with schema.
- trait HasStorageOptions extends AnyRef
Trait for companion objects of case classes generated with storage API.
- trait HasTable extends AnyRef
Trait for companion objects of case classes generated with table.
- trait HasTableDescription extends AnyRef
Trait for companion objects of case classes generated with table description.
- trait Query[T] extends HasQuery
Trait for companion objects of case classes generated with query.
Trait for companion objects of case classes generated with query. Instance of this trait are provided as implicits allowing static discovery. That trait provide evidence that a BQ query is statically known for a given type T.
- trait StorageOptions[T] extends HasStorageOptions
Trait for companion objects of case classes generated with storage API.
Trait for companion objects of case classes generated with storage API. Instance of this trait are provided as implicits allowing static discovery. That trait provide evidence that a BQ table is statically known for a given type T.
- trait Table[T] extends HasTable
Trait for companion objects of case classes generated with table.
Trait for companion objects of case classes generated with table. Instance of this trait are provided as implicits allowing static discovery. That trait provide evidence that a BQ table is statically known for a given type T.
- macro class fromQuery extends Annotation with StaticAnnotation
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 additionalargs
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
.- Annotations
- @nowarn() @compileTimeOnly("enable macro paradise (2.12) or -Ymacro-annotations (2.13) to expand macro annotations")
- macro class fromSchema extends Annotation with StaticAnnotation
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.
- Annotations
- @nowarn() @compileTimeOnly("enable macro paradise (2.12) or -Ymacro-annotations (2.13) to expand macro annotations")
- macro class fromStorage extends Annotation with StaticAnnotation
Macro annotation for a BigQuery table using the storage API.
Macro annotation for a BigQuery table using the storage API.
Generate case classes for BigQuery storage API, including column projection and filtering. Note that
tableSpec
must be a string literal in the form ofproject:dataset.table
with optional.stripMargin
at the end. For example:@BigQueryType.fromStorage("project:dataset.table") class MyRecord
- Annotations
- @nowarn() @compileTimeOnly("enable macro paradise (2.12) or -Ymacro-annotations (2.13) to expand macro annotations")
- macro class fromTable extends Annotation with StaticAnnotation
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 ofproject: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 additionalargs
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.
- Annotations
- @nowarn() @compileTimeOnly("enable macro paradise (2.12) or -Ymacro-annotations (2.13) to expand macro annotations")
- macro class toTable extends Annotation with StaticAnnotation
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)
- Annotations
- @compileTimeOnly("enable macro paradise (2.12) or -Ymacro-annotations (2.13) to expand macro annotations")
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def apply[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): BigQueryType[T]
Create a new BigQueryType instance.
Create a new BigQueryType instance.
- Annotations
- @inline()
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def avroSchemaOf[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Schema
Generate Schema for a case class.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- macro def fromAvro[T]: (GenericRecord) => T
Generate a converter function from Avro GenericRecord to the given case class
T
. - macro def fromTableRow[T]: (google.api.services.bigquery.model.TableRow) => T
Generate a converter function from TableRow to the given case class
T
. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def schemaOf[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): TableSchema
Generate TableSchema for a case class.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- macro def toAvro[T]: (T) => GenericRecord
Generate a converter function from the given case class
T
to GenericRecord. - def toString(): String
- Definition Classes
- AnyRef → Any
- macro def toTableRow[T]: (T) => google.api.services.bigquery.model.TableRow
Generate a converter function from the given case class
T
to TableRow. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()