snowflake.snowpark.AsyncJob.result¶
- AsyncJob.result(result_type: Optional[Literal['row', 'row_iterator', 'pandas', 'pandas_batches', 'no_result']] = None) Optional[Union[List[Row], Iterator[Row], DataFrame, Iterator[DataFrame], int, MergeResult, UpdateResult, DeleteResult]][source]¶
Blocks and waits until the query associated with this instance finishes, then returns query results. This acts like executing query in a synchronous way. The data type of returned query results is determined by how you create this
AsyncJobinstance. For example, if this instance is returned byDataFrame.collect_nowait(), you will get a list ofRows from this method.- Parameters:
result_type –
Specifies the data type of returned query results. Currently it only supports the following return data types:
”row”: returns a list of
Rowobjects, which is the same as the return type ofDataFrame.collect().”row_iterator”: returns an iterator of
Rowobjects, which is the same as the return type ofDataFrame.to_local_iterator().”row”: returns a
pandas.DataFrame, which is the same as the return type ofDataFrame.to_pandas().”pandas_batches”: returns an iterator of
pandas.DataFrames, which is the same as the return type ofDataFrame.to_pandas_batches().”no_result”: returns
None. You can use this option when you intend to execute the query but don’t care about query results (the client will not fetch results either).
When you create an
AsyncJobbySession.create_async_job()and retrieve results with this method,result_typeshould be specified to determine the result data type. Otherwise, it will return a list ofRowobjects by default. When you create anAsyncJobby action methods inDataFrameand other classes,result_typeis optional and it will return results with corresponding type. If you still provide a value for it, this value will overwrite the original result data type.