You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+112-5Lines changed: 112 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,8 @@ Once the **kdb VS Code extension** is installed **KX** appears in the Activity B
62
62
-[Workbooks](#workbooks)
63
63
-[Query History](#query-history)
64
64
65
+
**Note** Customized authentication has been implemented for the kdb VS Code extension, allowing you to add custom logic when authenticating with kdb. Refer to [customized authentication](https://github.com/KxSystems/kx-vscode-auth) for details on how to set this up.
66
+
65
67
### Installing q
66
68
67
69
After you install **kdb VS Code extension**, if q is not already installed the extension provides a seamless integration with q, by displaying a notification with an option to download, register and install [kdb Insights Personal Edition](https://kx.com/kdb-insights-personal-edition-license-download/). For details on the other versions available see [here](#versions-available).
@@ -79,8 +81,6 @@ After you install **kdb VS Code extension**, if q is not already installed the e
79
81
80
82
Once registered you will receive an email with you license details. The base64 encoded license string can be found in the welcome email received after registration, under the download link for the license file.
With your license details to hand, you can link this to VS Code by either choosing **Paste license string** or **Select license file** from your PC. The latter method is recommended for new users.
> **kdb Insights Enterprise** requires a commercial license. Please contact licadmin@kx.com for further information.
@@ -218,7 +218,7 @@ If you close the extension, the connection also closes.
218
218
219
219
#### Meta
220
220
221
-
When connected **Insights** connections can be expanded to show the details returned by the [getMeta API](https://code.kx.com/draft/insights/api/database/query/get-meta.html) call, which provides information on the database schemas and all the analytics available.
221
+
When connected **Insights** connections can be expanded to show the details returned by the [getMeta API](https://code.kx.com/insights/api/database/query/get-meta.html) call, which provides information on the database schemas and all the analytics available.
222
222
223
223

224
224
@@ -490,7 +490,92 @@ To create a data source and run it against a specific connection:
490
490
491
491
In addition to [API queries](https://code.kx.com/insights/api/database/query/get-data.html), if the query environment is enabled on the deployed instance of **kdb Insights Enterprise**, qSQL and SQL queries can be used within a data source with the appropriate parameterization. If qSQL or SQL is required and issues occur trying to run these queries contact a kdb Insights Enterprise administrator for assistance.
492
492
493
-
### Populate scratchpad
493
+
### API queries
494
+
495
+
The getData API provides a method of querying a table using a defined set of parameters. These parameters can be configured through the getData form available in the VSCode extension.
496
+
497
+
Refer to the [`getData` API](https://code.kx.com/insights/api/database/query/get-data.html) documentation for more information and a full list of available parameters.
498
+
499
+
### QSQL queries
500
+
501
+
The `.com_kx_edi.qsql` API is a QSQL query builder that assembles QSQL queries based on a q expression. It is a developer tool that allows running freeform q code against a specific database tier.
502
+
503
+
This function runs an QSQL query.
504
+
505
+
```
506
+
.com_kx_edi.qsql[args]
507
+
```
508
+
509
+
**Note**: Along with the query itself, you must also specify the target database and tier.
510
+
511
+
Refer to the [QSQL documentation](https://code.kx.com/insights/api/database/query/qsql.html) for more details.
512
+
513
+
**Warning!** Starting with kdb Insights Enterprise version 1.13, QSQL queries and populating QSQL only work if the Query Environment (QE) is enabled. Ensure you have enabled QEs to use QSQL; they are disabled by default in kdb VS Code. Refer to [Query Environments](https://code.kx.com/insights/enterprise/configuration/base.html#query-environments) for more details.
514
+
515
+
### SQL queries
516
+
517
+
The `.com_kx_edi.sql` SQL API allows running freeform SQL queries. Each query is distributed across all available databases. The results are then aggregated and returned as a single dataset.
518
+
519
+
This function runs an SQL query.
520
+
521
+
```
522
+
.com_kx_edi.sql[query]
523
+
```
524
+
525
+
Refer to the [SQL documentation](https://code.kx.com/insights/api/database/query/sql.html) for more details.
526
+
527
+
### UDA queries
528
+
529
+
User-Defined Analytics (UDAs), also known as custom APIs, are essential for developers to leverage the capabilities of kdb when using Insights Enterprise. These UDAs are deployed to Insights through the Data Access Processes (DAPs) and Aggregators (Aggs).
530
+
531
+
UDAs can be called directly within the VSCode extension through the UDA tab in a data source. This provides a form-based approach to populating the UDA parameters. UDAs can also be called within the Insights Enterprise web interface using Pipelines, Queries, and Views.
532
+
533
+

534
+
535
+
When interacting with UDAs, parameter fields are shown for configuration. Note the following:
536
+
537
+
- Required fields are marked with an asterisk (*).
538
+
539
+
- Optional fields are not required but may be displayed in your results, even if they are empty.
540
+
541
+
You can add new parameters by clicking **Add Parameter**. Both optional and distinguished parameters can be added as needed.
542
+
543
+

544
+
545
+
**Important!** A UDA cannot be queried if one or more parameters are invalid.
546
+
547
+
If you attempt to run a UDA with invalid parameters, an error occurs and a pop-up message appears to alert you to the issue.
548
+
549
+

550
+
551
+

552
+
553
+
In some cases, you can successfully query UDAs without any parameters, as seen in the screenshot below.
554
+
555
+

556
+
557
+
However, you can still modify the parameter list to add parameters by clicking **Add parameter** or deleting parameters using the recycle bin icon.
For more information on User-Defined Analytics, refer to the [UDAs documentation](https://code.kx.com/insights/api/database/uda/uda-overview-introduction.html).
562
+
563
+
### Run and populate scratchpad
564
+
565
+
Running and populating scratchpad are two actions used to execute q code, allowing you to run queries and perform operations on your kdb Insights Enterprise database but they differ in how and where the output is stored and accessed.
566
+
567
+
The [QSQL API](#qsql-queries) is designed to run queries against a specific Insights database and tier. However, sometimes you might need to run more flexible or freeform queries against a wider set of data. For this purpose each Insights Enterprise user is assigned a 'scratchpad' q process. This scratchpad is separate from the dedicated query processes, allowing you to run freeform code without impacting the overall system.
568
+
569
+
You can populate variables in your scratchpad with the results from your queries, and then perform freeform manipulations on those variables.
570
+
571
+
After you configure a data source in the VSCode extension you have two options for executing it:
572
+
573
+
-**Run** executes your query directly against the relevant API (getData, QSQL, SQL, or UDA) and displays the results in the extension
574
+
-**Populate Scratchpad** executes your query through the scratchpad, which passes it to the relevant API, assigns the results to a variable of your choosing in your scratchpad process and then displays them in the VSCode extension
575
+
576
+
For more details on populating scratchpad, refer to the [populate scratchpad](#populate-scratchpad) section below.
577
+
578
+
#### Populate scratchpad
494
579
495
580
You can use a data source to populate a scratchpad process running in a **kdb Insights Enterprise** instance with a dataset. This allows you to then execute q or python code against the data stored in that variable in the scratchpad. This facilitates the generation of complex APIs and pipelines within VS Code and kdb Insights Enterprise.
496
581
@@ -508,6 +593,26 @@ To do this:
508
593
509
594
1. Use a [Workbook](#workbooks) to execute q or Python code against the data in your scratchpad using the variable you provided.
510
595
596
+
### Reset scratchpad
597
+
598
+
The **Reset Scratchpad** option in kdb VS Code allows you to delete all the data from a connected instance and restart your development from scratch.
599
+
600
+
There are several ways to reset the scratchpad:
601
+
602
+
1. Right click on the appropriate connection on the left-hand side and select **Reset Scratchpad**. The connection can be either active or idle but it must be connected.
603
+
604
+

605
+
606
+
This displays a dialog box at the bottom right corner asking you to confirm your action.
607
+
608
+

609
+
610
+
2. Using the **Command Palette** in VSCode, start typing **Reset Scratchpad** and click on the option as it shows. This action resets the scratchpad for the active connection.
611
+
612
+

613
+
614
+
3. Use the [MacOS or Windows shortcuts](#shortcuts) in the q file or in the workbook. Note that running the shortcuts in the q file resets the scratchpad for the active connection, while running them in the workbook resets the scratchpad for the connection chosen in the workbook.
615
+
511
616
## Workbooks
512
617
513
618
Workbooks provide a convenient way to prototype and execute q and python code against a q process and using the variables [populated into the scratchpad](#populate-scratchpad) of a **kdb Insights Enterprise** deployment by data sources.
@@ -755,6 +860,7 @@ The following setting will change double click behaviour to select the whole ide
755
860
| Ctrl + Shift + D | Execute entire file |
756
861
| Ctrl + Shift + R | Run q file in new q instance |
757
862
| Ctrl + Shift + Y | Toggle paramater cache for lambda |
863
+
| Ctrl + Shift + Delete | Reset scratchpad |
758
864
759
865
### For MacOS
760
866
@@ -768,3 +874,4 @@ The following setting will change double click behaviour to select the whole ide
768
874
| ⌘ + Shift + D | Execute entire file |
769
875
| ⌘ + Shift + R | Run q file in new q instance |
770
876
| ⌘ + Shift + Y | Toggle paramater cache for lambda |
0 commit comments