Zymonic Toolkit System

From Zymonic
Revision as of 13:06, 27 May 2020 by Jbree (talk | contribs) (Tidied article to make parameters clearer.)

Synchronize_csv

Command general info

This is a new toolkit command which replaces “upload_csv” called “synchronize_csv”. New command can be used to relatively quickly: insert, update, update/insert and delete records in a Zymonic table based on a csv. Usage is as follows.


Usage


sudo zymonic_toolkit.pl System synchronize_csv [parameters below]

Required Parameters
Parameter Name Parameter Description
system System the destination table is in
table_zname ZName of destination table to be altered
field_sequence Comma delimited list of field znames in the order the data appears in the csv
csv_path File path to the csv file with the data
username Username for the systems GUI
zpass Corresponding password for the username
Optional Parameters
Parameter Name Parameter Description
state State to set the inserted records to for the GUI. Most likely should be the state saved records are set to.
keyfields Comma delimited list of fields to be used to match existing records in the table when updating/deleting. May be primary key, or a list of fields which combined are unique. Not needed for Insert.
delete_others Defaults to no. If set to “yes”, will set records from the table which aren’t in the csv file as deleted.
update_type Defaults to “Insert”. Mode to run the command in options:
  • Insert - insert records from the csv as long as they pass validation
  • Update – update records in the table matching the csv based on the keyfields supplied
  • UpdateOrInsert – updates matching records, inserts others
  • Delete – delete records in table matching csv
batch_size Defaults to 100. Varies the size batch that the code passes the data through in internally only changes performance, 100 was found to be a good number.