Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…_expectations into m/v1-251/email_action
  • Loading branch information
cdkini committed Apr 9, 2024
2 parents b61c207 + 2e7469c commit 0080e12
Show file tree
Hide file tree
Showing 197 changed files with 984 additions and 5 deletions.
6 changes: 5 additions & 1 deletion great_expectations/core/batch_definition.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import re
from typing import TYPE_CHECKING, Optional

from great_expectations.compatibility import pydantic
Expand All @@ -26,6 +27,7 @@ class BatchDefinition(pydantic.BaseModel):
id: Optional[str] = None
name: str
partitioner: Optional[Partitioner] = None
batching_regex: Optional[re.Pattern] = None

# private attributes that must be set immediately after instantiation
_data_asset: DataAsset = pydantic.PrivateAttr()
Expand All @@ -43,7 +45,9 @@ def build_batch_request(
) -> BatchRequest:
"""Build a BatchRequest from the asset and batch request options."""
return self.data_asset.build_batch_request(
options=batch_request_options, partitioner=self.partitioner
options=batch_request_options,
partitioner=self.partitioner,
batching_regex=self.batching_regex,
)

def save(self) -> None:
Expand Down
1 change: 1 addition & 0 deletions great_expectations/datasource/fluent/batch_request.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class BatchRequest(pydantic.BaseModel):
options: Optional[BatchRequestOptions] = None,
batch_slice: Optional[BatchSlice] = None,
partitioner: Optional[Partitioner] = None,
batching_regex: Optional[re.Pattern] = None,
) -> None: ...
@property
def batch_slice(self) -> slice: ...
Expand Down
4 changes: 4 additions & 0 deletions great_expectations/datasource/fluent/file_path_data_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import copy
import logging
import re
import warnings
from collections import Counter
from pprint import pformat as pf
Expand Down Expand Up @@ -179,6 +180,7 @@ def build_batch_request(
options: Optional[BatchRequestOptions] = 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.
Expand All @@ -189,6 +191,7 @@ def build_batch_request(
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: A Regular Expression used to build batches in path based Assets.
Returns:
A BatchRequest object that can be used to obtain a batch list from a Datasource by calling the
Expand Down Expand Up @@ -229,6 +232,7 @@ def build_batch_request(
options=options or {},
batch_slice=batch_slice,
partitioner=partitioner,
batching_regex=batching_regex,
)

@override
Expand Down
3 changes: 3 additions & 0 deletions great_expectations/datasource/fluent/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dataclasses
import functools
import logging
import re
import uuid
import warnings
from pprint import pformat as pf
Expand Down Expand Up @@ -218,6 +219,7 @@ def build_batch_request(
options: Optional[BatchRequestOptions] = 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.
Expand All @@ -228,6 +230,7 @@ def build_batch_request(
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: A Regular Expression used to build batches in path based Assets.
Returns:
A BatchRequest object that can be used to obtain a batch list from a Datasource by calling the
Expand Down
1 change: 1 addition & 0 deletions great_expectations/datasource/fluent/invalid_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def build_batch_request(
options: dict | None = None,
batch_slice: Any = None,
partitioner: Any = None,
batching_regex: Any = None,
) -> NoReturn:
self._raise_type_error()

Expand Down
13 changes: 12 additions & 1 deletion great_expectations/datasource/fluent/pandas_datasource.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import logging
import re
import sqlite3
import uuid
from pprint import pformat as pf
Expand Down Expand Up @@ -177,13 +178,15 @@ def build_batch_request(
options: Optional[BatchRequestOptions] = 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.
Args:
options: This is not currently supported and must be {}/None for this data asset.
batch_slice: This is not currently supported and must be None for this data asset.
partitioner: This is not currently supported and must be None for this data asset.
batching_regex: A Regular Expression used to build batches in path based Assets.
Returns:
A BatchRequest object that can be used to obtain a batch list from a Datasource by calling the
Expand All @@ -208,6 +211,7 @@ def build_batch_request(
datasource_name=self.datasource.name,
data_asset_name=self.name,
options={},
batching_regex=batching_regex,
)

@override
Expand Down Expand Up @@ -383,12 +387,13 @@ def _get_reader_options_include(self) -> set[str]:
version="0.16.15",
)
@override
def build_batch_request( # type: ignore[override]
def build_batch_request( # type: ignore[override] # noqa: PLR0913
self,
dataframe: Optional[pd.DataFrame] = None,
options: Optional[BatchRequestOptions] = 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.
Expand All @@ -397,6 +402,7 @@ def build_batch_request( # type: ignore[override]
options: This is not currently supported and must be {}/None for this data asset.
batch_slice: This is not currently supported and must be None for this data asset.
partitioner: This is not currently supported and must be None for this data asset.
batching_regex: This is currently not supported and must be None for this data asset.
Returns:
A BatchRequest object that can be used to obtain a batch list from a Datasource by calling the
Expand All @@ -417,6 +423,11 @@ def build_batch_request( # type: ignore[override]
"partitioner is not currently supported and must be None for this DataAsset."
)

if batching_regex is not None:
raise ValueError( # noqa: TRY003
"batching_regex is not currently supported and must be None for this DataAsset."
)

if dataframe is None:
df = self.dataframe
else:
Expand Down
2 changes: 2 additions & 0 deletions great_expectations/datasource/fluent/pandas_datasource.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import sqlite3
import typing
from logging import Logger
Expand Down Expand Up @@ -78,6 +79,7 @@ class _PandasDataAsset(DataAsset):
options: Optional[BatchRequestOptions] = ...,
batch_slice: Optional[BatchSlice] = ...,
partitioner: Optional[Partitioner] = ...,
batching_regex: Optional[re.Pattern] = ...,
) -> BatchRequest: ...
@override
def _validate_batch_request(self, batch_request: BatchRequest) -> None: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
},
"batch_slice": {
"title": "Batch Slice",
"anyOf": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
5 changes: 5 additions & 0 deletions great_expectations/datasource/fluent/schemas/Datasource.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@
"$ref": "#/definitions/PartitionerConvertedDatetime"
}
]
},
"batching_regex": {
"title": "Batching Regex",
"type": "string",
"format": "regex"
}
},
"required": [
Expand Down

0 comments on commit 0080e12

Please sign in to comment.