1. 程式人生 > >IMPORT FROM 表資料匯入

IMPORT FROM 表資料匯入

TABLE LOCK Can be used for faster data loading for column store tables. 可以加快列儲存表資料的匯入

It is recommended to specify this option carefully as it incurs table locks in exclusive mode as well as explicit hard merges and savepoints after data loading is finished. The performance gain from this option can vary according to the table constraints (like primary key) and optimization of other layers (like persistency or DML command).

NO TYPE CHECK Specifies that the record will be inserted without checking the type of each field. 匯入時不檢查欄位型別 SKIP FIRST <number_of_rows_to_skip> ROW <number_of_rows_to_skip> ::= <unsigned_integer> Skips the specified number of rows in the import file. 指定跳過多少行後開始匯入,比如有表頭時 COLUMN LIST IN FIRST ROW
Indicates that the column list is stored in the first row of the CSV import file. 第一行做為COLUMN LIST選項的值,這樣就可以使用COLUMN LIST IN FIRST ROW選項替代了COLUMN LIST選項(COLUMN LIST選項見下面) COLUMN LIST ( <column_name_list> ) <column_name_list> ::= <column_name> [{, <column_name>}...] The column list for the data being imported. The name list has one or more column names. The ordering of the column names has to match the order of the column data in the CSV file and the columns in the target table. 指定CSV檔案裡的資料列將要儲存到表中的哪些列中,因為有時CSV裡提借的列數比表實際列數要少,或者CSV裡的第一列要儲存到表裡的第三列,等...為了解決這些列數不配以及儲存的位置不配時,需要通過這個選項來實現,請看後面的示例 RECORD DELIMITED BY <string_for_record_delimiter>
::= <string_literal>
The record delimiter used in the CSV file being imported. 行與行的分隔符 FIELD DELIMITED BY <string_for_field_delimiter> ::= <string_literal> The field delimiter of the CSV file. 欄位分隔符 OPTIONALLY ENCLOSED BY <character_for_optional_enclosure> ::= <character_literal> The optional enclosure character used to delimit field data. 字元(串)使用什麼引起來 DATE FORMAT <string_for_date_format> ::= <string_literal> The format that date strings are encoded with in the import data: 指定日期格式
  • Y : year
  • MM : month
  • MON : name of month
  • DD : day
For example:
  • 'YYYYMMDD' = 20120520
  • 'YYYY-MM-DD' = 2012-05-20
  • 'YYYY-MON-DD' : 2012-MAY-20
TIME FORMAT <string_for_time_format> ::= <string_literal> The format that time strings are encoded with in the import data: 指定時間格式
  • HH24 : hour
  • MI : minute
  • SS : second
For example:
  • 'HH24MISS' : 143025
  • 'HH24:MI:SS' : 14:30:25
TIMESTAMP FORMAT <string_for_timestamp_format> ::= <string_literal>
The format that timestamp strings are encoded with in the import data.  指定日期時間格式 For example:
  • 'YYYY-MM-DD HH24:MI:SS' : 2012-05-20 14:30:25
ERROR LOG <file_path_of_error_log> ::= <string_literal>

When specified, a log file of errors generated is stored in this file. Please ensure the file path you use is writeable by the database.

指定錯誤日誌檔案(含路徑)

FAIL ON INVALID DATA When specified, the IMPORT FROM command fails unless all the entries import successfully. 遇到無效資料會立即停止IMPORT FROM命令 <with_schema_flexibility> ::= WITH SCHEMA FLEXIBILITY The option WITH SCHEMA FLEXIBILITY will create missing columns in flexible tables during CSV imports, as specified in the header (first row) of the CSV file or column list. By default, missing columns in flexible tables are not created automatically during data imports. 根據CSV裡的表頭行(第一行,使用COLUMN LIST IN FIRST ROW選項指定)或者是COLUMN LIST 選項中提供的列名來建立缺失的列,具體示例請參考後面示例。注:該選項是用在CREATE COLUMN TABLE...語句後面