Debugging InMemory ETL projects with VS Code

[Cloud release: 2025.04.09]
[On-prem release: 2025 June]
[On-prem build: 25.05.27002]

You can start debugging an opened InMemory ETL project file by clicking the Debug button in the InMemory ETL Studio.

This will open the InMemory project in Visual Studio Code (VS Code). (See instructions for enabling VS Code for querying InMemory: Visual Studio Code extension for TARGIT InMemory SQL.)

How to start debugging

To start debugging an .imp file in Visual Studio Code, follow these steps:

  1. Open the .imp File:

    • Open the InMemory project in InMemory ETL Studio.

    • Click the Debug button.

  2. Start Debugging:

    • Option 1 (Using F5):

      • Press F5 on your keyboard to start debugging immediately.

    • Option 2 (Using the Run and Debug Panel):

      • Press Ctrl + Shift + D (or Cmd + Shift + D on macOS) to open the “Run and Debug” panel in VS Code.

      • From the "Run and Debug" panel, press the “Run and Debug” button, which will initiate the debugging process.

VS Code will start the debugging session.

Breakpoints

During debugging in Visual Studio Code, you can use breakpoints and various hotkeys to control the flow of your .imp script. Here’s a quick guide:

Setting Breakpoints

  • Set breakpoint (F9)

    • To set a breakpoint, place the cursor on the line where you want to pause the execution.

    • Press F9 to toggle the breakpoint on or off at the selected line.

    • When the script reaches a breakpoint during debugging, execution will pause, allowing you to inspect variables, tables, and more.

Hotkeys for Debugging

  • F10 (Step Over)

    • Use F10 to execute one command or line at a time.

    • It steps over function calls, meaning it won’t go inside functions but will still execute them.

  • F5 (Continue)

    • Press F5 to resume the script execution.

    • It will continue running until the next breakpoint or the end of the script.

  • Shift + F5 (Stop Debugging)

    • To stop debugging at any point, press Shift + F5. This will end the debugging session immediately.

Watch, Variables and Immediate panels

To monitor variables and data during debugging in Visual Studio Code, follow these instructions for using the Variables panel, Watch panel, and Immediate window:

1. Variables Panel

  • While debugging, open the Variables panel to view the current state of your variables and tables.

  • The panel will automatically display all the variables in the current scope, along with their values.

2. Watch Panel

  • The Watch panel allows you to watch specific variables or query results during debugging.

  • To add custom data to the Watch panel, you can use SQL-like queries:

    • For Variables: Type SELECT @my_variable to see the value of a variable called my_variable.

    • For Tables: Type SELECT * FROM YOUR_TABLE_NAME to see all data from a specific table.

  • This feature gives you real-time insights into how variables and tables are changing as your script runs.

3. Immediate Window

  • The Immediate window lets you execute commands and queries on the fly while debugging.

  • To execute SQL queries, prepend them with the ! symbol:

    • Example: !SELECT * FROM YOUR_TABLE_NAME will show the data from YOUR_TABLE_NAME.

  • You can also use TARGITDB commands like IMPORT, SAVE, etc., within this window:

    • Example: IMPORT [my_data] = [CSV].{SELECT * FROM [C:\temp.csv]} to import a table.

  • The immediate window is useful for performing quick tests or interacting with the database directly during the debug process.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.