def _get_df(self) -> WorkflowDataFrame: if isinstance(self._df, Yielded): return self._workflow.df(self._df) if isinstance(self._df, WorkflowDataFrame): assert_or_throw( self._df.workflow is self._workflow, FugueSQLError(f"{self._key}, {self._df} is from another workflow"), ) return self._df return self._workflow.df(self._df)
def visitFugueDataFrameSource( self, ctx: fp.FugueDataFrameSourceContext ) -> WorkflowDataFrame: name = self.ctxToStr(ctx, delimit="") assert_or_throw(name in self.variables, FugueSQLError(f"{name} is not defined")) return self.variables[name]
def last(self) -> WorkflowDataFrame: if self._last is None: raise FugueSQLError("latest dataframe does not exist") return self._last
def __getitem__(self, key: str) -> WorkflowDataFrame: assert_or_throw(key in self._sql_vars, FugueSQLError(f"{key} not found")) return self._sql_vars[key]