snowflake.snowpark.DataFrame.first¶
- DataFrame.first(n: Optional[int] = None, *, statement_params: Optional[Dict[str, str]] = None, block: bool = True, _emit_ast: bool = True) Union[Row, None, List[Row]] [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/dataframe.py#L4812-L4875)¶
- DataFrame.first(n: Optional[int] = None, *, statement_params: Optional[Dict[str, str]] = None, block: bool = False, _emit_ast: bool = True) AsyncJob
Executes the query representing this DataFrame and returns the first
n
rows of the results.- Parameters:
n – The number of rows to return.
statement_params – Dictionary of statement level parameters to be set while executing this action.
block – A bool value indicating whether this function will wait until the result is available. When it is
False
, this function executes the underlying queries of the dataframe asynchronously and returns anAsyncJob
.
- Returns:
A list of the first
n
Row
objects ifn
is notNone
. Ifn
is negative or larger than the number of rows in the result, returns all rows in the results.n
isNone
, it returns the firstRow
of results, orNone
if it does not exist.