Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/esanchezros/bigquery-maven-plugin

Maven plugin for managing BigQuery datasets, tables and views
https://github.com/esanchezros/bigquery-maven-plugin

bigquery java maven maven-plugin

Last synced: about 1 month ago
JSON representation

Maven plugin for managing BigQuery datasets, tables and views

Awesome Lists containing this project

README

        

image:https://travis-ci.org/esanchezros/bigquery-maven-plugin.svg?branch=master["Build Status", link="https://travis-ci.org/esanchezros/bigquery-maven-plugin"]
image:https://codecov.io/gh/esanchezros/bigquery-maven-plugin/branch/master/graph/badge.svg["codecov", link="https://codecov.io/gh/esanchezros/bigquery-maven-plugin"]
image:https://img.shields.io/hexpm/l/plug.svg["Apache 2", link="http://www.apache.org/licenses/LICENSE-2.0"]

= BigQuery Maven plugin

This Maven plugin provides goals to create datasets, tables and views in Google BigQuery.

== How to use

In your application, add the following plugin to your pom.xml:

[source, xml]
----

io.allune
bigquery-maven-plugin
1.0.0

...

----

== Supported goals

|===
|Goal | Description

|bigquery:create|Creates the dataset, tables and views defined in the plugin configuration.
|bigquery:create-dataset|Creates the dataset defined in the plugin configuration.
|bigquery:clean|Removes the dataset, tables and views defined in the plugin configuration.
|bigquery:help|Displays help information on the plugin. Use `mvn bigquery:help -Ddetail=true -Dgoal=[goal]` for detailed goal documentation.
|===

== Example plugin configuration

[source, xml]
----

io.allune
bigquery-maven-plugin
1.0.0

your_project_id
/credentials.json
your_dataset
EU



create

create

pre-integration-test

${skipTests}
true
gs://folder/data.json
CSV
file://${project.basedir}/src/main/resources/bigquery/schemas/dir1
classpath:/bigquery/schemas/dir2
file://${project.basedir}/src/main/resources/bigquery/views



clean

clean

post-integration-test

${skipTests}
true
true


----

== Schema definition

A JSON schema file consists of a JSON array that contains the following:

* (Optional) The column's description
* The column name
* The column's data type
* (Optional) The column's mode (if unspecified, mode defaults to NULLABLE)

Reference: https://cloud.google.com/bigquery/docs/schemas

=== Table name

The schema file name is used as the table name.

=== Example

==== test_table

[source, json]
----
[
{
"name": "id",
"mode": "NULLABLE",
"type": "STRING"
},
{
"name": "subject",
"mode": "NULLABLE",
"type": "STRING"
},
{
"name": "from",
"mode": "NULLABLE",
"type": "STRING"
},
{
"name": "to",
"mode": "NULLABLE",
"type": "STRING"
},
{
"name": "cc",
"mode": "NULLABLE",
"type": "STRING"
},
{
"name": "body",
"mode": "NULLABLE",
"type": "STRING"
},
{
"name": "time",
"mode": "NULLABLE",
"type": "TIME"
},
{
"name": "timestamp",
"mode": "NULLABLE",
"type": "TIMESTAMP"
},
{
"name": "fields",
"type": "RECORD",
"mode": "REPEATED",
"fields": [
{
"name": "field1",
"type": "STRING",
"mode": "REQUIRED"
},
{
"name": "moreFields",
"type": "RECORD",
"mode": "REPEATED",
"fields": [
{
"name": "field1",
"type": "STRING",
"mode": "REQUIRED"
},
{
"name": "field2",
"type": "STRING",
"mode": "REQUIRED"
}
]
}
]
}
]

----