Last active
January 19, 2022 02:31
-
-
Save khun84/b7ca10f5debe834599af76631743d841 to your computer and use it in GitHub Desktop.
Holistics jobs export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'csv' | |
data = `pbpaste` | |
data = JSON.parse(data);nil | |
data = data.select{|d| d.dig('schedule', 'paused') == false && d['source_type'] == 'dbtable' };nil | |
keys = [ | |
'title', | |
'description', | |
'src_db', # from_ds_name | |
'src_table', # source_config.fqname | |
'interval', # schedule.friendly_description | |
] | |
jobs = data.each_with_object([]) do |d, memo| | |
memo << [d['title'], d['description'], d['from_ds_name'], d.dig('source_config', 'dbtable', 'fqname'), d.dig('schedule','friendly_description')] | |
end;nil | |
CSV.open('tmp/holistics-job.csv','w', write_headers: true, headers: keys) do |csv| | |
jobs.each {|j| csv << j} | |
end;nil | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment