Skip to main content

Snowflake's New Editor: Private and Shared Workspaces

Snowflake introduced a new file editor called workspaces.
It makes the file organization easier via folders. Since it also includes the Database explorer and Query history panes, it also makes the database object exploration and query inspection easier.

There are two types of workspaces: (private) workspaces and shared workspaces.

(Private) Workspaces

  1. Private to a workspace owner (only owner can see and access the workspace files).
  2. Workspaces are stored in an automatically created, user-specific database. This database stores the private workspaces only, nothing else.
  3. It is possible to create all types of files (sql files, python files, javascript, shell files etc.)
  4. It is possible to create folders, and nest folders. Drag and dropping files is possible.
  5. AI Copilot is enabled.
  6. It is possible to use version control (git, github) to manage version history.

Soon workspaces will be a default editor in Snowflake.

Shared Workspaces

The same as private workspace, but has two differences:

  1. Shared workspaces can be created on regular databases that store other objects too such as tables.
    The creator of the workspace can choose the database and schema to create the workspace on.
  2. Multiple users can access the shared workspace. Access is managed by Roles.
    If one user modifies a shared workspace file, other users can see it.
    Users can bring files to shared workspace from their private workspaces.

Usage

Shared workspace editor does not support real time multi-user editing.
When one user starts to edit the file, the user gets the copy of that file as a draft. The changes will be visible only to that user. Only after the user publishes the changed file, the changes will be visible to other users too.

Changes such uploading, renaming, and deleting files and/or folders do not require publishing.

Before publishing a file, it is possible to compare the draft against the latest published version of the file using Show differences feature.

Shared workspaces store all the version history. It is possible to see older versions of the files and revert a file to previous versions.

Basically The shared workspaces workflow is very similar to git workflow:

  • user has to publish (similar to git push) their changes to make their changes visible to other team members.
  • while user A is editing a file, if user B modified the same file and pushed the modified file, conflicts may arise when user A tries to publish his/her changes.
  • workspace contains the version history and allows restoring older versions

Permissions and Access Control

Shared workspaces use role based access control.

To create a shared workspace a role should have either of the below permissions:

  • USAGE on the database and schema and CREATE WORKSPACE on the schema
  • OWNERSHIP of the target schema

Granting & Revoking access to shared workspace

It is possible to grant and revoke access to workspaces using both GUI and sql command.

Graphical user interface:

Using Configure workspace setting, you can add and remove roles, effecting granting and revoking access to shared workspace to those roles.

Using sql command:

GRANT WRITE ON WORKSPACE <workspace_name> TO ROLE <role_name>;

REVOKE WRITE ON WORKSPACE <workspace_name> FROM ROLE <role_name>;

In addition to WRITE privilege, a role also needs the USAGE privilege on the database where the shared workspace is located.

Comments

Popular posts from this blog

Introduction to SQLFluff: How to make your SQL code clean and error-free

Image by Jake Aldridge from Pixabay You know oftentimes, the cause of runtime or compile errors and hours of debugging agony is all due to simply a missing semicolon. Have you ever had such experience? If you had, you are not alone. There are two ways to avoid these unfortunate situations: either become a perfect developer who never makes mistakes, or use helpful tools such as linters that can catch these errors early on. I am nowhere near being a perfect developer who never makes a mistake. In fact, I'm probably the opposite of a perfect developer, so even if I wanted to, I wouldn’t be able to teach you how to become a perfect developer. But what I can teach you is using linters. A Wikipedia defines a linter as a "static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs." If you're not convinced yet on using linters, consider this scenario: in a large project with multiple members, different people tend to ...

Git squash merge explained

There are many ways to integrate changes in git: regular / normal git merge, git squash merge, git rebase etc. This article explains git squash merge by comparing it to regular merge. Let’s use below example: In the repository with default main branch, after two commits, a new feature branch is created. Some work happened in feature branch. feature branch now has 2 commits that it shares with main branch, and three exclusive commits (exists only in feature branch). In the meantime, others worked on main branch and added two new commits (exists only in main branch). git log output of the main branch: c72d4a9 ( HEAD - > main ) fourth commit on main 2c3dd61 third commit on main 0c2eec3 second commit on main 9b968e8 first commit on main git log output of the feature branch: 786650f ( HEAD - > feature ) third commit on feature 21cbaf1 second commit on feature 677bc7f first commit on feature 0c2eec3 second commit on main 9b968e8 first commit on mai...

How To Use KeePassXC Cli

There are similarly named programs: KeePass, KeePassX and KeePassXC (many of which are each others’ forks). Program Condition KeePass primarily for Windows. KeePassX no longer actively maintained. KeePassXC actively maintained and runs natively on Linux, macOS and Windows . Note: GUI version of the KeePassXC has more features than cli version. GUI version has variety of shortcuts as well. Regarding how to use GUI version of the KeePassXC, visit Getting Started Guide . Below features are available only in GUI version. Setting “Name” and “Description” fields of passwords database. Nesting Groups. Creating entry attributes ( open issue ). Adding Timed One-Time Passwords (TOTP). Adding entry with the same title as existing entry. KeePassXC stores all the passwords in passwords database. A passwords database (hereafter referred to as database) is an (encrypted) binary file. It can have any or no extension, but the .kdbx extension is commonly used. The ...