How To: Export Delimited File to S3

In Hive

=====

Use a command like:

For comma separated output (csv), an example:

insert overwrite directory 's3://<bucket>/path/to/target/'

row format delimited fields terminated by ','

select * from <table to export>;

NOTE: You cannot get the output directly under a bucket and it needs a subdirectory or subfolder. The subfolder or the subdirectory need not be manually created, just specify it and that will be created automatically

 

In Presto

=======

This will produce an output that is delimited by ^A (which is Hive default as well):

An example:

insert overwrite directory 's3://<bucket>/<complete-path-to-target-folder>/'
select ..

 

Note: If it is desired to output the results of SELECT query into an existing directory without deleting its contents, INSERT INTO query can be used instead. E.g.:

     insert into directory 's3://<bucket>/path/to/target/'

     select * from <table to export>;

Have more questions? Submit a request

Comments

  • Avatar
    Mainul Hassan

    What if user has read only access to the bucket. Will he be able to run insert overwrite command on a table that is created from that bucket?

Powered by Zendesk