關於加載的配置參數都是使用comand filehtml
LOAD CSV
FROM 'GeoLiteCity-Blocks.csv' WITH ENCODING iso-646-us
HAVING FIELDS
(
startIpNum, endIpNum, locId
)
INTO postgresql://user@localhost:54393/dbname
TARGET TABLE geolite.blocks
TARGET COLUMNS
(
iprange ip4r using (ip-range startIpNum endIpNum),
locId
)
WITH truncate,
skip header = 2,
fields optionally enclosed by '"',
fields escaped by backslash-quote,
fields terminated by '\t'
SET work_mem to '32 MB', maintenance_work_mem to '64 MB';
指定文件名從何處加載數據,接受encoding 選項
文件名能夠用單引號擴起來,能夠是如下特殊值之一:git
[ ALL FILENAMES | [ FIRST ] FILENAME ]
MATCHING regexp
[ IN DIRECTORY '...' ]
該FROM選項還支持可選的逗號分隔的列表字段 描述什麼是預計在名稱CSV數據文件,經過可選的HAVING FIELDS
每一個字段名只能是一個名稱,也能夠是後面帶有該字段的特定讀卡器選項的名稱,用方括號括起來,每一個字段讀卡器
選項支持逗號分隔。sql
- YYYY, YYY, YY for the year part
- MM for the numeric month part
- DD for the numeric day part
- HH, HH12, HH24 for the hour part
- am, AM, a.m., A.M.
- pm, PM, p.m., P.M.
- MI for the minutes part
- SS for the seconds part
- MS for the milliseconds part (4 digits)
- US for the microseconds part (6 digits)
- unparsed punctuation signs: - . * # @ T / and space
一個簡單的demopost
column-name [date format 'YYYY-MM-DD HH24-MI-SS.US']
TRUNCATE
create index
ALTER TABLE … DISABLE TRIGGER ALL
,數據 ALTER TABLE … ENABLE TRIGGER ALL
csv 加載的控制選項仍是不少的,也比較靈活spa
https://pgloader.readthedocs.io/en/latest/ref/csv.htmlpostgresql