tab_import.py

Given a tab-delimited sheet, creates new records of the specified Model into Pulsar LIMS or updates existing records if the patch option is provided. Array values should be comma-delimted as this program will split on the comma and add array literals. Array fields are only assumed when the field name has an ‘ids’ suffix.

usage: tab_import.py [-h] -m MODEL -i INFILE [-p] [--no-append] [--skip-dups]
                     [-u]

Named Arguments

-m, --model
The name of the model to import the records to, i.e. Biosample or CrisprModification.
-i, --infile
The tab-delimited input file containing records (1 per row). There must be a field-header line as the first row, and field names must match record attribute names. Any field names that start with a ‘#’ will be skipped. Any rows that start with a ‘#’ will also be skipped (apart from the header line).
-p, --patch
Presence of this option means to PATCH instead of POST. The input file must contain a column by the name of record_id to designate the existing record to PATCH. You can use a record’s primary ID or name as the identifier.

Default: False

--no-append
This option only has meaning when the –patch option is also specified. It’s presence indicates to not extend array values with the content to be patched when dealing with array data types. Thus, if you don’t want to overwrite the existing value for arrays, then skip this option.

Default: False

--skip-dups
If an attempt to POST a duplicate record is made, the server will respond with a ActiveRecord::RecordNotUnique exception. Including this flag indicates to catch this exception and skip on to the next record to POST.

Default: False

-u, --upstream-ids
 
If patching records and you are providing the record identidifers using the value of a records upstream_identifier attribute, set this to True.

Default: False