Skip to main content
Version: 1.2.1

FileDataAsset

class great_expectations.datasource.fluent.data_asset.path.file_asset.FileDataAsset(*, name: <pydantic.v1.fields.DeferredType object at 0x7fc29381dc10>, type: <pydantic.v1.fields.DeferredType object at 0x7fc29381dcd0>, id: <pydantic.v1.fields.DeferredType object at 0x7fc29381dd90> = None, order_by: <pydantic.v1.fields.DeferredType object at 0x7fc29381de80> = None, batch_metadata: <pydantic.v1.fields.DeferredType object at 0x7fc29381e000> = None, batch_definitions: <pydantic.v1.fields.DeferredType object at 0x7fc29381e1b0> = None, connect_options: <pydantic.v1.fields.DeferredType object at 0x7fc29381e270> = None, **extra_data: typing.Any)#

Base class for PathDataAssets which batch by applying a regex to file names.

add_batch_definition_daily(name: str, regex: Union[re.Pattern, str], sort_ascending: bool = True) BatchDefinition#

Add a BatchDefinition which defines daily batches by file name.

Parameters
  • name – BatchDefinition name

  • regex – Regular Expression used to define batches by file name. Must contain the groups year, month, and day.

  • sort_ascending – determine order in which batches are returned

Raises
  • RegexMissingRequiredGroupsError – regex is missing the groups year, month, and/or day.

  • RegexUnknownGroupsError – regex has groups other than year, month, and/or day.

add_batch_definition_monthly(name: str, regex: Union[re.Pattern, str], sort_ascending: bool = True) BatchDefinition#

Add a BatchDefinition which defines monthly batches by file name.

Parameters
  • name – BatchDefinition name

  • regex – Regular Expression used to define batches by file name. Must contain the groups year and month.

  • sort_ascending – determine order in which batches are returned

Raises
  • RegexMissingRequiredGroupsError – regex is missing the groups year and/or month.

  • RegexUnknownGroupsError – regex has groups other than year and/or month.

add_batch_definition_path(name: str, path: PathStr) BatchDefinition#

Add a BatchDefinition which matches a single Path.

Parameters
  • name – BatchDefinition name

  • path – File path relative to the Asset

Raises
  • PathNotFoundError – path cannot be resolved

  • AmbiguousPathError – path matches more than one file

add_batch_definition_yearly(name: str, regex: Union[re.Pattern, str], sort_ascending: bool = True) BatchDefinition#

Add a BatchDefinition which defines yearly batches by file name.

Parameters
  • name – BatchDefinition name

  • regex – Regular Expression used to define batches by file name. Must contain a single group year

  • sort_ascending – determine order in which batches are returned

Raises
  • RegexMissingRequiredGroupsError – regex is missing the group year

  • RegexUnknownGroupsError – regex has groups other than year

delete_batch_definition(name: str) None#

Delete a batch definition.

Parameters

name (str) – Name of the BatchDefinition to delete.

get_batch_definition(name: str) great_expectations.core.batch_definition.BatchDefinition#

Get a batch definition.

Parameters

name (str) – Name of the BatchDefinition to get.

Raises

KeyError – If the BatchDefinition does not exist.