1

In GoodData project is possible to move your attributes and facts to some specific folder. I'm trying to do something like that by Ruby script. I have project blueprint and a list of attribute ids and information about their folders, but I'm still not sure how to change a folder. Because this code doesn't work:

    blueprint = project.blueprint
    blueprint.datasets.map do |dataset|
    dataset.attributes.map do |attr|
        attr.folder = dataset.title
    end
   end

Error:

NoMethodError: undefined method `folder='

In GoodData Ruby Cookbook is example how to find list of folders, but no more information.

 # Currently there is not support in SDK to directly explore folders but we can reach to API directly
  # You can also go to the project in your browser and look for folders there
  client.get("#{project.md['query']}/dimensions")['query']['entries'].map {|i| i['title']} # => ["Dataset.Opportunities", "Awesome Sales Reps", "Dataset.Regions"]

  client.get("#{project.md['query']}/folders")['query']['entries'].map {|i| i['title']} # => ["My Special Folder"]

Has somebody already tried to change folder of attributes or facts in your GoodData project?

here is SDK: http://www.rubydoc.info/gems/gooddata/GoodData/Model/BlueprintField and here are some examples how to work with a blueprint, but mostly it's just about creating new attributes: http://sdk.gooddata.com/gooddata-ruby-examples/#_12_working_with_blueprints

Thank you for any idea. Michal

Michal
  • 15
  • 3

1 Answers1

0

The GoodData Automation SDK does not support changing of folder of attribute or fact.

What you can do is to change it via CloudConnect, MAQL or you can develop your own method in Ruby or of course change it via UI.

CloudConnect lets you change it and also shows you MAQL code which will be used for the change. You can learn from it how to create MAQL code for such changes and then you can execute MAQL code via GoodData API. How to execute MAQL code via API is described here: https://developer.gooddata.com/api#/reference/project-model/execute-a-maql-ddl-script/execute-a-maql-ddl-script

There is also possibility to change it via UI, catch the change via browser developer tools (it is HTTP POST to attribute/fact object) and reproduce the POST via Ruby.