Hy,我知道已经有很多问题已经提出来,但这有点不同。 我有包含数百万条记录的csv文件。我尝试了以下命令从csv复制到我的表,即
copy "client_data" from '/home/mike/Desktop/client_data.txt' with delimiter ',' CSV;
但问题是因为csv中的数据是不一致的状态,即
以下几行会有魅力
12/12/12 20:17:35,304000000,"123","1"
12/12/12 20:17:36,311000000,"123","2"
12/12/12 20:17:36,814000000,"123","2"
12/12/12 20:17:36,814000000,"123","2"
12/12/12 20:17:37,317000000,"123",".1"
12/12/12 20:17:38,863000000,"123","TS"
12/12/12 20:17:39,835000000,"123","2"
12/12/12 20:17:40,337000000,"123","1"
但数百行就像
12/12/12 20:20:03,790000000,"123","1
{'""}__{""'} /""'\
( $AMZA./)@FRIDI
{__}""'{__} /) (\. ,,DON,,"
12/12/12 20:20:30,501000000,"123","INAM NIKALTA NHE HE KITNE SAWALO K JAWB DAY
/G\A\,':/\,':/S\K,':\"
12/12/12 20:22:55,928000000,"123","PAKISTAN KI BUNYAAD
2=QUAID-E-AZAM"
12/12/12 20:22:56,431000000,"123","QUIED E AZAM
MOHAMMAD ALI JINNAH
[KFK FEROZ]"
由于换行符,逗号,无效字符等而无法解析 有没有办法解析这些并以有效的方式加载postgres表中的数据?
下面是表格结构
create table "client_data" (
date_stamp text,
points bigint,
msisdn character varying(13),
data text
)
with (OIDS = false);
alter table "client_data" owner to postgres;
答案 0 :(得分:0)
是否使用MySql导入选项,因为MySql具有更复杂且相对容易导入数据的导入方法。