Hi friends, I'd like to use the Python SDK to clo...
# gooddata-cloud
d
Hi friends, I'd like to use the Python SDK to clone, edit, and deploy my workspaces. For example, I want to copy a workspace down from one organization, change the data source IDs and user group IDs, and deploy the workspace to another organization. (i.e., dev/prod setup). I'm doing fine getting a declarative workspace onto my local machine, yielidng an object of type CatalogDeclarativeWorkspaces. However, I can't figure out how to edit the CatalogDeclarativeWorkspaces objects without turning them into some more typical object/type, e.g. transforming to a JSON and just editting the JSON. But, doing that, I need to transform the JSON back into a CatalogDeclarativeWorkspaces to put it into a new org, and I haven't figured that out either. Any tips? I haven't seen what I need in the documentation, but since it's a pretty normal use case, I assume I'm missing something
is the expected flow meant to be:
Copy code
get_declarative_workspace
store_declarative_workspaces
[edit]
load_and_put_declarative_workspaces
?
b
Hello Daniel, Yes, the expected flow is as you wrote. 👍 After storing the declarative workspaces: https://www.gooddata.com/docs/python-sdk/latest/workspace/workspaces/store_declarative_workspaces/ the definitions will be stored in
yaml
files as described in the document/page linked above. You can then edit them in programatically for example, by using the
pyyaml
module: https://pyyaml.org/wiki/PyYAMLDocumentation A quick YAML editing tutorial video could be e.g.:

https://www.youtube.com/watch?v=EhGcEyd1lrs

But I am sure, that there are more resources available online... 😉 For future reference, I will also add the following links to related Python SDK documentation pages: https://www.gooddata.com/docs/python-sdk/latest/workspace/workspaces/ https://www.gooddata.com/docs/python-sdk/latest/api-reference/sdk/catalogworkspaceservice/
d
cool, makes sense. thanks!