BigQuery Maven Plugin Parent


License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

io.allune
ArtifactId

ArtifactId

bigquery-maven-plugin-parent
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

pom
Description

Description

BigQuery Maven Plugin Parent
BigQuery Maven Plugin Parent
Project URL

Project URL

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

Project Organization

Allune Software Ltd.
Source Code Management

Source Code Management

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

Download bigquery-maven-plugin-parent

How to add to project

<!-- https://jarcasting.com/artifacts/io.allune/bigquery-maven-plugin-parent/ -->
<dependency>
    <groupId>io.allune</groupId>
    <artifactId>bigquery-maven-plugin-parent</artifactId>
    <version>1.1.2</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.allune/bigquery-maven-plugin-parent/
implementation 'io.allune:bigquery-maven-plugin-parent:1.1.2'
// https://jarcasting.com/artifacts/io.allune/bigquery-maven-plugin-parent/
implementation ("io.allune:bigquery-maven-plugin-parent:1.1.2")
'io.allune:bigquery-maven-plugin-parent:pom:1.1.2'
<dependency org="io.allune" name="bigquery-maven-plugin-parent" rev="1.1.2">
  <artifact name="bigquery-maven-plugin-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.allune', module='bigquery-maven-plugin-parent', version='1.1.2')
)
libraryDependencies += "io.allune" % "bigquery-maven-plugin-parent" % "1.1.2"
[io.allune/bigquery-maven-plugin-parent "1.1.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • bigquery-maven-plugin

Build Status codecov Apache 2

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:

<plugin>
    <groupId>io.allune</groupId>
    <artifactId>bigquery-maven-plugin</artifactId>
    <version>1.0.0</version>
    <configuration>
        ...
    </configuration>
</plugin>

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

<plugin>
    <groupId>io.allune</groupId>
    <artifactId>bigquery-maven-plugin</artifactId>
    <version>1.0.0</version>
    <configuration>
        <projectId>your_project_id</projectId>
        <credentialsFile>/credentials.json</credentialsFile>
        <datasetName>your_dataset</datasetName>
        <dataLocation>EU</dataLocation>
    </configuration>
    <executions>
        <execution>
            <id>create</id>
            <goals>
                <goal>create</goal>
            </goals>
            <phase>pre-integration-test</phase>
            <configuration>
                <skip>${skipTests}</skip>
                <createDataset>true</createDataset>
                <sourceUri>gs://folder/data.json</sourceUri>
                <formatOptions>CSV</formatOptions>
                <nativeSchemaLocations>file://${project.basedir}/src/main/resources/bigquery/schemas/dir1</nativeSchemaLocations>
                <externalSchemaLocations>classpath:/bigquery/schemas/dir2</externalSchemaLocations>
                <viewLocations>file://${project.basedir}/src/main/resources/bigquery/views</viewLocations>
            </configuration>
        </execution>
        <execution>
            <id>clean</id>
            <goals>
                <goal>clean</goal>
            </goals>
            <phase>post-integration-test</phase>
            <configuration>
                <skip>${skipTests}</skip>
                <deleteDataset>true</deleteDataset>
                <forceDeleteDataset>true</forceDeleteDataset>
            </configuration>
        </execution>
    </executions>
</plugin>

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)

Table name

The schema file name is used as the table name.

Example

test_table

[
  {
    "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"
          }
        ]
      }
    ]
  }
]

Versions

Version
1.1.2