Workspaces

A Workspace is a container that can hold Collections, Collection Aliases, Views, and Query Lambdas.

In this way, workspaces are analogous to folders, whereas their contents (such as collections and Query Lambdas) are analogous to files. Every resource must be part of exactly one workspace. By default, new resources are created in the commons workspace.

Having multiple workspaces is useful for organizations. You can use workspaces to separate resources between test and production environments, or to separate resources for different projects within the same organization.

Creating Workspaces

Workspaces can be created in the Rockset Console or by using the Rockset API directly. To create a workspace in the Rockset Console, select the "Create Workspace" button in the Collections tab of the Rockset Console. A modal will pop up where you can fill in the workspace's name and description:

🚧

Once a resource is created inside the workspace, its workspace cannot be changed.

A workspace can be deleted using the Rockset API, but only if there are no resources inside that workspace.

The commons Workspace

By default, collections will be created in a workspace named commons. All system-created collections (such as the _events collection created with your organization) will exist in the commons workspace. If you do not specify a workspace when creating or accessing collections, the workspace will default to commons.

Using Workspaces

Workspaces are queried by preceding the collection name in your SQL queries with a dot (.). For instance, the query SELECT user_id, email FROM twitch_data.users will access the collection users in workspace twitch_data.

🚧

If you do not specify a workspace when querying a collection, the workspace will default to commons.

For instance, the query DESCRIBE users is equivalent to DESCRIBE commons.users.

When applicable, resources in one workspace can reference resources in other workspaces. For instance, you might have a Query Lambda in a workspace named user_profiles which contains a SQL query referencing collections in the workspaces twitch_data and twitter_data.

The _system Workspace

_system is a special workspace that is automatically created in Rockset. This workspace does not appear in the console, but it can be queried to list your current Rockset resources. The resources included in this workspace are:

  • _system.collection: list of all collections
  • _system.view: list of all views
  • _system.alias: list of all aliases
  • _system.similarity_index: list of all similarity indexes

For example, to list all collections you can run the following query:

SELECT * FROM _system.collection
+------------------------------------+-------------+-------------------------+--------------+-------------------------+--------------------------------+-----------------------------+ | rrn | workspace | workspace_rrn | name | field_schema_index | field_schema_index_status | user_compaction_status | |------------------------------------+-------------+-------------------------+--------------+-------------------------+--------------------------------+-----------------------------| | 'rrn:col:usw2a1:1abcd...' | 'commons' | 'rrn:ws:usw2a1:2lns...' | 'query_logs' | ["ADD INDEX ON ALL"] | 'INCOMPLETE' | 'INCOMPLETE' | | 'rrn:col:usw2a1:76tz3...' | 'demos' | 'rrn:ws:usw2a1:8rqt...' | 'demo1' | ["ADD INDEX ON ALL"] | 'READY' | 'READY' | | 'rrn:col:usw2a1:g32ef...' | 'commons' | 'rrn:ws:usw2a1:2lns...' | 'test' | ["ADD INDEX ON ALL"] | 'READY' | 'READY' | +------------------------------------+-------------+-------------------------+--------------+-------------------------+--------------------------------+-----------------------------+

You can also include filtering in these queries. For example, to list all collections in the commons workspace you can run the following query:

SELECT * FROM _system.collection WHERE workspace = 'commons'
+------------------------------------+-------------+-------------------------+--------------+-------------------------+--------------------------------+-----------------------------+ | rrn | workspace | workspace_rrn | name | field_schema_index | field_schema_index_status | user_compaction_status | |------------------------------------+-------------+-------------------------+--------------+-------------------------+--------------------------------+-----------------------------| | 'rrn:col:usw2a1:1abcd...' | 'commons' | 'rrn:ws:usw2a1:2lns...' | 'query_logs' | ["ADD INDEX ON ALL"] | 'INCOMPLETE' | 'INCOMPLETE' | | 'rrn:col:usw2a1:g32ef...' | 'commons' | 'rrn:ws:usw2a1:2lns...' | 'test' | ["ADD INDEX ON ALL"] | 'READY' | 'READY' | +------------------------------------+-------------+-------------------------+--------------+-------------------------+--------------------------------+-----------------------------+