Object/Class

com.spotify.scio.bigquery.types

BigQueryType

Related Docs: class BigQueryType | package types

Permalink

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
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
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BigQueryType
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait HasAnnotation extends AnyRef

    Permalink

    Trait for case classes with generated companion objects.

  2. trait HasQuery extends AnyRef

    Permalink

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

  3. trait HasSchema[T] extends AnyRef

    Permalink

    Trait for companion objects of case classes generated with schema.

  4. trait HasTable extends AnyRef

    Permalink

    Trait for companion objects of case classes generated with table.

  5. trait HasTableDescription extends AnyRef

    Permalink

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

  6. macro class fromQuery extends Annotation with StaticAnnotation

    Permalink

    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
    @compileTimeOnly( ... )
  7. macro class fromSchema extends Annotation with StaticAnnotation

    Permalink

    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
    @compileTimeOnly( ... )
  8. macro class fromTable extends Annotation with StaticAnnotation

    Permalink

    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
    @compileTimeOnly( ... )
  9. macro class toTable extends Annotation with StaticAnnotation

    Permalink

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

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): BigQueryType[T]

    Permalink

    Create a new BigQueryType instance.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. macro def fromTableRow[T]: (google.api.services.bigquery.model.TableRow) ⇒ T

    Permalink

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

  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. def schemaOf[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): TableSchema

    Permalink

    Generate TableSchema for a case class.

  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  20. macro def toTableRow[T]: (T) ⇒ google.api.services.bigquery.model.TableRow

    Permalink

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

  21. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Type annotations

Converters

Traits for annotated types

Other Members