def stage(self, feast_client: feast.sdk.client.Client): """ Stage the data to its remote location Args: feast_client: Returns: None """ if not self.require_staging: return ts_col = self.spec.schema.timestampColumn if ts_col != "": _convert_timestamp(self.df, ts_col) # staging is required but user does not provide staging location # importer will request on-demand upload URL from Feast Core if not self.remote_path: if self.spec.type.upper() != "FILE.CSV": raise ValueError( "Only type 'csv' is currently supported for using Importer without staging location" ) request = CoreServiceTypes.GetUploadUrlRequest( fileType=CoreServiceTypes.GetUploadUrlRequest.FileType.Value( "CSV")) response = feast_client._core_service_stub.GetUploadUrl(request) with tempfile.NamedTemporaryFile() as df_tempfile: self.df.to_csv(df_tempfile.name, index=False) requests.put(url=response.url, data=df_tempfile) self.spec.sourceOptions.update({"path": f"gs://{response.path}"}) else: df_to_gcs(self.df, self.remote_path)
def stage(self): """Stage the data to its remote location """ if not self.require_staging: return ts_col = self.spec.schema.timestampColumn _convert_timestamp(self.df, ts_col) df_to_gcs(self.df, self.remote_path)