Question & Answer
Question
What is a named pipe and how do I use one to load a table?
Answer
A pipe is a mechanism for two processes to communicate with each other. Consider the following command:
ls | grep x
When bash examines the command line, it finds the vertical bar character | that separates the two commands, the pipe character. Bash and other shells run both commands, connecting the output of the first to the input of the second. The ls command produces a list of files in the current directory and then the grep command reads the output of ls and prints only those lines containing the letter x. This is an example of an 'unnamed pipe'.
Many users use 'named pipes' for loading tables with the nzload command. To do this you must create a named pipe.
1. To create the named pipe on a Netezza system running linux, you can use the mkfifo command to create a zero length file named mypipe as shown below:
[nz@cs8025]$ mkfifo mypipe
[nz@cs8025]$ ls -la mypipe
prw-rw-r-- 1 nz nz 0 Jul 6 16:29 mypipe
The p indicates that this file is a pipe.
2. Next, start the load and use the pipe created in the previous step as the data file:
[nz@cs8025]$ nzload -db prodbd1 -t my_table -delim "|" -df /export/home/nz/mypipe
3. The last step is to populate the pipe with the appropriate data. The example below uses the cat command and directs its output to the pipe that we created in Step 1.
cat /export/home/nz/my_table.dat > mypipe
The nzload utility will begin loading data as soon as the first record is written to the pipe and will end when EOF is received.
Historical Number
NZ745487
Was this topic helpful?
Document Information
More support for:
IBM PureData System
Software version:
1.0.0
Document number:
461199
Modified date:
17 October 2019
UID
swg21568817