Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.0 #12

Merged
merged 4 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ This project is compiled with scala versions 2.12.17, 2.13.10, 3.2.1
__SBT__
``` scala mdoc
libraryDependencies ++= List(
"com.github.tharwaninitin" %% "gcp4zio-gcs" % "1.2.1",
"com.github.tharwaninitin" %% "gcp4zio-dp" % "1.2.1",
"com.github.tharwaninitin" %% "gcp4zio-bq" % "1.2.1",
"com.github.tharwaninitin" %% "gcp4zio-pubsub" % "1.2.1",
"com.github.tharwaninitin" %% "gcp4zio-monitoring" % "1.2.1"
"com.github.tharwaninitin" %% "gcp4zio-gcs" % "1.3.0",
"com.github.tharwaninitin" %% "gcp4zio-dp" % "1.3.0",
"com.github.tharwaninitin" %% "gcp4zio-bq" % "1.3.0",
"com.github.tharwaninitin" %% "gcp4zio-pubsub" % "1.3.0",
"com.github.tharwaninitin" %% "gcp4zio-monitoring" % "1.3.0"
)
```
__Maven__
```
<dependency>
<groupId>com.github.tharwaninitin</groupId>
<artifactId>gcp4zio-gcs_2.12</artifactId>
<version>1.2.1</version>
<version>1.3.0</version>
</dependency>
```
# GCP4ZIO API's
Expand All @@ -51,6 +51,8 @@ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
- [Dataproc Cluster](#dataproc-cluster)
- [Dataproc Job](#dataproc-job)
- [Bigquery](#bigquery-api)
- [Query/Read](#running-sql-queries-in-bigquery)
- [Load/Export](#loadingexporting-data-fromto-gcs)
- [PubSub](#pubsub-api)
- [Topic](#topic)
- [Subscription](#subscription)
Expand All @@ -64,6 +66,7 @@ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
```scala
import gcp4zio.gcs._
import java.nio.file.Paths
import zio._

// Upload single object from local to provided bucket at provided prefix
val localPath1 = Paths.get("/local/path/to/file1.csv")
Expand Down Expand Up @@ -142,9 +145,24 @@ job.provide(DPJob.live("dpEndpoint"))
```

## Bigquery API
### Running SQL Queries in BigQuery
```scala
import gcp4zio.bq._

// Execute DML/DDL query on Bigquery
val task1: RIO[BQ, Unit] = BQ.executeQuery("CREATE TABLE dataset1.test1 (column1 STRING)")

val task2: RIO[BQ, Unit] = BQ.executeQuery(""" INSERT INTO dataset1.test1 VALUES ("value1") """)

// Execute SELECT query on Bigquery
val task3: RIO[BQ, Iterable[String]] = BQ.getData("SELECT * FROM dataset1.test1")(rs => rs.get("column1").getStringValue)

(task1 *> task2 *> task3).provide(BQ.live())
```
### Loading/Exporting data from/to GCS
```scala
import gcp4zio.bq._
import gcp4zio.bq.BQInputType.PARQUET
import gcp4zio.bq.FileType.PARQUET

// Load PARQUET file into Bigquery
val step = BQ.loadTable("inputFilePathParquet", PARQUET, Some("gcpProject"), "outputDataset", "outputTable")
Expand Down
20 changes: 19 additions & 1 deletion docs/readme.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
- [Dataproc Cluster](#dataproc-cluster)
- [Dataproc Job](#dataproc-job)
- [Bigquery](#bigquery-api)
- [Query/Read](#running-sql-queries-in-bigquery)
- [Load/Export](#loadingexporting-data-fromto-gcs)
- [PubSub](#pubsub-api)
- [Topic](#topic)
- [Subscription](#subscription)
Expand All @@ -64,6 +66,7 @@ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
```scala mdoc:silent
import gcp4zio.gcs._
import java.nio.file.Paths
import zio._

// Upload single object from local to provided bucket at provided prefix
val localPath1 = Paths.get("/local/path/to/file1.csv")
Expand Down Expand Up @@ -142,9 +145,24 @@ job.provide(DPJob.live("dpEndpoint"))
```

## Bigquery API
### Running SQL Queries in BigQuery
```scala mdoc:silent
import gcp4zio.bq._

// Execute DML/DDL query on Bigquery
val task1: RIO[BQ, Unit] = BQ.executeQuery("CREATE TABLE dataset1.test1 (column1 STRING)")

val task2: RIO[BQ, Unit] = BQ.executeQuery(""" INSERT INTO dataset1.test1 VALUES ("value1") """)

// Execute SELECT query on Bigquery
val task3: RIO[BQ, Iterable[String]] = BQ.getData("SELECT * FROM dataset1.test1")(rs => rs.get("column1").getStringValue)

(task1 *> task2 *> task3).provide(BQ.live())
```
### Loading/Exporting data from/to GCS
```scala mdoc:silent
import gcp4zio.bq._
import gcp4zio.bq.BQInputType.PARQUET
import gcp4zio.bq.FileType.PARQUET

// Load PARQUET file into Bigquery
val step = BQ.loadTable("inputFilePathParquet", PARQUET, Some("gcpProject"), "outputDataset", "outputTable")
Expand Down
Loading