Skip to content

Commit f578ca4

Browse files
committed
add release settings
1 parent 39c3fd5 commit f578ca4

4 files changed

Lines changed: 76 additions & 0 deletions

File tree

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,53 @@
33
[![Build Status](https://travis-ci.org/ocadaruma/scalikejdbc-bigquery.svg?branch=master)](https://travis-ci.org/ocadaruma/scalikejdbc-bigquery)
44

55
ScalikeJDBC extension for Google BigQuery
6+
7+
## Prerequisites
8+
9+
- Java 8
10+
- Scala 2.11.x
11+
- ScalikeJDBC 2.4.x or newer
12+
13+
## Installation
14+
15+
```scala
16+
libraryDependencies ++= Seq(
17+
"com.mayreh" %% "scalikejdbc-bigquery" % "0.0.1",
18+
"org.scalikejdbc" %% "scalikejdbc" % scalikejdbcVersion // specify scalikejdbc version you want.
19+
)
20+
```
21+
22+
## Usage
23+
24+
```scala
25+
import com.google.auth.oauth2.GoogleCredentials
26+
import com.google.cloud.bigquery.{BigQueryOptions, DatasetId}
27+
28+
// instantiate BigQuery service and DatsetId
29+
val credentials = GoogleCredentials.fromStream(new FileInputStream("/path/to/key.json"))
30+
val bigQuery = BigQueryOptions.newBuilder()
31+
.setCredentials(credentials)
32+
.setProjectId("your-gcp-project-id")
33+
.build()
34+
.getService
35+
36+
val datasetId = DatasetId.of("your-gcp-project-id", "your-dataset")
37+
38+
// build query by QueryDSL then execute
39+
val executor = new QueryExecutor(bigQuery, QueryConfig())
40+
41+
val response = bq {
42+
selectFrom(User in dataset as u)
43+
.where.eq(u.id, 42)
44+
}.map(User(_)).single.run(executor)
45+
46+
response.result // => Option[User]
47+
```
48+
49+
See also [integration test](https://github.com/ocadaruma/scalikejdbc-bigquery/blob/master/src/it/scala/scalikejdbc/bigquery/QueryDSLIntegration.scala).
50+
51+
## Current status
52+
53+
This project is still in an early stage. Newer releases can include breaking changes.
54+
55+
Be careful using in production.

build.sbt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
name := "scalikejdbc-bigquery"
22

3+
organization := "com.mayreh"
4+
5+
licenses += (("Apache-2.0", url("https://raw.githubusercontent.com/ocadaruma/scalikejdbc-bigquery/master/LICENSE")))
6+
37
version := "0.0.1-SNAPSHOT"
48

9+
publishMavenStyle := true
10+
511
scalaVersion := "2.11.8"
612

13+
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
14+
715
configs(IntegrationTest)
816

917
inConfig(IntegrationTest)(Defaults.itSettings)

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
2+
3+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.1")

sonatype.sbt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
sonatypeProfileName := "com.mayreh"
2+
3+
pomExtra in Global := {
4+
<url>https://github.com/ocadaruma/scalikejdbc-bigquery</url>
5+
<scm>
6+
<connection>"scm:git:git@github.com:ocadaruma/scalikejdbc-bigquery.git"</connection>
7+
<url>git@github.com:ocadaruma/scalikejdbc-bigquery.git</url>
8+
</scm>
9+
<developers>
10+
<developer>
11+
<id>ocadaruma</id>
12+
<name>Haruki Okada</name>
13+
</developer>
14+
</developers>
15+
}

0 commit comments

Comments
 (0)