关于加载的配置参数都是使用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