Search code examples
rubysdkmanifestblueprintgooddata

Is there any method supported at GoodData::Model::ProjectBlueprint to generate itself into JSON project dataset manifest file to some directory?


In order to avoid imperfect human manual definition I would like to know how to generate a json datasets manifest file from active GoodData project for Ruby automation?

I thought there might be some command line to achieve this like by inputting project.blueprint.~ or GoodData::Model::ProjectBlueprint on console like windows command prompt, or, find MAQL from CloudConnect LDM modeler's MAQL tab, or, from project web console such as next location;

https://secure.gooddata.com/gdc/md/{project_id}/ldm/singleloadinterface/dataset.{dataset_name}


Solution

  • There's currently a bug when trying to get the manifest in the way it is defined in http://www.rubydoc.info/gems/gooddata/GoodData/Model/ToManifest But I can give you a workaround to get it till they fix it and update our gem:

    require 'gooddata'
    require 'pp'
    
    module GoodData
        module Model
            module ToManifest
            def self.dataset_to_manifest(project, dataset, mode = 'FULL')
                dataset = dataset.is_a?(String) ?  Model::ProjectBlueprint.find_dataset(project, dataset) : dataset
                dataset = dataset.to_hash
                all_datasets = Model::ProjectBlueprint.datasets(project)
                tm = to_manifest(project, mode)
                datasets = all_datasets.zip(tm)
                res = datasets.find do |ds|
                ds.first[:title] == dataset['dataSet']['meta']['title']
            end
            res[1]
            end
        end
    end
    end
    
    
    GoodData.logging_on
    client = GoodData.connect '[email protected]', 'password'
    
    project = client.projects('project_id')
    dataset =project.datasets('/gdc/md/projectid/obj/dataset_id')
    
    res = GoodData::Model::ToManifest.dataset_to_manifest(project.blueprint, dataset)
    
    pp res
    

    This will allow you to get your manifest with no errors.