Coder Social home page Coder Social logo

bqrun's Introduction

bqrun

概要

ディレクトリの中にあるsqlファイルを全て読み、依存関係を解析し(あるファイルAでselect .. fromされているテーブルが別のファイルBでcreate tableされていた場合、 BはAより前に実行される)、順番に実行するためのMakefileを作成、makeを実行する。

外部依存

  1. docker
  2. graphviz(dotコマンド)

インストール

  1. pip install bqrun

前提

  1. 1つのディレクトリの中に全てのSQLファイルが入っていること
  2. 全てのSQLファイルは拡張子.sqlを持つこと、かつ、クエリ以外に.sqlで終わるファイルがないこと

大まかな動作

  1. 全SQLファイルを読んで依存関係を解析、依存関係に従ったMakefileを作成する
  2. このMakefileにより、各ファイルに対し以下のようなコマンドが実行される
    1. 各SQLファイルをbq queryに投げる
    2. done.<base name> というファイルを作成する(<base name>は、ファイル名の拡張子以外)
  3. 2回目以降の実行では、各ファイルについてdone.<base name>ファイルのタイムスタンプと、依存先のファイルのタイムスタンプを比較し再実行が必要な部分だけが実行される

オプション

  1. -p=<num>または--parallel=<num>: 並列実行数を指定(デフォルトは8)
  2. -bまたは--binary: SQLの依存性解析に利用するalphasqlを、Dockerを経由せずに利用する。別途alphadagのインストールが必要。インストール方法は、alphasqlのreadmeを参照。

bqrun's People

Contributors

hotoku avatar hirosassa avatar

Watchers

James Cloos avatar

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.