13

I'm quite new to HBase and Phoenix.

But is there a way I can dump/export data to a text file? It would be highly appreciable if I can specify the field terminator, such as ',', '|>' etc.

Thanks.

dehiker
  • 424
  • 1
  • 7
  • 18

3 Answers3

26

Another Solution.
After connecting to phoenix with sqlline.py:

  1. !outputformat csv
  2. !record data.csv
  3. select * from system.catalog limit 10;
  4. !record
  5. !quit
IgorekPotworek
  • 1,267
  • 11
  • 32
  • This seems good except that my output file includes the message "Saving all output to..." and at the end of the select "3 rows selected". Is there a way to get it *only* output the stuff i want? or to skip system messages or something? – mr rogers Sep 02 '16 at 18:28
  • 1
    I have successfully exported, but some numbers are formatted in scientific notation (1,003E+4) when it should simply be an integer (or long float). How do I export the original number not formated? – LuizAngioletti May 22 '18 at 20:27
  • Is there a way to avoid scientific notation? – Jaison May 28 '20 at 02:04
2

You can do it with Apache Pherf. Pherf arguments: -export Exports query results to CSV files in CSV_EXPORT directory

Ramin Darvishov
  • 1,024
  • 1
  • 13
  • 24
0

A workaround is to use sed once you have generated the dump. In my case, I wanted a \t de-limiter. However, the column values were of the form 'A','B','C','D' a simple s/','/'\t'/g did the trick for me.

Pratyay
  • 1,946
  • 1
  • 13
  • 14