Giter Club home page Giter Club logo

dj's Introduction

dj

โš ๏ธ This is not an officially supported Google product.

A CLI tool to parse dataform compilation output

A CLI tool to parse dataform compilation output generated by running dataform compile --json to get insights on

  • cost
  • errors
  • other metadata

at table and tag level.

Table of Contents

at table and tag level.

To explore all capabilities of dj run the following command

dj help

Cost of of running all tables in Dataform project

dj --json-file <path-to-json-file> table-ops cost --all

OR (using stdin as input )

dataform compile --json | dj table-ops cost --all

Cost of of running a file

dj --json-file <path-to-json-file> table-ops cost --file <file-name-wo-extension>

Compiled query for a file

dj --json-file <path-to-json-file> table-ops query --file <file-name-wo-extension>

List unique tags in Dataform project

dj --json-file <path-to-json-file> tag-ops --unique

Cost of of running a tag

dj --json-file <path-to-json-file> tag-ops cost --tag <tag-name>

Latest release

curl -sSfL https://raw.githubusercontent.com/ashish10alex/dj/main/install_latest.sh | bash

OR

go install github.com/ashish10alex/dj@latest

This installs the binary dj to $GOBIN, which defaults to $GOPATH/bin.

OR

Manually clone the repository and build the cli and add the cli to your system path

git clone <repo-url>
go build -o dj
mv dj /usr/local/bin/dj

Transfer the cost of tags to BigQuery along with dry run metadata by adding the following just config

tags_cost_to_bigquery:
    dataform compile --json > out.json;
    dj --json-file out.json tag-ops cost --all > res.json
    bq load --source_format=NEWLINE_DELIMITED_JSON --autodetect dataset_id.TAGS_RUN_COSTS res.json

Query the cost of a tag when it is successfully transferred to BigQuery

    SELECT
     GitMetadata.GitRepositoryId,
     GBProcessed,
     Cost,
     HasError,
     RunDateTime,
     FROM `gcp-project-id.dataset_id.TAGS_RUN_COSTS`
    WHERE 1=1
    AND Tag = "xxx"
    AND RunDateTime IN (
      SELECT RunDateTime FROM (
        SELECT  RunDateTime, ROW_NUMBER() OVER(PARTITION BY GitMetadata.GitRepositoryId ORDER BY RunDateTime DESC ) RN FROM `gcp-project-id.dataset_id.TAGS_RUN_COSTS` QUALIFY RN = 1
      )
    )

Query cost of all tags in a Dataform prject

    SELECT
     GitMetadata.GitRepositoryId,
     Tag,
     GBProcessed,
     Cost,
     HasError,
     RunDateTime,
     FROM `gcp-project-id.dataset_id.TAGS_RUN_COSTS`
    WHERE 1=1
    AND GitMetadata.GitRepositoryId = 'xxx'
    AND RunDateTime IN (
      SELECT RunDateTime FROM (
        SELECT  RunDateTime, ROW_NUMBER() OVER(PARTITION BY GitMetadata.GitRepositoryId ORDER BY RunDateTime DESC ) RN FROM `gcp-project-id.dataset_id.TAGS_RUN_COSTS` QUALIFY RN = 1
      )
    )

dj's People

Contributors

ashish10alex avatar

Watchers

 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.