fabric-cli

workspace examples

Type: .Workspace

Supported commands: fab desc .Workspace

See also:

Navigate to a workspace using the cd command. You can use relative or absolute paths based on current context.

# use absolute path
fab:/ws1.Workspace/lh1.Lakehouse$ cd /ws1.workspace
* Switched to 'ws1.Workspace'

# use relative path
fab:/ws1.Workspace/lh1.Lakehouse$ cd ../../ws1.Workspace
* Switched to 'ws1.Workspace'

# navigate to Personal workspace
fab:/$ cd My workspace.Personal
* Switched to 'My workspace.Personal'

fab:/$ cd ~
* Switched to 'My workspace.Personal'

Copying workspace items to another one

Copy items from one workspace to another. Only items supported by export are included. This works in interactive mode. Use -f (force flag) to override confirmation prompts, copy the item definition without its sensitivity label.

Note: When you copy item definition, the sensitivity label is not a part of the definition.

# interactive mode, copy items from one workspace to another one
fab:/$ cp ws1.Workspace ws2.Workspace

Checking if a workspace exists

Verify if a workspace exists.

fab:/$ exists ws1.Workspace
* true

fab:/$ exists ws1_.Workspace
* false

Exporting workspace items to Local

Export items from a workspace to local directory. Only items supported by export are included. Use -f (force flag) to override confirmation prompts, export the item definition without its sensitivity label. Use -a for all.

Note:

# interactive mode
fab:/$ export ws1.Workspace -o /tmp

# export all
fab:/$ export ws1.Workspace -o /tmp -a

# command_line mode
~$ fab export ws1.Workspace -o /tmp -a

Exporting workspace items to Lakehouse

Export items from a workspace to lakehouse. Only items supported by export are included. Use -f (force flag) to override confirmation prompts, export the item definition without its sensitivity label. Use -a for all.

Note: When you export item definition, the sensitivity label is not a part of the definition.

# interactive mode
fab:/$ export ws1.Workspace -o /ws1.Workspace/lh1.Lakehouse/Files

# export all
fab:/$ export ws1.Workspace -o /ws1.Workspace/lh1.Lakehouse/Files -a

# command_line mode
~$ fab export ws1.Workspace -o /ws1.Workspace/lh1.Lakehouse/Files -a

Getting and querying workspace details

Retrieve and query workspace details with -q (JMESPath query). Output to local path or Lakehouse/Files with -o.

# get JSON properties
fab:/$ get ws1.Workspace

# query using JMESPath
fab:/$ get ws1.Workspace -q sparkSettings

# export JMESPath query result
fab:/$ get ws1.Workspace -q sparkSettings -o /tmp

Listing workspaces and items

List workspaces and workspace items. Use -l for details and -a to include hidden elements.

At tenant level -a shows:

At the workspace level -a exposes:

# listing workspaces
fab:/$ ls 
fab:/$ ls -l
fab:/$ ls -l -a

# listing workspace items
fab:/$ ls ws1.Workspace
fab:/$ ls ws1.Workspace -l
fab:/$ ls ws1.Workspace -la

Note: to keep those hidden elements always visible, use config set show_hidden true, this eliminates the need for -a flag.

Creating a workspace

Create a workspace. Use capacityName to specify inline capacity (default: CLI-configured capacity config set default_capacity <>).

To create a workspace without a capacity use capacityName=none. Parameters are case insensitive.

# uses CLI config `default_capacity` by default
fab:/$ create ws2.workspace

# inline capacity name
fab:/$ create ws3.workspace -P capacityname=capac1

# create workspace without a capacity
fab:/$ create ws4.workspace -P capacityname=none

Moving workspace items to another one

Move items from one workspace to another. Only items supported by export are included. This works in interactive mode. Use -f (force flag) to override confirmation prompts, move the item definition without its sensitivity label.

Note: When you move item definition, the sensitivity label is not a part of the definition.

# interactive mode, move items from one workspace to another one
fab:/$ mv ws1.Workspace ws2.Workspace

Opening a workspace in the web browser

Open a workspace in the web browser.

fab:/$ open ws1.Workspace
Opening 'ws1.Workspace' in the web browser...

Removing multiple workspaces

Remove needless workspaces. This works in interactive mode.

# interactive mode, select workspaces to remove
fab:/$ rm .

Removing a workspace and underlying items

Remove a workspace and its items. Use -f to delete the entire workspace, including all items (use with caution). Without -f, select specific items to remove. Multi-item deletion only works interactive mode.

# interactive mode, select items to remove
fab:/$ rm ws1.Workspace

# interactive mode, force workspace deletion, including all items
fab:/$ rm ws1.Workspace -f

# command_line mode, multi-item selection
~$ fab rm ws1.Workspace
x rm: [NotSupported] Not supported in 'command_line' mode

# command_line mode, force workspace deletion
~$ fab rm ws1.Workspace -f

Setting and updating workspace properties

Set workspace displayName, description or sparkSettings. Use -f to force. Properties are case sensitive.

# update name
fab:/$ set ws2.Workspace -q displayName -i ws2r

# update description
fab:/$ set ws2r.Workspace -q description -i "New description" -f

# update sparkSettings - runtime version
fab:/$ set ws2r.Workspace -q sparkSettings.environment.runtimeVersion -i 1.2 -f

# assign starter pool to workspace
fab:/$ set ws2r.workspace -q sparkSettings.pool.defaultPool -i {"name": "Starter Pool","type": "Workspace"}

# assign a custom pool
fab:/$ set ws2r.workspace -q sparkSettings.pool.defaultPool -i {"name": "spool1","type": "Workspace","id": "0fa7d7f5-a007-419d-8323-311cc6cc0d3c"} -f

See all examples