Skip to main content
Version: 1.0 prerelease

TableAsset

class great_expectations.datasource.fluent.sql_datasource.TableAsset(*, name: str, type: Literal['table'] = 'table', id: Optional[uuid.UUID] = None, order_by: List[great_expectations.datasource.fluent.interfaces.Sorter] = None, batch_metadata: Dict[str, Any] = None, batch_definitions: List[great_expectations.core.batch_definition.BatchDefinition] = None, table_name: str = '', schema_name: Optional[str] = None)#

add_batch_definition(name: str, partitioner: Optional[Partitioner] = None, batching_regex: Optional[re.Pattern] = None) BatchDefinition#

Add a BatchDefinition to this DataAsset. BatchDefinition names must be unique within a DataAsset.

If the DataAsset is tied to a DataContext, the BatchDefinition will be persisted.

Parameters:
  • name (str) – Name of the new batch definition.

  • partitioner – Optional Partitioner to partition this BatchDefinition

  • batching_regex – A Regular Expression used to build batches in path based Assets.

Returns:

The new batch definition.

Return type:

BatchDefinition

add_batch_definition_daily(name: str, column: str, sort_ascending: bool = True) BatchDefinition#

add_batch_definition_monthly(name: str, column: str, sort_ascending: bool = True) BatchDefinition#

add_batch_definition_whole_table(name: str) BatchDefinition#

add_batch_definition_yearly(name: str, column: str, sort_ascending: bool = True) BatchDefinition#

build_batch_request(options: Optional[BatchParameters] = None, batch_slice: Optional[BatchSlice] = None, partitioner: Optional[Partitioner] = None, batching_regex: Optional[re.Pattern] = None) BatchRequest#

A batch request that can be used to obtain batches for this DataAsset.

Parameters:
  • options – A dict that can be used to filter the batch groups returned from the asset. The dict structure depends on the asset type. The available keys for dict can be obtained by calling batch_parameters.

  • batch_slice – A python slice that can be used to limit the sorted batches by index. e.g. batch_slice = “[-5:]” will request only the last 5 batches after the options filter is applied.

  • partitioner – A Partitioner used to narrow the data returned from the asset.

  • batching_regex – Parameter batching_regex is not supported by this Asset type and must be None.

Returns:

A BatchRequest object that can be used to obtain a batch list from a Datasource by calling the get_batch_list_from_batch_request method.

delete_batch_definition(batch_definition: great_expectations.core.batch_definition.BatchDefinition) None#

Delete a batch definition.

Parameters:

batch_definition (BatchDefinition) – BatchDefinition to delete.