17.3.2 Importing table data in CSV format (when the column structure information file is specified)
This example imports table data under the following conditions:
-
Table data is imported for the first time into table TABLE01.
-
A B-tree index, text index, or range index is defined for TABLE01.
-
There are two input data files (in CSV format).
-
In the input data files, a single quotation mark (') is used as the enclosing character and a comma (,) is used as the delimiter.
-
The sort order and number of field data items in input data files do not match the order in which the columns appear and the number of column definitions in the table subject to import processing.
-
The input data might contain logical error data.
-
Any logical error data that is detected is corrected before the data is imported.
This example uses the following procedure for executing the adbimport command.
- Procedure
-
-
Create an input data path file.
-
Create an import option file.
-
Create a column structure information file.
-
Execute the adbimport command.
-
Using examples, the following subsections explain each of these steps.
- Organization of this subsection
(1) Creating an input data path file
This example creates an input data path file and specifies in it the paths of the two input data files.
- Example of an input data path file
-
/mnt/diska/wwwww/imp1.csv /mnt/diskb/xxxxx/imp2.csv
(2) Creating an import option file
This example creates an import option file that specifies import options.
- Example of an import option file
-
set adb_import_errdata_file_name = "/home/adbmanager/imp_file/errdata.csv" ...1 set adb_import_errdata_num = 500 ...2 set adb_import_rthd_num = 2 ...3 set adb_import_sort_buff_size = 2 :
- Explanation:
-
-
Specifies a logical error data file to which logical error data can be output.
-
Specifies the maximum number of logical error data items that can be output.
-
Specifies other performance-related import options.
-
(3) Creating a column structure information file
This example creates a column structure information file that specifies column structure information options.
- Example of column structure information file
-
adbcolumninfo -n C1 -r 2 adbcolumninfo -n C2 -r 3 adbcolumninfo -n C3 -r 1
- Explanation:
-
Specifies how to handle input data for each column (C1, C2, and C3) defined for the table to be processed.
For details about the specification patterns for column structure information options for each combination of contents of input data files and the column definition for the table to be processed, see (1) When the file format of the input data files is CSV in 17.2.5 Specification patterns for the column structure information options.
(4) Executing the adbimport command
adbimport -u ADBUSER01 ...1 -p '#HelloHADB_01' ...2 -k "'" ...3 -s , ...4 -g 10 ...5 -w /home/adbmanager/tmp ...6 -z /home/adbmanager/imp_file/env01.txt ...7 -r /home/adbmanager/imp_file/clm01.txt ...8 TABLE01 ...9 /home/adbmanager/imp_file/inf01.txt ...10
- Explanation:
-
-
Specifies the authorization identifier of the HADB user who executes the adbimport command.
-
Specifies the password for the authorization identifier that is specified in the -u option.
-
Specifies the enclosing character (single quotation mark) used in input data files. To specify a single quotation mark for the enclosing character, you must enclose the single quotation mark between double quotation marks (").
-
Specifies the delimiter (comma) used in input data files.
-
Specifies that a data import progress message (KFAA80205-I) is to be output after every 10,000 rows.
-
Specifies a directory for storing temporary work files that will be created during data import processing.
-
Specifies the absolute path name of the import option file created in (2) Creating an import option file.
-
Specifies the absolute path name of the column structure information file created in (3) Creating a column structure information file.
-
Specifies the table subject to import processing (TABLE01).
-
Specifies the absolute path name of the input data path file created in (1) Creating an input data path file.
-