I found 2 solutions:
Is there a way to give a file's the current date by only using Redshift, with no other services?
Here is my code so far:
unload
(
'select * from table'
)
to 's3://bucket/unload_test/test_123_{CurrentDate}.gz'
ACCESS_KEY_ID '12345678910'
SECRET_ACCESS_KEY '10987654321'
GZIP
PARALLEL off;
Just need to get CurrentDate to be 202106 for example.
Thanks!
I've never tried using UNLOAD
in a transaction, but if it works, you could use a procedure.