The Load Data utility it is an excellent tool to load data from CSV/TXT files into an IRIS SQL Table, but it is required send the target file to the IRIS server and write the Load Data sentence to ingest the file content. Now it is possible select a file in VSCode, set the table destination and submit the request. The vscode-load-data utility will send the file to the IRIS server and run the Load Data command to you! Very simple:
.png)
Install the vscode-load-data extension
1. Download the extension: https://github.com/yurimarx/vscode-load-data/raw/refs/heads/main/intersystems-load-data/intersystems-load-data-0.0.1.vsix
2. Open any InterSystems IRIS project using Docker container.
3. Go to Extensions (Crtl + Shift + X): .png)
4. Click the top ... button:
.png)
5. Select the option Install from VSIX:
.png)
6. Check on your Docker desktop the name of your IRIS Container (for my sample is iris-cdc-sample-iris-1):
.png)
7. Open your .vscode/settings.json file and add the following lines at end of file:
"irisImporter.containerName": "iris-cdc-sample-iris-1",
"irisImporter.namespace": "USER"
Final result (for me is iris-cdc-sample-iris-1 and namespace USER):
.png)
8. Create a CSV/TXT file into your VSCode project:
.png)
My content sample:
PersonName,PersonAge,PersonGender
Liam Johnson,25,Male
Olivia Smith,34,Female
Noah Williams,19,Male
Emma Brown,42,Female
Oliver Jones,56,Male
Ava Garcia,29,Female
Elijah Miller,31,Male
Sophia Davis,22,Female
James Rodriguez,45,Male
Isabella Martinez,67,Female
William Hernandez,38,Male
Mia Lopez,24,Female
Benjamin Gonzalez,51,Male
Charlotte Wilson,33,Female
Lucas Anderson,27,Male
Amelia Thomas,20,Female
Henry Taylor,48,Male
Harper Moore,26,Female
Alexander Jackson,39,Male
Evelyn Martin,60,Female
9. Make sure you have a Docker container running
10. Make sure you have a text or CSV file to import and a destination table in IRIS. The header names in the file and the column names in the table must be the same.
11. For this sample, if you don't have the SQL Table yet, create it:
create table dc_cdc.SamplePerson (
PersonName VARCHAR(200),
PersonAge INT,
PersonGender VARCHAR(10)
)
12. Click right your CSV File and select Import to IRIS Docker Container:
.png)
13. Fill the SQL Table that will receive the data (my case is dc_cdc.SamplePerson):
.png)
14. Click the button Load data
15. The terminal show to you the results:
.png)
16. Use SQL explorer to check the results:
.png)
17. Enjoy your new extension!