tricoder
tricoder

Reputation: 95

How does unloading an empty table from redshift to s3 behaves?

If an empty table is unloaded from redshift to S3 using UNLOAD command, does it creates an empty file on S3 or does it not do anything.

Earlier (few days back ) I unloaded using unload command command, it placed a 0 byte file on s3. But today it is not doing anything (that is, there is no file placed on s3) but redshift is showing "UNLOAD completed, 0 record(s) unloaded successfully" message. Even using HEADER (to unload with headers) in the options of UNLOAD command is not showing any file on s3.

UNLOAD ($$ SELECT * FROM <table_name> $$) TO 
's3://<bucket_name>/abc/test1' 
iam_role '<iam_role>' ADDQUOTES HEADER ALLOWOVERWRITE DELIMITER AS ',' 
ESCAPE PARALLEL OFF

Upvotes: 2

Views: 2024

Answers (2)

tricoder
tricoder

Reputation: 95

As per AWS support, they have gone back to the old UNLOAD behavior of creating empty files when there is no data to be unloaded in Versions >= 1.0.10880. So redshift clusters having Versions >= 1.0.10880 have the fix and is available in all regions.

Upvotes: 1

Tian Tian
Tian Tian

Reputation: 1

Looks like the unload functionality changed since yesterday. Empty tables are not generating files while unloading.

Upvotes: 0

Related Questions