Documentation Home
MySQL Shell for VS Code

MySQL Shell for VS Code  /  ...  /  Action Output for Code Blocks

Pre-General Availability: 2023-03-09

2.4.3 Action Output for Code Blocks

Action output is the text you see in a code block, such as the error output from failed SQL queries; the results from running Python, JavaScript, or TypeScript code; or the status information of long-running remote commands. An output entry has a distinct color, depending on its type:

  • Status messages are gray

  • Success messages are green

  • Warning messages are yellow

  • Error messages are red

The output uses a fixed-width font to stand out from regular text. For example, issuing USE sakila (followed by Ctrl+Enter) in a DB Notebook editor, returns a simple, status message as standalone output directly under the SQL query.

Figure 2.6 MySQL Shell for VS Code - Status Message

Content is described in the surrounding text.

Commands, scripts, and simple SQL statements issued from a GUI Console session also return status, success, warning, and error messages as standalone output. The exact message text returned might differ depending on whether you issued the command or query from a console session or notebook editor.

For SQL queries within a single code block, the action output can appear either as standalone output or in the Output tab as part of an SQL execution result, if there are errors. For example, a simple USE statement issued with an unknown database returns an error message as standalone output under the statement.

Figure 2.7 MySQL Shell for VS Code - Error Message

Content is described in the surrounding text.

Hover over an error message with a mouse to apply focus and underline the text. By clicking the error text, you select the query that caused the output. This behavior is well-suited to the task of troubleshooting a code block that contains multiple SQL statements. Each entry is prefixed with an index number when a query returns multiple errors. The index shown for an output item is also the index of the statement in the code block.


JavaScript, TypeScript, and Python code consists of a single block of text that cannot benefit from this feature.

As the following example shows, selecting the error indexed as #2 identifies the originating code block (a scrolling bar appears under the language prompt) and also highlights the second failed statement (SELECT B;) in that code block.

Figure 2.8 MySQL Shell for VS Code - Error Messages with Index Numbers

Content is described in the surrounding text.

When a complex SQL query produces multiple sets of good result data, each set appears in a separate, numbered tab. Tab numbers represent the order of each statement in the code block that generated the result data. A single Output tab (shown as part of an SQL execution result) contains all of the error messages generated and indexed, if necessary, during the action.

Figure 2.9 MySQL Shell for VS Code - Error Messages in Output Tab

Content is described in the surrounding text.


Changing the code could alter the association between the editor and the output if the order of the statements changes.