You are viewing documentation about an older version (1.2.0). View latest version

snowflake.snowpark.AsyncJob.result

AsyncJob.result(result_type: Literal['row', 'row_iterator', 'pandas', 'pandas_batches', 'no_result'] | None = None) List[Row] | Iterator[Row] | pandas.DataFrame | Iterator[pandas.DataFrame] | int | snowflake.snowpark.MergeResult | snowflake.snowpark.UpdateResult | snowflake.snowpark.DeleteResult | None[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 AsyncJob instance. For example, if this instance is returned by DataFrame.collect_nowait(), you will get a list of Row s from this method.

Parameters:

result_type

(Experimental) specifies the data type of returned query results. Currently it only supports the following return data types:

  • ”row”: returns a list of Row objects, which is the same as the return type of DataFrame.collect().

  • ”row_iterator”: returns an iterator of Row objects, which is the same as the return type of DataFrame.to_local_iterator().

  • ”row”: returns a pandas.DataFrame, which is the same as the return type of DataFrame.to_pandas().

  • ”pandas_batches”: returns an iterator of pandas.DataFrame s, which is the same as the return type of DataFrame.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 AsyncJob by Session.create_async_job() and retrieve results with this method, result_type should be specified to determine the result data type. Otherwise, it will return a list of Row objects by default. When you create an AsyncJob by action methods in DataFrame and other classes, result_type is 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.