phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Reid <gabriel.r...@gmail.com>
Subject Re: How to change default field delimiter from COMMA to SEMICOLON
Date Thu, 09 Oct 2014 07:17:21 GMT
Hi,

You've got the usage of the command correct there, but the semi-colon
character has a special meaning in most shells. Wrapping it with
single quotes should resolve the issue, as follows:

    ./psql.py z1:/hbase -t NATION ../sample/NATION.csv -d ';'


- Gabriel


On Thu, Oct 9, 2014 at 5:26 AM, Arthur.hk.chan@gmail.com
<arthur.hk.chan@gmail.com> wrote:
> 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
>
>
>

Mime
View raw message