Skip to content
/ bql Public

Build BigQuery SQL with Scala String interpolation

License

Notifications You must be signed in to change notification settings

pishen/bql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bql

Maven Central javadoc

Build BigQuery SQL with Scala String interpolation, which supports BigQuery parameterized queries and prevent SQL injection automatically.

Installation

libraryDependencies += "net.pishen" %% "bql" % "<version>"

Usage

import bql._

val bigquery = BigQueryOptions.getDefaultInstance().getService()

val gender = "M"
val states = Seq("WA", "WI", "WV", "WY")

val bql = bql"""SELECT name, sum(number) as count
  |FROM `bigquery-public-data.usa_names.usa_1910_2013`
  |WHERE gender = ${gender}
  |AND state IN UNNEST(${states})
  |GROUP BY name
  |ORDER BY count DESC
  |LIMIT 10"""

bigquery.query(bql.queryConfig)

About

Build BigQuery SQL with Scala String interpolation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages