Added a description to the ZPM package
This is an example on how to import CSV data to any table using SQL.
The related article is on Developer Community
Make sure you have git and Docker desktop installed.
Clone/git pull the repo into any local directory
$ git clone https://github.com/intersystems-community/objectscript-docker-template.git
Open the terminal in a cloned folder and run the container with InterSystems IRIS:
$ docker-compose up -d
Open IRIS terminal and run
USER>zpm "install import-csv-update-sql"
In this example we use Countries dataset and GNP dataset to change the GNP column in Countries dataset. we will import GNP CSV with csvgen and then run the SQL update query that will change the data in dc_data.Country class/table for the GNP values from GNP class generated from CSV. And then we delete GNP class.
Open IRIS terminal:
$ docker-compose exec iris iris session iris
USER>
USER>zw ##class(evshvarov.csv.sqlupdate).ImportDataset()
...
[dataset-countries] Activate SUCCESS
USER>zw ##class(evshvarov.csv.sqlupdate).ShowGNP()
Country Angola gnp=6648
USER>zw ##class(evshvarov.csv.sqlupdate).ImportCSV()
Records imported: 266
USER>zw ##class(evshvarov.csv.sqlupdate).UpdateGNP()
Changes to GNP are made from dc.data.GNP
USER>zw ##class(evshvarov.csv.sqlupdate).ShowGNP()
Country Angola gnp=5734.9857372283895529
USER>zw ##class(evshvarov.csv.sqlupdate).DropGNP()
dc.data.DNP class is deleted.
Or you can run all the process with RunAll() method:
zw ##class(evshvarov.csv.sqlupdate).RunAll()
Added a description to the ZPM package
import csv to table