UNIBASE

ubbatch: How to batch load data into a Unibase file

NAME

ubbatch – batch load data into a table

SYNOPSIS

ubbatch -[0 A D P* Y* a*-array* b -body* c d e* f* -head* -join* n# o q s -tail* u] <table>

DESCRIPTION

ubbatch batch loads data into UNIBASE files.

You pass records for import to ubbatch‘s standard input by piping data or by redirecting input.

ubbatch supports a number of input formats: records, csv, and Unibase A format.

Each input record is normally in the same format as the record stored in the UNIBASE table. This means that expressions and unions must not be part of the input record.

Records comprise lines of text, and line feeds delineate each one. Each field’s width aligns with the specification in the Data Dictionary.

Some of the command line options allow for different data formats.

FLAGS

FLAGARGUMENTTYPEDESCRIPTION
-0  Use attribute/value format but don’t pad with zeroes

This format is identical to the -A format below, except it does not pad sequence numbers or counters with zeros, and does not initialize boolean fields.
-A  Use attribute/value format

IIn this format, each attribute (field) in a record occupies a separate line. The format divides each line into two parts. The first part, ending with a comma, identifies the attribute name; the second identifies the attribute value. The format sets missing attributes to their default values.


Each record is terminated by a line starting with “>”.

-D  Alternate Date Format

This option allows for the alternative date format CCYYMMDD.

Normally, all dates are expected to be in the format DD.MM.CCYY (or DD/MM/CCYY). Using this option reads dates in the alternate format.
-PpipetextNamed Pipe Input

ubbatch will read its input from the name pipe “pipe”.


To operate in this mode, ubbatch becomes a daemon and continuously reads the named pipe. You must manually terminate the process by killing it. The named pipe must exist before you invoke ubbatch; ubbatch does not create the pipe if it doesn’t exist.

-YdictionarytextUse alternative data dictionary

ubbatch will use dictionary instead of the normal data dictionary.

-aformattextPrint record format as each record is loaded

This is a standard record format. eg

[customerId] - [customer]

As each record is loaded this format is printed.

Note: If new records get a new sequence number, the new sequence number will be printed if requested.

Using this option will suppress other reporting formats such as the record count.
–arrayformattextFormat out for new records as an array
Before any outout “[” is printed
After all new records “]” is printed
In between each new record the optional “–join” format is printed
-b  CSV format.

This option allows ubbatch to read CSV dump formats.

This format presents each record as a single line of ASCII text. It separates fields with commas and encloses text and date fields in double quotes (") while leaving numbers unenclosed.

e.g “FRED SMITH”,”10 JOHN ST”,”TOWN”,49,3.72

–bodyformattextSpecify this as the format for echoing output with every new record.
-c  Count Only

Only print the total record count. This option suppresses the normal “Records Processed” message and instead prints a single number showing the total records processed.

This switch is ineffective if the ‘-s’ switch is also used.
-d  Debug

This option gives a debug output.

As ubbatch reads the Data Dictionary, it echoes each line to the screen. This output helps you observe and correct errors at the exact point they occur.
-efiletextError Log File

When records fail to write because of an error, ubbatch normally directs these records to /dev/null.

With this option they are saved in “file”.
-fseparatortextInput Record Field (Attribute) Separator.

Instead of fixed-length input records, this option allows variable-length records. A field separator delimits each field; in the example below, this is the character “:“.

ubbatch -f : stock < stock.txt

–headformattextFormat to echo before any new records
–joinformattextFormat to add after each new record when array format chosen
-nnumbernumberRecords Processed Interval

Print record count every number records instead of default 10.

-o  Standard Output

This flag directs ubbatch to write records to standard output instead of the table.

This is most useful when used as a part of a pipeline. eg


echo "x,a" | ubbatch -A -o table

The -o option will always sets the quiet flag (-q).

The record on standard output appears exactly as ubbatch stores it, with dates in CCYYMMDD order.

-q  Quiet Mode

When you provide this flag, ubbatch does not write any output.
-s  Allocate Sequence Numbers

This option causes ubbatch to allocate new sequence numbers when it adds records to the file.

As ubbatch runs, it normally outputs a message every 10 records:

Records processed: 10

When you specify the -s option, ubbatch prints each sequence number as it generates it.

–tailformattextPrint format after all new records
-uIgnore duplicate records

Normally, ubbatch records an error if a record contains a duplicate key value when the Data Dictionary specifies a unique key for that table.

Using this flag, ubbatch will act as if it inserted the record successfully.

Verified by MonsterInsights