Scratchpad Overview¶
This page introduces the Scratchpad, a private q and Python environment for querying data, analyzing results, and developing code in kdb Insights Enterprise.
The Scratchpad is a temporary q process, running in its own container, that is assigned to each user. Use it to write q or Python code, query your databases, and inspect the results without affecting production workloads.
You can access your Scratchpad from the Scratchpad panel in the Query window, and from the kdb VS Code extension. All of these connect to the same process, so a variable or function you define in one is available in the others. This includes any Query windows you have open at the same time. Queries you build in the Query panel also run through your Scratchpad, which is why their results appear in the Scratchpad output panel, and why the Scratchpad Reset and Cancel buttons apply to them.
Variables and functions you create in your Scratchpad are visible only to you, and persist until your Scratchpad session ends. Because the same process is also used to run pipeline tests, you can use it to prototype and debug logic before deploying it.
Why use the Scratchpad¶
- Explore data quickly. Query a database, then analyze the result in q or Python, in the same place.
- Develop and test code safely. Try out analytics, Stream Processor pipelines, and custom code in an isolated process.
- Use the languages and libraries you know. Run q or Python, mix the two with PyKX (the KX Python library for q), and use the machine learning and data science libraries provided with the Scratchpad.
- Work in your own tools. Connect to your Scratchpad from the kdb VS Code extension and share variables with the Query window.
Get started¶
- Open the Query window: click + on the ribbon menu and select Query.
- If the Scratchpad panel isn't visible, click View and toggle Scratchpad Panel.
- Select the q or Python tab in the Scratchpad panel, and enter some code. For example, enter
til 10in q. - Click Run All. The result appears in the Console tab of the output panel.
What you can do¶
- Scratchpad panel: run ad hoc queries and code in the web interface, or connect from VS Code.
- Scratchpad Query APIs: query your databases from q or Python code.
- Developing in the Scratchpad: write q and Python, install libraries and modules, and prototype pipelines.
- Scratchpad output: view results as a console, table, or chart.
- Manage your Scratchpad: resources, restarts, and permissions. For canceling queries and setting timeouts, see Cancel, reset, and timeouts.