phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dhaval Rami <dhavalr...@gmail.com>
Subject Re: SQL to export query result in a CSV file ?
Date Wed, 25 Feb 2015 18:54:26 GMT
Thanks Pariksheet.

On Wed, Feb 25, 2015 at 1:35 PM, Pariksheet Barapatre <pbarapatre@gmail.com>
wrote:

> Hi Dhaval,
>
> You can use below code -
> $SQLLINE $ZKEEPER <<END
> !outputformat csv
> !record $TMP_FILE
> select * from system.catalog limit 10;
> !record
> !quit
> END
>
> ## $SQLINE is sqlline.py path , $ZKEEPER - Zoo Keeper quorum , $TMP_FILE -
> output csv path
>
> Cheers
> Pari
>
> On 25 February 2015 at 21:25, Dhaval Rami <dhavalrami@gmail.com> wrote:
>
>> Is there a way I can do this from a shell script ? ( I want to automate a
>> report export )
>> Thanks,
>> Dhaval
>>
>> On Tue, Feb 24, 2015 at 10:16 PM, Dhaval Rami <dhavalrami@gmail.com>
>> wrote:
>>
>>> Thanks Vamsi.
>>>
>>> On Tue, Feb 24, 2015 at 5:02 PM, Vamsi Krishna <vamsi.attluri@gmail.com>
>>> wrote:
>>>
>>>> Using 'record' & 'outputformat' commands of sqlline.py you can save
>>>> data to csv file.
>>>>
>>>> After connecting to cluster using sqlline.py execute the following
>>>> commands:
>>>> 1. !outputformat csv
>>>> 2. !record data.csv
>>>> 3. select * from system.catalog limit 10;
>>>> 4. !record
>>>> 5. !quit
>>>>
>>>> You should see data.csv file with 10 records from system.catalog table
>>>> saved in the folder from which you executed sqlline.py.
>>>>
>>>> Thanks,
>>>> Vamsi Attluri.
>>>>
>>>> On Tue, Feb 24, 2015 at 1:32 PM, Dhaval Rami <dhavalrami@gmail.com>
>>>> wrote:
>>>>
>>>>> Is there any SQL statement which can enable me to save query results
>>>>> as CSV file on a local file system / hdfs ?
>>>>>
>>>>> Thanks,
>>>>> Dhaval
>>>>>
>>>>
>>>>
>>>
>>
>
>
> --
> Cheers,
> Pari
>

Mime
View raw message