Giter Site home page Giter Site logo

jashparekh / bigquery-action Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 4.0 184 KB

This Github action can be used to deploy tables/views schemas to BigQuery.

License: MIT License

Shell 17.11% Dockerfile 9.91% Python 72.98%
bigquery google github-actions google-cloud-platform google-bigquery actions gbq hacktoberfest

bigquery-action's Introduction

Actions Status Actions Status Actions Status Version

BigQuery Github Action

This Github action can be used to deploy tables/views schemas to BigQuery.

Simple

name: "Deploy to BigQuery"
on:
  pull_request: {}
  push:
      branches: ["main"]

jobs:
  deploy_schemas:
    runs-on: ubuntu-latest
    name: Deploy to BigQuery
    steps:
      # To use this repository's private action,
      # you must check out the repository
      - name: Checkout
        uses: actions/[email protected]
      - name: Deploy schemas to BigQuery
        uses: jashparekh/bigquery-action@v3
        env:
          gcp_project: 'gcp-us-project'
          dataset_schema_directory: 'gcp-us-project/dataset_name'
          credentials: ${{ secrets.GCP_SERVICE_ACCOUNT }}

Configuration

Required

gcp_project (required, string)

The full name of the GCP project you want to deploy.

Example: gcp-us-project

dataset_schema_directory (required, string)

The directory in your repository where are you storing the schemas for your tables and views.

Example: gcp-us-project/dataset_name

credentials (required, string)

Google Service Account with permission to create objects in the specified project. Can be stored as a repository secret

Schemas

This action uses GBQ to deploy to Google BigQuery. GBQ now supports specifying partitions with the schema as well.

To leverage this you need to nest your JSON table schema in a dictionary. An example for the same is given below. Library supports Time and Range based partitioning along with Clustering.

All the configuration options can be found here.

{
  "partition": {
    "type": "range",
    "definition": {
      "field": "ID",
      "range": {
        "start": 1,
        "end": 100000,
        "interval": 10
      }
    }
  },
  "clustering": [
    "ID"
  ],
  "schema": [
    {
      "name": "ID",
      "type": "INTEGER",
      "mode": "REQUIRED"
    }
  ]
}

Contributing

See the Contributing Guide for additional information.

To execute tests locally (requires that docker and docker-compose are installed):

docker-compose run test

Credits

This Github Action was originally written by Jash Parekh.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.