Hi team, question related to the Python SDK: is it...
# gooddata-cloud
a
Hi team, question related to the Python SDK: is it possible to retrieve object structures in the format outlined here via the Python SDK?
k
The knowledge sources do not explicitly state that the Python SDK can return objects directly in the same YAML structure format used by the VS Code extension (the
type: dataset|metric|visualization|dashboard
YAML documents shown in the “Object Structures” docs). [[Object structures](https://www.gooddata.com/docs/cloud/api-and-sdk/vs-code-extension/structures/)] What is documented for the Python SDK is: - It works with GoodData objects via its own Python model classes and services (e.g., Catalog Workspace/Content services, Visualization service, etc.), not via those YAML structures. [[Python SDK intro](https://www.gooddata.com/docs/python-sdk/latest/); [gooddata-sdk README](https://github.com/gooddata/gooddata-python-sdk/blob/master/packages/gooddata-sdk/README.md)] - For “analytics as code” / YAML workflows, the recommended tooling is the VS Code extension and its YAML files, which can be organized and deployed separately from the SDK. [[Developer tools](https://www.gooddata.com/docs/cloud/api-and-sdk/); [Object structures](https://www.gooddata.com/docs/cloud/api-and-sdk/vs-code-extension/structures/)] There is also a documented workflow where you: 1. Use the Python SDK to store declarative workspaces to disk as YAML, 2. Edit those YAML files, 3. Load and put them back via the SDK. [[Slack: declarative workspaces flow](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1718756907106529)] However, the sources do not confirm that these YAML files are identical in structure to the VS Code extension’s object-structure YAML (dataset/metric/visualization/dashboard as in that specific page), nor that you can request “give me this metric as that exact YAML snippet” via a single SDK call. So, based on the available documentation: - You can use the Python SDK to export/import declarative layouts as YAML and work with them programmatically. - It is not documented that the SDK returns objects in the exact same YAML schema as the VS Code extension’s “Object Structures” page.
a
Given that the CLI/VSCode extension is still in beta, are there any other ways to pull YAML specifications in that format for a specific workspace? Are there API endpoints I can use to pull object structures for a given workspace?
m
Hello Anant, I would recommend this documentation where you can 'retrieve' locally all the workspace objects, the format is similar to the format you mentioned. Additionally if you go to Workspace Content you can retrieve only the desired objects. Please, have a look and let us to know if that helps.
Hi Anant, please let us to know if you need further assistance on this.