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.
fetch_all
If True, ignore n_rows and return the entire 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.
result_format
The format to return the validation results in.
expectation_parameters
A dictionary of parameters values for any expectations using parameterized values (the $PARAMETER syntax). The keys are the parameter names and the values are the values to be used for this validation run.
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
columns() → List[str]
head
head(
n_rows: pydantic.v1.types.StrictInt = 5,
fetch_all: pydantic.v1.types.StrictBool = False
) → great_expectations.datasource.fluent.interfaces.HeadData
validate
validate(
expect: Expectation,
*,
result_format: ResultFormatUnion = 'DEFAULT_RESULT_FORMAT',
expectation_parameters: Optional[SuiteParameterDict] = 'None'
) → ExpectationValidationResult
validate
validate(
expect: ExpectationSuite,
*,
result_format: ResultFormatUnion = 'DEFAULT_RESULT_FORMAT',
expectation_parameters: Optional[SuiteParameterDict] = 'None'
) → ExpectationSuiteValidationResult