Zymonic Toolkit System

From Zymonic

This page contains all of the options for:

sudo zymonic_toolkit.pl System

See the manual page for the system toolkit for further details.

Synchronize CSV[edit]

This 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.

sudo zymonic_toolkit.pl System synchronize_csv [PARAMETERS]

Example[edit]

Command to run:

sudo zymonic_toolkit.pl System synchronize_csv --system test_system --table_zname zz_countrylist --field_sequence "country,alpha2code,alpha3code,countrycode,countryintdial,currencycode" --update_type "UpdateOrInsert" --username admin --zpass ! --csv_path "/tmp/country.csv"

Data in `/tmp/country.csv`:

United Kingdom of Great Britain and Northern Ireland,GB,GBR,826,44,GBP

Parameters[edit]

Parameter Name Parameter Description
Required Parameters
system The name of the sub-directory in which the system's definition is stored.
table_zname ZName of the table to be imported into.
field_sequence Comma seperated sequence of ZNames in the order they are represented in the csv file.
username The username of the user (defaults to admin).
Optional Parameters
csv_path Path to the csv to be used.
csv_string CSV data a comma delimited string, new lines with \n. CSV file will be created in tmp and then read.
zpass The password of the user to run tests as, use ! to enter at run time.
state ZName of the state to save the records in. Records edited in the GUI will then open a process in this state.
blank_is_undef Set to false to have blank values in the csv sent through as empty string, overwriting default values.
update_type Defaults to “Insert”. You can select the type of update to do from the types described below this table.
keyfields Unique field(s) used to identify records to update/delete. Not needed for Insert.
delete_others Flag to delete records in the destination table not found in the csv. Defaults to no.
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.
multiple_records_mode When there are duplicate records matched but duplicates are not allowed, keep the newest records "n" or the oldest "o".
allow_duplicate_records Allow the update of duplicate records. If false, duplicates will be deleted according to multiple_records_mode option.
hard_delete Set to true to remove deleted records from the database. If this option is not set any records, to be deleted, will be marked as deleted: Y in the database.
process_zname ZName of the process to associate with the uploaded records, this will then be the process opened when editing the record in the GUI. Defaults to the default process of the table.

Update Types[edit]

Insert[edit]

Insert any data from the csv file into the specified table including any duplicates. Data should be in the same order as the field sequence specified, keyfields are ignored.

Update[edit]

Update any matching data from the csv file in the specified table. Data should be in the same order as the field sequence specified, keyfields are used in combination to identify the correct records. By default duplicate records in the table will be set as deleted. No action will be taken if the records aren't found in the table.

Delete[edit]

Delete any records from the csv file in the specified table. Data should be in the same order as the field sequence specified, keyfields are used in combination to identify the correct records. Option hard_delete can be used to remove the records from the table completely instead of just marking them as deleted in the DB.

UpdateOrInsert[edit]

Update any matching data from the csv file in the specified table, and insert non-matching records. Data should be in the same order as the field sequence specified, keyfields are used in combination to identify the correct records. By default duplicate records in the table will be set as deleted.

InsertIfNotFound[edit]

Insert any data from the csv file into the specified table unless the data is already in the table. Data should be in the same order as the field sequence specified, keyfields are used in combination to identify the correct records.


Get System Option[edit]

This command returns the value of a system option for a given system and option name.

sudo zymonic_toolkit.pl System get_sys_opt [PARAMETERS]

Example[edit]

sudo zymonic_toolkit.pl System get_sys_opt --system test_system --option filter_report_max_results