Skip to content

Saving Load Options to a File

You can use the @file option to save a set of reusable format settings for a ybload operation. This feature facilitates reuse of options for parsing and processing source files. You cannot use @file to save and re-run an entire ybload specification.

To save and use an options file:

  1. Determine the set of formatting options that works to load a particular table.

  2. Check that these options are appropriate by loading the table once or by using the --dryrun option.

  3. Save the options to a text file in the same location as your source file (or a similar accessible location). For example:

$ more ybload_options_file
--date-style 
MDY
--trim-white 
--ignore-emptymarker-case
--y2base 
2000
--format 
TEXT
--delimiter
,
--linesep 
\n
--escape-char 
\
--skip-blank-lines
--on-missing-field 
SUPPLYNULL
--on-extra-field  
REMOVE

Note: The name of an option and its value must be on separate lines in the file. You can also include database connection options in the file.

  1. Run the ybload command with the @file option. For example:
$ ybload -d premdb @/home/yb100/premdata/season_load_options.txt 
-t season_date /home/yb100/premdata/season_dates.txt

You can set up different files to satisfy the requirements of different ybload operations for all of your tables. If needed, you can use more than one file in the same load operation:

ybload @file1 @file2 ...

Parent topic:Running a Bulk Load