Skip to content

This Github action can be used to upload samples to BigQuery table.

License

Notifications You must be signed in to change notification settings

Atom-Learning/bigquery-upload-action

 
 

Repository files navigation

Actions Status Actions Status Version

BigQuery Insert Rows Github Action

This Github action can be used to insert rows from a JSON file to Google BigQuery table.

It doesn't do any schema validation of the rows - BQ will return a list of errors if the inserts are failin.

Simple

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

jobs:
  deploy_schemas:
    runs-on: ubuntu-latest
    name: Insert rows to BigQuery
    steps:
      # To use this repository's private action,
      # you must check out the repository
      - name: Checkout
        uses: actions/checkout@v2.3.4
      - name: Deploy schemas to BigQuery
        uses: Atom-Learning/bigquery-upload-action
        with:
          gcp_project: 'gcp-us-project'
          dataset_id: 'dataset-id'
          table_id: 'table-id'
          bq_rows_as_json_path: 'bq_rows.json'
          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_id (required, string)

The dataset containting the table you want to insert the rows to.

Example: best_dataset

table_id (required, string)

The table you want to insert the rows to.

Example: awesome_table

bq_rows_as_json_path (required, string)

The path to the JSON file containing rows you want to insert in.

Example: rows.json

credentials (required, string)

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

Contributing

See the Contributing Guide for additional information.

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

docker-compose run test

Releasing

To validate the changes:

  1. Start Docker locally.
  2. Inside docker/ run $ docker-compose up
  3. Inside main dir run: $ docker-compose run test

If all of that work, push a version and tag by bumping the number after the ., e.g. if version is 1.1, then push 1.2 and run the job pointing to the new version, to verify it's working

Credits

This Github Action was written by Wojciech Chmiel, based on the fork of: https://github.com/jashparekh/bigquery-action

About

This Github action can be used to upload samples to BigQuery table.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Python 72.2%
  • Shell 15.7%
  • Dockerfile 12.1%