@@ -2599,25 +2599,6 @@ def _snapshots(
25992599
26002600 return {name : stored_snapshots .get (s .snapshot_id , s ) for name , s in snapshots .items ()}
26012601
2602- def _get_target_environment (self , environment : t .Optional [str ] = None ) -> t .Tuple [str , str ]:
2603- environment = environment or self .config .default_target_environment
2604- environment = Environment .sanitize_name (environment )
2605-
2606- initial_environment = environment
2607-
2608- if self .config .plan .always_compare_against_prod :
2609- prod = self .state_reader .get_environment (c .PROD )
2610- if prod :
2611- logger .warning (
2612- f"Comparing against production environment instead of { environment } . Note that this may lead to "
2613- "additional backfills as accumulated changes are still pushed to the target environment."
2614- )
2615- environment = c .PROD
2616- else :
2617- environment = environment or c .PROD
2618-
2619- return environment .lower (), initial_environment .lower ()
2620-
26212602 def _context_diff (
26222603 self ,
26232604 environment : str ,
@@ -2627,13 +2608,13 @@ def _context_diff(
26272608 ensure_finalized_snapshots : bool = False ,
26282609 diff_rendered : bool = False ,
26292610 ) -> ContextDiff :
2630- target_environment , initial_environment = self . _get_target_environment (environment )
2611+ environment = Environment . sanitize_name (environment )
26312612
26322613 if force_no_diff :
26332614 return ContextDiff .create_no_diff (environment , self .state_reader )
26342615
26352616 return ContextDiff .create (
2636- environment = target_environment ,
2617+ environment = environment ,
26372618 snapshots = snapshots or self .snapshots ,
26382619 create_from = create_from or c .PROD ,
26392620 state_reader = self .state_reader ,
@@ -2644,7 +2625,7 @@ def _context_diff(
26442625 environment_statements = self ._environment_statements ,
26452626 gateway_managed_virtual_layer = self .config .gateway_managed_virtual_layer ,
26462627 infer_python_dependencies = self .config .infer_python_dependencies ,
2647- initial_environment = initial_environment ,
2628+ always_compare_against_prod = self . config . plan . always_compare_against_prod ,
26482629 )
26492630
26502631 def _destroy (self ) -> None :
0 commit comments