Maybe running a program to modify your CSV file to replace any SEMICOLON with 
COMMA shall be more convinient. 






 
From: arthur.hk.c...@gmail.com
Date: 2014-10-09 11:26
To: user
CC: arthur.hk.c...@gmail.com
Subject: How to change default field delimiter from COMMA to SEMICOLON
Hi, 

My CSV file uses semicolon as field delimiter, I tried to use -d ; but failed.  


1) without -d parameter
./psql.py z1:/hbase -t NATION ../sample/NATION.csv 
14/10/09 11:14:21 ERROR util.CSVCommonsLoader: Error upserting record 
[19;"SAUDI ARABIA";4;"fluffy close warthogs into the fluffy gifts kindle silent 
permanent sauternes-- decoys hang slowly into the sentiments! forges toward"]: 
java.lang.NumberFormatException: For input string: "19;"SAUDI ARABIA";4;"fluffy 
close warthogs into the fluffy gifts kindle silent permanent sauternes-- decoys 
hang slowly into the sentiments! forges toward""


2) with -d parameter
./psql.py z1:/hbase -t NATION ../sample/NATION.csv -d ; 

...
 -d,--delimiter <arg>          Field delimiter for CSV loader. A digit is
                               interpreted as 1 -> ctrl A, 2 -> ctrl B ...
                               9 -> ctrl I.
 -e,--escape-character <arg>   Escape character for CSV loader. A digit is
                               interpreted as a control character



CSV sample data:
0;"ARGENTINA";1;"ironic regular realms through the idly thin sauternes could 
eat boldly regular daring warthogs-- daringly idle somas could have to lo"
1;"BRAZIL";1;"silently quiet realms haggle boldly slow ruthless platelets? even 
i"
2;"CANADA";1;"fluffy pinto beans until the asymptotes doze slowly even 
epitaphs! doggedly busy excuses sublate carefully: quiet brave asymptotes boost 
sometimes on th"
9;"IRAN";4;"warthogs could poach even forges? bold bold attainments among the 
idly permanent warhorses are permanently in place of the bravely fu"
10;"IRAQ";4;"blithe excuses should have to believe; silent busy notornis print 
toward the slowly furious theodolites. even platelets serve bold ruthless 
tithes? shea"
11;"JAPAN";2;"dolphins can nag! enticingly bold warhorses will unwind never 
past the grouches; ironic quick s"


Q: How to change default field delimiter from COMMA to SEMICOLON in psql.py 
command line?

Regards
Arthur



Reply via email to