Using load scripts

You can write and run a load script for the COPY statement using a simple text-delimited file format.

You can write and run a load script for the COPY statement using a simple text-delimited file format. For information about other load formats see Data formats.OpenText™ Analytics Database recommends that you load the smaller tables before the largest tables. To check data formats before loading, see Handling Non-UTF-8 input.

To define a data pipeline to automatically load new files, see Automatic load.

Using absolute paths in a load script

Unless you are using the COPY FROM LOCAL statement, using COPY on a remote client requires an absolute path for a data file. You cannot use relative paths on a remote client. For a load script, you can use vsql variables to specify the locations of data files relative to your Linux working directory.

To use vsql variables to specify data file locations:

  1. Create a vsql variable containing your Linux current directory.

    \set t_pwd `pwd`
    
  2. Create another vsql variable that uses a path relative to the Linux current directory variable for a specific data file.

    \set input_file '\'':t_pwd'/Date_Dimension.tbl\''
    
  3. Use the second variable in the COPY statement:

    => COPY Date_Dimension FROM :input_file DELIMITER '|';
    
  4. Repeat steps 2 and 3 to load all data files.

Running a load script

You can run a load script on any host, as long as the data files are on that host.

  1. Change your Linux working directory to the location of the data files.

    $ cd /opt/vertica/doc/retail_example_database
    
  2. Run the Administration Tools.

    $ /opt/vertica/bin/admintools
    
  3. Connect to the database.

  4. Run the load script.