A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.databricks.com/aws/en/notebooks/notebook-editor below:

Navigate the Databricks notebook and file editor

Navigate the Databricks notebook and file editor

This article describes the functions available to help you navigate the Databricks notebook and file editor, including keyboard shortcuts, code suggestions and autocomplete, variable inspection, and code folding. When you use the notebook or the file editor, Databricks Assistant is available to help you generate, explain, and debug code. See Get coding help from Databricks Assistant for details.

You can choose from a selection of editor themes. Select View > Editor theme and make a selection from the menu.

Keyboard shortcuts​

To display keyboard shortcuts, select Help > Keyboard shortcuts. The keyboard shortcuts available depend on whether the cursor is in a code cell (edit mode) or not (command mode).

Command palette​

You can quickly perform actions in the notebook using the command palette. To open a panel of notebook actions, click in the lower-right corner of the workspace or use the shortcut Cmd + Shift + P on MacOS or Ctrl + Shift + P on Windows.

Find and replace text​

To find and replace text within a notebook, use the keyboard shortcut, Cmd + F (Mac) or Ctrl + F(Windows), or click Edit > Find... to open the Find dialog box. Enter the text you want to find. The current match is highlighted in orange and all other matches are highlighted in yellow. To access the native browser search, press Cmd + F (Mac) or Ctrl + F(Windows) again.

Click the to open the Replace option. Enter the text you want to use instead. To replace the current match, click Replace. To replace all matches in the notebook, click Replace All.

To move between matches, click (previous match) or (next match). You can also press Shift + Enter and Enter to go to the previous and next matches, respectively.

To close the find and replace tool, click or press esc.

Variable inspection​

To display information about a variable defined in a SQL or Python notebook, hover your cursor over the variable name. Python variable inspection requires Databricks Runtime 12.2 LTS or above.

See Variable explorer.

Go to definition​

When a Python notebook is attached to a compute resource, you can quickly go to the definition of a variable, function, or the code behind a %run statement. To do this, right-click the variable or function name, and then click Go to definition or Peek definition.

Hold down the Cmd key on macOS or the Ctrl key on Windows and hover over the variable or function name. If a definition is found, the name turns into a hyperlink.

The “go to definition” feature is available in Databricks Runtime 12.2 LTS and above.

Code folding​

Code folding lets you temporarily hide sections of code. This can be helpful when working with long code blocks because it lets you focus on specific sections of code you are working on.

To hide code, place your cursor at the far left of a cell. Downward-pointing arrows appear at logical points where you can hide a section of code. Click the arrow to hide a code section. Click the arrow again (now pointing to the right) to show the code.

For more details, including keyboard shortcuts, see the VS Code documentation.

Multicursor support​

You can create multiple cursors to make simultaneous edits easier, as shown in the video:

To create multiple cursors in a cell:

On macOS, you can create multiple vertically aligned cursors by using the keyboard shortcut Option+Command+ up or down arrow key.

Column (box) selection​

To select multiple items in a column, click at the upper left of the area you want to capture. Then:

Change shortcut for multicursor and column selection​

An alternate shortcut is available for multicursor and column (box) selection. With the alternate selection, the shortcuts change as follows:

To enable the alternate shortcuts, do the following:

  1. Click your username at the upper-right of the workspace, then click Settings in the dropdown list.
  2. In the Settings sidebar, select Developer.
  3. In the Code editor section, change the Key modifier for multi-cursor click setting to Cmd for macOS or Ctrl for Windows.

When you enable alternate shortcuts, the keyboard shortcut for creating multiple vertically aligned cursors does not change.

Browse data​

Use the schema browser to explore Unity Catalog objects available for the notebook. Click at the left side of the notebook to open the schema browser.

The For you button displays only those objects that you've used in the current session or previously marked as a Favorite.

As you type text into the Filter box, the display changes to show only those objects that contain the text you type. Only objects that are currently open or have been opened in the current session appear. The Filter box does not do a complete search of the catalogs, schemas, tables, and volumes available for the notebook.

To open the kebab menu, hover the cursor over the object's name as shown:

If the object is a table, you can do the following:

If the object is a catalog, schema, or volume, you can copy the object's path or open it in Catalog Explorer.

To insert a table or column name directly into a cell:

  1. Click your cursor in the cell at the location you want to enter the name.
  2. Move your cursor over the table name or column name in the schema browser.
  3. Click the double arrow that appears at the right of the object's name.
Use web terminal and Databricks CLI​

To open the web terminal in a notebook, click the terminal icon at the bottom of the right sidebar.

In Databricks Runtime 15.0 and above, you can use the Databricks CLI from the web terminal in a notebook. See Run shell commands in Databricks web terminal for requirements and usage information.

You cannot use the CLI from a notebook cell. In a notebook, commands like %sh databricks ... do not work with Databricks Runtime 15.0 or above.

Personalized autocomplete​

Autocomplete automatically completes code segments as you type them. Completable objects include types, classes, and objects, as well as SQL database, table names, and query snippets. Databricks uses your Unity Catalog metadata and usage to personalize suggestions.

Autocomplete suggestions automatically appear when you type in a cell. Use the up and down arrow keys or your mouse to select a suggestion, and press Tab or Enter to insert the selection into the cell.

note

Server autocomplete in R notebooks is blocked during command execution.

There are two user settings to be aware of:

Bracket matching​

When you click near a parenthesis, square bracket, or curly brace, the editor highlights that character and its matching bracket.

Python error highlighting​

Workspaces with Databricks Assistant enabled can also select Fix with Assistant for AI-assisted suggestions.

Databricks notebooks support the following error highlighting:

Enable Python error highlighting​

To enable or disable error highlighting, do the following:

  1. Click your username at the upper-right of the workspace, then click Settings in the dropdown list.
  2. In the Settings sidebar, select Developer.
  3. Toggle the setting for Python syntax error highlighting (under Code editor), Python format error highlighting (under Experimental features), and/or Python type error highlighting (under Experimental features).
Configure Python syntax highlighting​

When a notebook is connected to compute running Databricks Runtime 16.4 or above or serverless environment version 3 or above, you can customize the behavior of syntax highlighting by creating a pyproject.toml file. For a given notebook, the closest pyproject.toml file in its direct ancestor path in the Workspace File System will be used. If one cannot be found in the ancestor path, then a pyproject.toml file in the current user's home folder will be used.

For example, if you have a notebook with the path a/b/c/d/notebook.py and there are pyproject.toml files at a/b/pyproject.toml and a/b/c/pyproject.toml then the second one will be used since it is closer. A pyproject.toml file at /a/b/c/e/pyproject.toml would not be considered because it is not in the direct ancestor path.

Databricks uses standard syntax for pyproject.toml files. For example, you can refer to the Ruff documentation to see how to configure the Ruff linter with a pyproject.toml file.

Currently, Databricks only supports configuring ruff, pylint, pyright and flake8 for linting through pyproject.toml.

To enable a linter, the pyproject.toml file needs to have a [tool.<name-of-linter>] block.

To explicitly disable a linter, add the following block:

[tool.<name-of-linter>]
disabled=true

You can also disable Databricks-written syntax highlighting rules with a block such as:

[tool.databricks]
disabled_rules = ['DB01', 'DB03']

Because Flake8 expects a configuration in a different format, you have to pass in the configuration for Flake8 as a string:

[tool.flake8]
config = """ \
[flake8] \
extend_ignore = E303 \
"""
Customize SQL formatting​

You can customize settings for SQL formatting in new SQL editor and the notebook editor. Click View > Developer Settings. Scroll down to SQL Format and specify your settings.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4