Workspaces

Overview

Workspaces provides a unified editor for creating, organizing, and managing code across multiple file types, allowing you to analyze data, develop models, and build pipelines - all in one tool. Workspaces are private to you and offer a development environment where you can build, experiment, and test your work.

Prerequisites

  • Default secondary roles must be set to ALL for any user to use Workspaces. This setting is enabled by default through BCR-1692.

The Workspaces environment

Workspaces is a new editor composed of six sections or panes:

Overview of the Workspaces environment.
  1. Workspaces - One area for all your files and folders. Drag and drop to move files between folders.

  2. Worksheets - Open and edit your old worksheets.

  3. Object Explorer - View the databases you can query. Filter and search for objects.

  4. Editor - Edit queries and split to view multiple files at the same time.

  5. Results - Results can be split or pinned for easy comparison.

  6. Query History - View the history of all queries you’ve run for the current file or across all files.

Default workspace

Each user has a default workspace named “My Workspace” automatically provisioned by Snowflake. You can also create a new workspace from the Workspaces menu. The default workspace cannot be deleted or renamed.

Worksheets

In Workspaces, you can open and edit worksheets you own or have any permissions on. However, edits will not be saved if you only have view permissions on the worksheet. To convert a worksheet into a file in a workspace, drag it to a folder inside the workspace.

Query History

Query History is located at the bottom of the editor and includes two modes: Current File and All Files.

  • Current File - Shows historical queries from the file currently open and selected in the editor.

  • All Files - Displays all historical queries you have run across all files.

Object Explorer

The Object Explorer contains a hierarchical view of all databases in your account, the schemas for each database, and other objects, organized by type. Use the filter to search for objects. You can also filter out unusable objects to simplify your view by selecting Show databases I can query. The options available in the vertical ellipsis More actions for worksheet (more actions) button vary by object type, but include features such as placing names in the editor, copying names, and viewing definitions.

Create and work with files and folders

In a workspace you can use familiar IDE and source control conventions to author, organize, and run code.

To create a new file or folder in your workspace:

  1. Sign in to Snowsight.

  2. Select Projects » Workspaces in the left-side navigation menu.

  3. Select the + next to the appropriate folder.

  4. Select an option to create a new file or folder, or upload an existing file or folder:
    • SQL File - Creates a new, blank SQL file in the editor as a tab. By default, .sql is appended to unnamed files. The editor recognizes it as a SQL file, enabling syntax highlighting and autocomplete.

    • File - Creates a new file. Name the file and its extension. If the extension is recognized by the editor (for example, Java, JS, Scala, etc.), code highlighting and autocomplete are enabled.

    • Folder - Creates a new, empty folder inside the workspace.

    • Upload Files - Upload one or more files to any location in your workspace. The editor detects the file type based on its extension, applying the appropriate icon and behavior when opened.

    • Upload Folder - Select one or more files or folders to add to the selected Workspace.

Manage files

You can rename, delete, move, and organize your workspaces, files, and folders.

To rename or delete a file, folder, or workspace:

  1. Hover over the target and select the vertical ellipsis More actions for worksheet (more actions).

  2. Select Rename or Delete. If you choose to delete, you are prompted to confirm.

To create a folder in a workspace, select the + next to the workspace or an existing folder.

To organize files and folders, drag any file or folder into a different location in the same workspace. You can also drag and drop a worksheet into a workspace.

View and run SQL files

In Workspaces, queries are run similarly to classic Worksheets with a few small advantages, including:

  • Improved UI performance

  • Parallel execution - run two queries at the same time from the same SQL file

View multiple files or results in one layout

Managing multiple files with tabs and split panes offers several advantages:

  • Compare code or results side by side - Quickly reference one worksheet query while working on another.

  • Multitask more efficiently - View different cells, outputs, or files at once with less back and forth navigation.

To adjust your Workspaces layout, select vertical ellipsis More actions for worksheet (more actions) in the Workspaces pane and choose the appropriate option:

  1. Split right

  2. Split down

  3. Close others

Integrate with a Git repository

Workspaces can be local to Snowflake, or you can sync workspaces in development with a branch in a Git repository. In Workspaces, you can:

Create a Git workspace

You can create a workspace connected to a Git repository to develop and manage files directly in Snowsight.

To create a new Git-synced workspace:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Workspaces.

  3. In the Workspaces menu, select From Git repository.

  4. Copy the URL from your Git repository (for example, https://www.github.com/my-user/my-repo-name), and then paste it into the Repository URL field.

  5. Optional: Rename the new Git-synced workspace.

  6. In the API Integration menu, select an API integration.

    API integrations are created by the account administrator and must allow access to the Git repository URL you are using in step 4. For details, see Create an API integration for interacting with the repository API.

    In addition, if you’re using GitHub as your Git provider and prefer OAuth for authentication, the account administrator must create an API integration that supports OAuth. For example:

    CREATE OR REPLACE API INTEGRATION api_integration_name
                API_PROVIDER = git_https_api
                API_ALLOWED_PREFIXES = ('https://github.com/')
                API_USER_AUTHENTICATION = (
             type = snowflake_github_app
                )
                ENABLED = true;
    
    Copy
  7. Under API integration, select an authentication method:

    • OAuth2 - Select Sign in to authenticate with your GitHub repository. After signing in, you won’t need to provide credentials in future sessions. Note that OAuth2 is not available for PrivateLink environments.

    • Personal access token - Select the database and schema where the object containing your token is stored. To create a new secret, select + Secret and enter the required details. The API integration must be configured to allow access to this secret or to all secrets.

    • Public repository - Select this option if you are using a public repository that doesn’t require authentication. Note that it isn’t possible to commit and push any changes from your workspace to this public repository.

  8. Select Create.

Update author details and credentials for a branch

By default, your Snowflake email and username are used for committing changes to your Git repository. You can update these at any time.

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Workspaces.

  3. Select the Changes tab.

  4. Select the ellipsis and then select Edit credentials.

  5. Specify an author name and email.

  6. Select Update.

Create a new branch

You can create a new branch from your current branch to work on changes independently.

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Workspaces.

  3. Select the Changes tab.

  4. Select the repository dropdown.

  5. Select + New.

  6. Specify a new branch name, and then select Create.

Switch to a different branch

If you have saved but uncommitted changes, you’ll need to choose how to handle them before switching branches.

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Workspaces.

  3. In the Git workspace view, select Changes.

  4. From the branch menu, select the branch you want to switch to.

    Tip: To filter the list, start typing a branch name.

Fetch remote branches

If a new branch was created outside of Snowsight (for example, one created in your Git provider), you can fetch it into your Git-synced workspace using the Fetch All option. This updates your list of available remote branches.

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Workspaces.

  3. In the Git workspace view, select Changes.

  4. Select the down arrow next to the Pull menu, and then select Fetch All. When the fetch finishes, newly created remote branches appear in the branch list and are available to check out.

View updated files

To view all the files that were added, deleted, or modified since your last successful commit and push:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Workspaces.

  3. At the top of the folder view, select Changes. Modified files are indicated with an M, added files are indicated with an A, and deleted files are indicated with a D.

  4. To view a visual diff of the changes in the editor, select a file.

Commit and push updates

After reviewing your changes, you can commit and push them to your remote Git repository from within the workspace.

To commit and push your updated files to the remote Git repository:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Workspaces.

  3. Select Changes at the top of the folder view.

  4. Write a commit message in the Commit message field.

  5. Select Push.

  6. Write a commit message and select Push to push your updates to the Git repository.

    Note

    If conflicts are detected, you are prompted to pull first. Select Pull to review a list of files with conflicts.

View and resolve conflicts

If a conflict occurs during a push, you can view and resolve it directly in the workspace before committing again.

  1. In Workspaces, at the top of the folder view, select Changes. If one or more files have a conflict, a message is displayed at the top of the view. Files with a conflict are indicated with a red M.

  2. To view a visual diff of the conflict in the editor, select a file. Under File with conflicts, differences are highlighted inline.

  3. Accept the current change, an incoming change, or both changes. The result of the merge is shown.

  4. Under Diff View you can view the current and remote versions side by side.

  5. Select Accept all current or Accept all remote.

  6. After you resolve the conflicts, select Push.

  7. Write a commit message.

  8. Select Push.

Keyboard shortcuts

Worksheets provide keyboard shortcuts to help you quickly navigate, customize your view, and edit queries. The following table identifies commonly used keyboard shortcuts:

Task

MacOS shortcut

Windows shortcut

Run selected

CMD + Return

CTRL + Enter

Run all

CMD + Shift + Return

CTRL + Alt + Enter

Split pane horizontally

CTRL + \

CTRL + \

Split pane vertically

CTRL + /

CTRL + /

Limitations

  • Workspaces does not support sharing.

  • Query filters are not supported. Any queries containing filters will fail.

  • Workspaces files are not displayed on the Snowsight homepage.

  • Opening and editing the same worksheet in the (new) Workspaces UI and (classic) Worksheets UI simultaneously can result in lost changes.

  • For worksheets, execution context settings (role, warehouse, and namespace) are not synchronized across the new Workspaces UI and the classic Worksheets UI.