Git Product home page Git Product logo

retag's Introduction

Retag

Exporting and Importing tool for Redash Query name and tags.

Installation

go install github.com/ariarijp/retag@latest

Setup

export REDASH_API_KEY="" # You can only use Admin user's API Key when you want to use import command.
export REDASH_URL="http://localhost:5000" # Without trailing slash

Export queries

retag export --url $REDASH_URL --api-key $REDASH_API_KEY > example.yml
cat example.yml
queries:
  - id: 1
    name: Query 1
    tags: []
  - id: 2
    name: Query 2
    tags: [foo, bar]
  - id: 3
    name: Query 3
    tags: [baz]

Edit YAML file

queries:
  - id: 1
    name: Query 1
    tags: [ ]
  - id: 2
    name: Query 2
    tags: [ foo, bar ]
  - id: 3
    name: Query 3
    tags: [ baz ]

Show diff

retag diff --url $REDASH_URL --api-key $REDASH_API_KEY --yaml example.yml
 queries:
   - id: 1
     name: Query 1
-    tags: []
+    tags: [foo, bar, baz]
   - id: 2
-    name: Query 2
+    name: Great Query
     tags: [foo, bar]
   - id: 3
-    name: Query 3
-    tags: [baz]
+    name: Awesome Query
+    tags: [bar, baz]

Import queries

Dry run

retag import --url $REDASH_URL --api-key $REDASH_API_KEY --yaml example.yml # Dry run
DRYRUN: Query #1 will be updated.
DRYRUN: Query #2 will be updated.
DRYRUN: Query #3 will be updated.

Run

retag import --url $REDASH_URL --api-key $REDASH_API_KEY --yaml example.yml --dry-run=false
RESULT: Query #1 updated.
RESULT: Query #2 updated.
RESULT: Query #3 updated.

Show diff again(has no changes)

retag diff --url $REDASH_URL --api-key $REDASH_API_KEY --yaml example.yml                
 queries:
   - id: 1
     name: Query 1
     tags: [foo, bar, baz]
   - id: 2
     name: Great Query
     tags: [foo, bar]
   - id: 3
     name: Awesome Query
     tags: [bar, baz]

retag's People

Contributors

ariarijp avatar

Stargazers

 avatar Abe Tomoaki avatar Shuji Mihara avatar godgarden avatar

Watchers

 avatar James Cloos avatar  avatar  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.