Question regarding gooddata sdk in python -- in go...
# gooddata-cn
j
Question regarding gooddata sdk in python -- in gooddata-cn, some of the columns have the option to sort by "sortordercode" instead of the text value: how do we do this programmatically using python's gooddata-sdk? the sdk.insights.attributes list only provides attribute data associated with the text value, and the sdk.insights.sorts also only have attribute data for the text
j
cc: @Jan Kadlec
j
Hi James, you can use the following code snippet to list the full catalog – datasets (facts, attributes with labels), metrics.
sdk.catalog_workspace_content.get_full_catalog(workspace_id="demo")
If you want to set the label to attibute using gooddata_sdk you need to use methods that use declarative APIs for example put_declarative_workspace. I recommend you to check and try out store_declarative_workspace which
logical data model
and
analytics data model
to yaml files where you can easily edit it. Then you can put it back using load_and_put_declarative_workspace. Be aware when using it so you do not corrupt your workspace.
j
Well, I think @James Lee is asking for how to use such label for sorting. Am I correct?
j
yeah that's correct. the gooddata_sdk.insights.attributes only have the ReturnValueDesc label, so that's all i can sort by programmatically
j
Looks like this is missing feature. I reviewed the ReportDefinition in Python SDK and cannot find a way how to define sorting by attribute(label). @Jan Kadlec is it possible to define sorting (on backend side) in this case?
j
Indeed, the support for sort specification is missing in the execution definition. We should be able to add it because the API supports sorting specifications.
j
@James Lee May I ask you - are you our paying customer?
j
yeah we're paying customers -- my company is clearwater analytics
p
🎉 New note created.
j
Reported to our Productboard. How critical is it for you?
j
its critical. we need that feature to deliver tables for our clients
j
Forwarding to responsible people
j
thanks
j
Hello @James Lee, I am sorry that I responded with delay. My first assumption that Python SDK does not support this feature was wrong. The sort column is defined on the logical data model (LDM). See attached images.
When the sort column is defined in LDM, the attribute will sort based on it. See the attached image of the analytical designer.
The same thing will work in Python SDK as well.
Copy code
from gooddata_pandas import *
good_pandas = GoodPandas.create_from_profile()
df_factory = good_pandas.data_frames(workspace_id)
df_factory.for_insight(insight_id)