Hi,
I have an issue with csv export (dump) for a query result in vertica.
i.e. for a column string containing comma is splitting into another column for which data is mismatching
example :
(Required OutPut)
_____________________________
ID NAME SALARY
-- ------ ------
1 AK,Nayak 100000
(Actual Output)
_____________________________
ID NAME SALARY
-- ---- ------
1 AK Nayak 100000
Commands Used for export to csv through commandline :
--------------------------------------------------------------------
/opt/vertica/bin/vsql -w <password> -P footer=off -F$',' -A -o "/home/dbadmin/test.csv" -c "SELECT * from Table LIMIT 100 ;"
Please someone help me in getting the required csv file with quoted identifier .
Thanks
Ajit Kumar Nayak
ajit.nayak@vichara.com
vsql Export to CSV from commandline
Moderator: NorbertKrupa
-
- Newbie
- Posts: 15
- Joined: Tue May 14, 2013 1:25 pm
Re: vsql Export to CSV from commandline
Hi!
[DELETED]
[DELETED]
Last edited by id10t on Wed May 06, 2015 5:09 pm, edited 1 time in total.
-
- Newbie
- Posts: 15
- Joined: Tue May 14, 2013 1:25 pm
Re: vsql Export to CSV from commandline
Thanks for Reply.
I checked with the command you have given , But I found '-o' command in my commandline arguments is generatiing the wrong file.
If I am redirecting the output to a location ,then the file is OK.
e.g .
/opt/vertica/bin/vsql -w <pwd> -F$'","' -P footer=off -A -c "Select * from Ajit" | sed 's/^\|$/"/g' > /home/dbadmin/test.csv
But in -o command the data is like below :
id","name","salary
1","Ak Nayak","10000
2","Daniel Leybovich","500
How can I make it work with ' -o ' command , Please suggest.
Thanks
Ajit
I checked with the command you have given , But I found '-o' command in my commandline arguments is generatiing the wrong file.
If I am redirecting the output to a location ,then the file is OK.
e.g .
/opt/vertica/bin/vsql -w <pwd> -F$'","' -P footer=off -A -c "Select * from Ajit" | sed 's/^\|$/"/g' > /home/dbadmin/test.csv
But in -o command the data is like below :
id","name","salary
1","Ak Nayak","10000
2","Daniel Leybovich","500
How can I make it work with ' -o ' command , Please suggest.
Thanks
Ajit