Giter Site home page Giter Site logo

sqlake_action's Introduction

Github Action for executing an Upsolver SQLake worksheet

This Github Action allows you to execute Upsolver SQLake SQL commands to create and manage data pipelines. SQL commands oftentime need to be executed in sequantial order. This means that creating connections and tables must come before creating jobs or executing SQL queries against tables.

Here is an example of a Github Action workflow that finds SQL files in your repo and executes them.

name: development

on:
  push:
    branches:
      - dev

jobs:
  execute_sql:
    name: Execute SQL
    environment:
      name: development
    if: github.event.ref == 'refs/heads/dev'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: dev
          fetch-depth: 0
      - name: Get changed files
        id: cf-step
        uses: tj-actions/[email protected]
        with:
          separator: ","
      - name: List all added files
        run: |
          for file in ${{ steps.cf-step.outputs.all_changed_files }}; do
            echo "$file was added"
          done
      - name: Execute changed or added files
        uses: rhasson/sqlake_action@main
        with:
           file_list: ${{ steps.cf-step.outputs.all_changed_files }}
           api_key: ${{ secrets.API_KEY }}
           api_endpoint: 'https://api.upsolver.com'
      - name: Print Results
        run: |
          cat ${GITHUB_WORKSPACE}/execution_output.md >> $GITHUB_STEP_SUMMARY

This Action worflow is executed when new or changed files are pushed to the DEV branch. Then it performs the following steps:

  1. Checks out the repo
  2. Calls another Action that returns only changed files as a comma separated list
  3. Calls the SQLake Action to execute them on your SQLake cluster

Configuring your Action

The Github Action takes the following parameters:

  1. file_list which is a comma separated list of files to execute
  2. api_key which is the API key you get from SQLake.
  3. api_endpoint which is the SQLake API endpoint (public or private) and can be found in the SQLake console.
  4. path_to_sql (optional) instead of providing a list of files, you can provide a path to your SQL files. The action will execute them all at every execution. This is not recommended for interactive development, but helpful for pipeline testing.

Check out the example repo

sqlake_action's People

Contributors

rhasson avatar

Watchers

 avatar

Forkers

meiupsolver

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.