Batch
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.
Return column names of this Batch.
Returns
Type Description List[str]
list of column names.
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
Name Description n_rows
The number of rows to return from the Batch.
Returns
Type Description great_expectations.datasource.fluent.interfaces.HeadData
HeadData
Validate the Batch using the provided Expectation or Expectation Suite.
Parameters
Name Description expect
The Expectation or Expectation Suite to validate.
Returns
Type Description ExpectationSuiteValidationResult
An ExpectationValidationResult or ExpectationSuiteValidationResult object.
Raises
Type Description ValueError
If the expect argument is not an Expectation or an ExpectationSuite.
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)
Methods
columns() → List[str]
head(n_rows: pydantic.v1.types.StrictInt = 5, fetch_all: pydantic.v1.types.StrictBool = False) → great_expectations.datasource.fluent.interfaces.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