Giter VIP home page Giter VIP logo

bigquery-github-action's Introduction

Write into Google BigQuery

Description

This GitHub Action can be used to write data to Google BigQuery from within a GitHub workflow. The GitHub Action authenticates with a Google Cloud Service Account and uses the provided token for writing to BigQuery. It sends a POST request against the insertAll API endpoint.

Usage

Note: this action requires actions/checkout to be run first
- name: Checkout
  uses: actions/checkout@v4

- name: Collect data
  run: |
    echo "TIMESTAMP=$(date --utc +%FT%T%Z)" >> $GITHUB_ENV

- name: Write to DWH
  uses: Staffbase/[email protected]
  with:
    credentials_json: ${{ secrets.YOUR_SERVICE_ACCOUNT_KEY }}
    bigquery_project: bq-your-project-id
    bigquery_dataset: bq-your-dataset-id
    bigquery_table: bq-your-table-id
    payload_json: '{ "property": "${{ env.TIMESTAMP }} this is a test"}'

Action Spec:

Inputs

Input Description Required
credentials_json The credentials key for the Service Account user used for authentication in JSON format. This is forwarded to the google-github-actions/auth action. true
token_lifetime The lifetime of the generated auth token in seconds. The default is 30s. This is forwarded to the google-github-actions/auth action. false
bigquery_project The Project ID of the project to write to. true
bigquery_dataset The Dataset ID inside the project to write to. true
bigquery_table The Table ID inside the dataset to write to. true
payload_json The payload to be written into the referenced table in JSON format. It must reflect the schema of the table. In the above example the property refers to the column name in the table bigquery_table and ${{ env.TIMESTAMP }} this is a test is the value written into that column. true
timestamp_property_to_add A column name in the bigquery_table which is of type TIMESTAMP. If provided the a property with this name and the current timestamp as value (in UTC) is added to payload_json. false

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the Apache-2.0 License - see the LICENSE.md file for details.

Staffbase GmbH Staffbase GmbH
Staffbase is an internal communications platform built to revolutionize the way you work and unite your company. Staffbase is hiring: staffbase.com/jobs
GitHub | Website | Jobs

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.