I have some exported_data.csv, and I have some corresponding Redshift table, and I have a COPY:
COPY(
c1,
c2,
c3,
...
) from "s3://bucket/exported_data.csv"
What I want to do is add a column source_file to the table, and populate it with arbitrary information defined in the COPY statement (or some other set of statements); in this example, the name of the file the row came from.
I can't use UPDATE due to how much data I'm interacting with (takes just plain too long).
It doesn't look like I can just use DEFAULT, since I need to be able to change the information when the name of the source file is different, but Redshift doesn't let you change the default value of a column. (Otherwise, I'd just change the default val for the column, do the copy, change the default val, do the copy from the next CSV file...)
I'm exploring "staging tables", but figured I'd ask here if someone has a ready-made answer while I explore.