Saa17
Saa17

Reputation: 265

Phoenix Exporting CSV File

I’m quite new to HBase and Phoenix. I’m trying to export some data to a csv file. Tried this and seems to work.

!outputformat csv
!record /data.csv
select * from “data”;
!record

My question is where did this csv file export to? I did not get any errors exporting the query above, but I can not seem to find the file itself.

Upvotes: 0

Views: 1536

Answers (1)

Ali Can
Ali Can

Reputation: 574

Probably your data.csv file has been generated in root directory of your machine, since your file starts with /. Normally, path prefix would be the location where you started the phoenix-sqlline shell. (And actually path is logged in sqlline just before starting to record)

For example:


## Started sqlline in /tmp/alicana directory

0: jdbc:phoenix:> !record data.csv
Saving all output to "/tmp/alicana/data.csv". Enter "record" with no arguments to stop it.

0: jdbc:phoenix:> !record ../alicana-data.csv
Saving all output to "/tmp/alicana/../alicana-data.csv". Enter "record" with no arguments to stop it.

## When sqlline started in (~) user home 
0: jdbc:phoenix:> !record data.csv
Saving all output to "/home/alicana/data.csv". Enter "record" with no arguments to stop it.

## Official sqlline documentation
0: jdbc:oracle:thin:@localhost:1521:mydb> !record /tmp/mysession.out
Saving all output to "/tmp/mysession.out". Enter "record" with no arguments to stop it.


Upvotes: 1

Related Questions