Packages

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

Boolean

INTEGER

INT64

Long, Int

FLOAT

FLOAT64

Double, Float

STRING

STRING

String

NUMERIC

NUMERIC

BigDecimal

BYTES

BYTES

com.google.protobuf.ByteString, Array[Byte]

RECORD

STRUCT

Nested case class

REPEATED

ARRAY

List[T]

TIMESTAMP

TIMESTAMP

org.joda.time.Instant

DATE

DATE

org.joda.time.LocalDate

TIME

TIME

org.joda.time.LocalTime

DATETIME

DATETIME

org.joda.time.LocalDateTime

Source
BigQueryType.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BigQueryType
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. trait HasAnnotation extends AnyRef

    Trait for case classes with generated companion objects.

  2. trait HasQuery extends AnyRef

    Trait for companion objects of case classes generated with SELECT query.

  3. trait HasSchema[T] extends AnyRef

    Trait for companion objects of case classes generated with schema.

  4. trait HasStorageOptions extends AnyRef

    Trait for companion objects of case classes generated with storage API.

  5. trait HasTable extends AnyRef

    Trait for companion objects of case classes generated with table.

  6. trait HasTableDescription extends AnyRef

    Trait for companion objects of case classes generated with table description.

  7. 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.

  8. 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.

  9. 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.

  10. 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 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.

    Annotations
    @nowarn() @compileTimeOnly("enable macro paradise (2.12) or -Ymacro-annotations (2.13) to expand macro annotations")
  11. 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")
  12. 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 of project: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")
  13. 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 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.

    Annotations
    @nowarn() @compileTimeOnly("enable macro paradise (2.12) or -Ymacro-annotations (2.13) to expand macro annotations")
  14. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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()
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def avroSchemaOf[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Schema

    Generate Schema for a case class.

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. macro def fromAvro[T]: (GenericRecord) => T

    Generate a converter function from Avro GenericRecord to the given case class T.

  12. macro def fromTableRow[T]: (google.api.services.bigquery.model.TableRow) => T

    Generate a converter function from TableRow to the given case class T.

  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. def schemaOf[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): TableSchema

    Generate TableSchema for a case class.

  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. macro def toAvro[T]: (T) => GenericRecord

    Generate a converter function from the given case class T to GenericRecord.

  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. macro def toTableRow[T]: (T) => google.api.services.bigquery.model.TableRow

    Generate a converter function from the given case class T to TableRow.

  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Type annotations

Converters

Traits for annotated types

Other Members