@@ -95,32 +95,46 @@ def from_environment_catalog_mapping(
9595 return cls (** construction_kwargs )
9696
9797
98- class Environment (EnvironmentNamingInfo ):
99- """Represents an isolated environment.
100-
101- Environments are isolated workspaces that hold pointers to physical tables.
98+ class EnvironmentSummary (PydanticModel ):
99+ """Represents summary information of an isolated environment.
102100
103101 Args:
104- snapshots : The snapshots that are part of this environment.
102+ name : The name of the environment.
105103 start_at: The start time of the environment.
106104 end_at: The end time of the environment.
107105 plan_id: The ID of the plan that last updated this environment.
108106 previous_plan_id: The ID of the previous plan that updated this environment.
109107 expiration_ts: The timestamp when this environment will expire.
110108 finalized_ts: The timestamp when this environment was finalized.
111- promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment
112- (i.e. for which the views are created). If not specified, all snapshots are promoted.
113- previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized.
114- requirements: A mapping of library versions for all the snapshots in this environment.
115109 """
116110
117- snapshots_ : t . List [ t . Any ] = Field ( alias = "snapshots" )
111+ name : str
118112 start_at : TimeLike
119113 end_at : t .Optional [TimeLike ] = None
120114 plan_id : str
121115 previous_plan_id : t .Optional [str ] = None
122116 expiration_ts : t .Optional [int ] = None
123117 finalized_ts : t .Optional [int ] = None
118+
119+ @property
120+ def expired (self ) -> bool :
121+ return self .expiration_ts is not None and self .expiration_ts <= now_timestamp ()
122+
123+
124+ class Environment (EnvironmentNamingInfo , EnvironmentSummary ):
125+ """Represents an isolated environment.
126+
127+ Environments are isolated workspaces that hold pointers to physical tables.
128+
129+ Args:
130+ snapshots: The snapshots that are part of this environment.
131+ promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment
132+ (i.e. for which the views are created). If not specified, all snapshots are promoted.
133+ previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized.
134+ requirements: A mapping of library versions for all the snapshots in this environment.
135+ """
136+
137+ snapshots_ : t .List [t .Any ] = Field (alias = "snapshots" )
124138 promoted_snapshot_ids_ : t .Optional [t .List [t .Any ]] = Field (
125139 default = None , alias = "promoted_snapshot_ids"
126140 )
@@ -203,8 +217,16 @@ def naming_info(self) -> EnvironmentNamingInfo:
203217 )
204218
205219 @property
206- def expired (self ) -> bool :
207- return self .expiration_ts is not None and self .expiration_ts <= now_timestamp ()
220+ def summary (self ) -> EnvironmentSummary :
221+ return EnvironmentSummary (
222+ name = self .name ,
223+ start_at = self .start_at ,
224+ end_at = self .end_at ,
225+ plan_id = self .plan_id ,
226+ previous_plan_id = self .previous_plan_id ,
227+ expiration_ts = self .expiration_ts ,
228+ finalized_ts = self .finalized_ts ,
229+ )
208230
209231 def _convert_list_to_models_and_store (
210232 self , field : str , type_ : t .Type [PydanticType ]
0 commit comments