

Error message/stack trace: Any other details that can be helpful: the test code works when all parameters are hardcoded. Note: These steps work regardless of your data format. Test the cross-account access between RoleA and RoleB. Create RoleB, an IAM role in the Amazon Redshift account with permissions to assume RoleA. Of course, this workaround assumes that no other parameters would be bound outside of the UNLOAD's query inside the ( ). Expected behaviour: An unload is executed successfully when a parameterized expression is used. / Questions / Redshift UNLOAD parquet file size Redshift UNLOAD parquet file size 0 My customer has a 2 - 4 nodes of dc2.8 xlarge Redshift cluster and they want to export data to parquet in the optimal size (1GB) per file with option (MAXFILESIZE AS 1GB). Create RoleA, an IAM role in the Amazon S3 account.

With this update, Redshift now supports COPY from six file formats: AVRO, CSV, JSON, Parquet, ORC and TXT. Apache Parquet and ORC are columnar data formats that allow users to store their data more efficiently and cost-effectively. Subsequently, if the sub-query executed successfully without any errors or exceptions, we could assume that the sub-query is safe, thus allowing us to wrap the sub-query back into the UNLOAD parent statement, but this time replacing the bind parameters with actual user-supplied parameters (simply concatenating them), which have now been validated in the previously run SELECT query. You can now COPY Apache Parquet and Apache ORC file formats from Amazon S3 to your Amazon Redshift cluster. This would let us use Redshift's prepared statement support (which is indeed supported for SELECT queries) to bind and validate the potentially risky, user-supplied parameters first. While trying to devise a workaround for this, a colleague of mine has thought up a workaround: instead of binding the parameters into the UNLOAD query itself (which is not supported by Redshift), we could simply bind them to the inner sub-query inside the UNLOAD's ( ) first (which happens to be a SELECT query - which is probably the most common subquery used within UNLOAD statements by most Redshift users, I'd say) and run this sub-query first, perhaps with a LIMIT 1 or 1=0 condition, to limit its running time. UNLOAD uses the MPP capabilities of your Amazon Redshift cluster and is faster than retrieving a large amount of data to the client side.

You can unload data into Amazon Simple Storage Service (Amazon S3) either using CSV or Parquet format. Not all options are guaranteed to work as some options might conflict. extraunloadoptions: No: N/A: Extra options to append to the Redshift UNLOAD command. Valid options are Parquet and Text, which specifies to unload query results in the pipe-delimited text format. The Parquet format is up to 2x faster to unload and consumes up to 6x less storage in Amazon S3, compared to text formats. unloads3format: No: Parquet: The format with which to unload query results. Thanks for your quick reply, and thanks for re-raising this issue with the Redshift server team. If you’re fetching a large amount of data, using UNLOAD is recommended. You can now unload the result of an Amazon Redshift query to your Amazon S3 data lake as Apache Parquet, an efficient open columnar storage format for analytics.
