@@ -46,9 +46,10 @@ struct Cli {
4646 #[ arg( long, default_value = "" ) ]
4747 source_prefix : String ,
4848
49- /// S3 key prefix for target (rehydrated) data
49+ /// Base S3 key prefix for target (rehydrated) data.
50+ /// A random suffix is appended automatically to create a unique destination per run.
5051 #[ arg( long, default_value = "" ) ]
51- target_prefix : String ,
52+ target_base_prefix : String ,
5253
5354 /// AWS region
5455 #[ arg( long) ]
@@ -88,9 +89,15 @@ impl Cli {
8889 }
8990
9091 fn target_config ( & self ) -> TargetConfig {
92+ let run_suffix = uuid:: Uuid :: new_v4 ( ) . to_string ( ) ;
93+ let prefix = if self . target_base_prefix . is_empty ( ) {
94+ run_suffix
95+ } else {
96+ format ! ( "{}/{run_suffix}" , self . target_base_prefix)
97+ } ;
9198 TargetConfig {
9299 bucket : self . bucket . clone ( ) ,
93- prefix : self . target_prefix . clone ( ) ,
100+ prefix,
94101 region : self . region . clone ( ) ,
95102 endpoint : self . endpoint . clone ( ) ,
96103 }
@@ -117,7 +124,7 @@ async fn main() -> anyhow::Result<()> {
117124 dataset = %cli. dataset,
118125 bucket = %cli. bucket,
119126 source_prefix = %cli. source_prefix,
120- target_prefix = %cli. target_prefix ,
127+ target_base_prefix = %cli. target_base_prefix ,
121128 scale_factor = cli. scale_factor,
122129 num_steps = cli. num_steps,
123130 "Starting ETL pipeline"
0 commit comments