ocadaruma / scalikejdbc-bigquery Edit

ScalikeJDBC extension for Google BigQuery

Version Matrix


Build Status

ScalikeJDBC extension for Google BigQuery


  • Java 8
  • Scala 2.11.x / 2.12.x / 2.13.x
  • ScalikeJDBC 2.4.x or newer


libraryDependencies ++= Seq(
  "com.mayreh" %% "scalikejdbc-bigquery" % "0.1.4",
  "com.google.cloud" % "google-cloud-bigquery" % "1.51.0",
  "org.scalikejdbc" %% "scalikejdbc" % scalikejdbcVersion // specify scalikejdbc version you want. 


import com.google.auth.oauth2.GoogleCredentials
import com.google.cloud.bigquery.{BigQueryOptions, DatasetId}
import scalikejdbc._, bigquery._

// instantiate BigQuery service and DatsetId
val credentials = GoogleCredentials.fromStream(new FileInputStream("/path/to/key.json"))
val bigQuery = BigQueryOptions.newBuilder()
val dataset = DatasetId.of("your-gcp-project-id", "your-dataset")

// build query by QueryDSL then execute
val executor = new QueryExecutor(bigQuery, QueryConfig())

val response = bq {
  selectFrom(User in dataset as u)
    .where.eq(u.id, 42)

response.result // => Option[User]

See also integration test.

Current status

This project is still in an early stage. Newer releases can include breaking changes.

Be careful using in production.