@@ -34,26 +34,22 @@ def __init__(
3434 parquet_filter : pc .Expression | None = None ,
3535 dataframe_filter : Callable [[pl .DataFrame ], pl .DataFrame ] | None = None ,
3636 ) -> None :
37- """Validate start_date and end_date and assign properties if so ."""
37+ """Validate start_date and end_date and assign properties if valid ."""
3838 HyperJob .__init__ (
3939 self ,
4040 hyper_file_name = remote_output_location .prefix .rsplit ("/" )[- 1 ].replace (".parquet" , ".hyper" ),
4141 remote_parquet_path = remote_output_location .s3_uri ,
4242 lamp_version = remote_output_location .version ,
4343 project_name = tableau_project_name ,
4444 )
45- if end_date is not None :
46- assert isinstance (start_date , date )
47- elif isinstance (start_date , int ):
48- end_date = date .today ()
49- start_date = end_date - timedelta (days = start_date )
5045
5146 self .remote_input_location = remote_input_location
5247 self .remote_output_location = remote_output_location
5348 self .processed_schema = processed_schema # expected output schema passed in
5449 self .partition_template = partition_template
5550
5651 if start_date is not None and end_date is not None :
52+ assert isinstance (start_date , date )
5753 assert start_date <= end_date
5854
5955 self .start_date = start_date
@@ -87,6 +83,10 @@ def create_tableau_parquet(self, partition_template: str) -> bool:
8783 -------
8884 True if parquet created, False otherwise
8985 """
86+ if isinstance (self .start_date , int ):
87+ self .end_date = date .today ()
88+ self .start_date = self .end_date - timedelta (days = self .start_date )
89+
9090 if self .start_date is not None and self .end_date is not None :
9191 # limitation of filtered hyper only does whole days.
9292 # update to allow start/end set by hour, to get the entire
0 commit comments