Skip to main content
Version: 1.2.2

Batch

class great_expectations.datasource.fluent.interfaces.Batch(datasource: Datasource, data_asset: DataAsset, batch_request: BatchRequest, data: BatchData, batch_markers: BatchMarkers, batch_spec: BatchSpec, batch_definition: LegacyBatchDefinition, metadata: Dict[str, Any] | None = None)#

This represents a batch of data.

This is usually not the data itself but a hook to the data on an external datastore such as a spark or a sql database. An exception exists for pandas or any in-memory datastore.

columns() List[str]#

Return column names of this Batch.

Returns

List[str]

head(n_rows: pydantic.v1.types.StrictInt = 5, fetch_all: pydantic.v1.types.StrictBool = False) great_expectations.datasource.fluent.interfaces.HeadData#

Return the first n rows of this Batch.

This method returns the first n rows for the Batch based on position.

For negative values of n_rows, this method returns all rows except the last n rows.

If n_rows is larger than the number of rows, this method returns all rows.

Parameters

n_rows: The number of rows to return from the Batch. fetch_all: If True, ignore n_rows and return the entire Batch.

Returns

HeadData

validate(expect: Expectation, *, result_format: ResultFormatUnion = 'DEFAULT_RESULT_FORMAT', expectation_parameters: Optional[SuiteParameterDict] = 'None') ExpectationValidationResult#

validate(expect: ExpectationSuite, *, result_format: ResultFormatUnion = 'DEFAULT_RESULT_FORMAT', expectation_parameters: Optional[SuiteParameterDict] = 'None') ExpectationSuiteValidationResult