Storage over multiple workspaces

Before the migration we used to have a Storage at the root entity level based on the entity_id to get all information of the underlying children.

Now we have multiple workspaces with each it’s own root entity.

How to save/get data within the same application over different workspaces making use of your Storage?
And how to filter out “Development” workspaces? (I can use a different key, but I can’t find a Development property in the workspace object)

The snippet below results in an Internal Error.

import os

from viktor import Storage
from viktor.api_v1 import API

workspaces = API(token=os.environ.get("COMPANY_TOKEN")).get_workspaces(app_name="APP NAME", include_archived=False)
for workspace in workspaces:
    root_entities = workspace.get_root_entities()
    for entity in root_entities:
        if entity.entity_type.name != "EntityName":
            continue
        storage = Storage()
        file = storage.get(key="cpt_data", scope="entity", entity=entity)
        # InternalError

How to save/get data within the same application over different workspaces making use of your Storage? … The snippet below results in an Internal Error.

I’m pretty sure that the InternalError is raised because the storage entry cannot be found, as it cannot be accessed from another workspace (this is unfortunately not clear from the SDK docs on Storage).

Ways to communicate with other workspaces is to store something on the parametrization, use a file-field, file-type entity, or compute something over the API (Entity.compute)

And how to filter out “Development” workspaces?

Maybe not relevant anymore , but still: get_workspaces should already filter out development workspaces.