Skip to content

Workspaces and saved queries

A workspace is a set of folders and connections, for example one per product, with folders such as “dev” and “QA”. Each workspace also has its own list of environments. Your saved queries belong to their connection, so they follow it into every workspace that lists it.

The first time you start DataKlin with workspaces, your connections open in a Default workspace, in the folders they were in.

The current workspace’s name is at the top of the Database Explorer. Click it to switch to another workspace, or to choose New Workspace…, Open Workspace…, Save Workspace As… or a recent workspace. File › Open Workspace…, File › Open Recent › and File › Save Workspace As… do the same from the application menu, and the welcome tab lists your recent workspaces.

  • Changes save at once. There is nothing to save by hand: a new folder, a moved connection or a renamed workspace is written straight away.
  • Add Existing Connections… brings connections from your other workspaces into this one. Click a connection, or press Space, to tick it; tick as many as you like, then choose Add or press Enter.
  • Remove from Workspace takes a connection out of the current workspace without deleting it. It stays in every other workspace that lists it.
  • No connection is ever lost. A connection that no workspace lists still shows in Default.
  • Each workspace keeps its own tabs. Open tabs and consoles belong to the workspace they were opened in. Switching back to a workspace brings its tabs back.
  • Switching disconnects. If connections are open, DataKlin asks first, then disconnects them and switches. A statement still running is cancelled. The tabs stay open and reconnect when you next use them. The status bar shows how many connections are open, with Disconnect All.
  • A copied workspace file that has the same id as a workspace already in use is refused, with a message naming the file that holds it. Use Save Workspace As… to make a separate copy.

A workspace file holds only the layout: its folders, which connections it lists, and its environments. It holds no connection settings, passwords or other secrets; those stay where they were (see Secret storage). Workspace files point at the connections saved on this computer, so a workspace file copied to another computer doesn’t bring the connections with it.

The window title shows the active tab and the workspace: <active tab> — <workspace> — DataKlin.

  • Click Save in a console’s toolbar, or press Ctrl+S (Cmd+S on macOS), to save its query under the console’s connection. A small window asks for a name.
  • Press Ctrl+Shift+S (Cmd+Shift+S on macOS), or use the arrow on the Save button, for Save Query As…. It saves the query under a new name.
  • To save a console to a .sql file instead, run Save to File… (it’s also in the Save button’s arrow) from the command center. They have no default shortcut; you can bind one in Keyboard Shortcuts. Ctrl+O (Cmd+O on macOS) opens a SQL file.

The Saved Queries view on the activity rail lists the current workspace’s saved queries by connection. Type in its filter to find one. It works without connecting. The console and saved queries covers the Save button, the unsaved dot and the view’s actions.

From the view you can open a saved query in a console, run it, rename it, copy its SQL (Copy Query) or delete it. A delete can be undone. Deleting a connection deletes its saved queries too, and the delete dialog says so.

Each workspace defines its own environments, each with a name, a color and a Protected switch. The built-in environments are Development, Test, Staging and Production, and only Production is protected to start with. A protected environment gets the production rules: see Read-only and production safety.

Edit them in Workspace Settings, the Workspace section of the Settings tab. Open it with Open Workspace Settings in the command center, or from the workspace menu at the top of the Database Explorer. There you can:

  • rename the workspace
  • add, rename, recolor, reorder and delete environments, and turn Protected on or off
  • choose the Default environment for new connections (None by default).

In the connection dialog, the Environment field in the Connection section lists the workspace’s environments, marks the protected ones, and has New Environment… to add one on the spot.

Opening or editing a workspace can make a connection protected, but never less protected. A connection becomes unprotected only through an action you confirm, such as turning Protected off on its environment, or choosing an unprotected environment for it in the connection dialog. When a connection is still protected because another workspace protects it, Workspace Settings says how many and offers Stop Protecting…, which also asks first.