Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data asset name guard #85

Merged
merged 2 commits into from
Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions great_expectations_provider/operators/great_expectations.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,15 @@ def __init__(

if not (self.checkpoint_name or self.checkpoint_config) and not self.expectation_suite_name:
raise ValueError(
"An expectation_suite_name must be supplied if neither checkpoint_name nor checkpoint_config are."
"An expectation_suite_name must be specified if neither checkpoint_name nor checkpoint_config are."
)

# Check that when a data asset name is passed, a valid conn_id or dataframe_to_validate is passed as well
# so the appropriate custom data assets can be generated
if self.data_asset_name and not (self.is_dataframe or self.conn_id):
raise ValueError(
"When a data_asset_name is specified, a dataframe_to_validate or conn_id must also be specified"
" to generate the data asset."
)

if isinstance(self.checkpoint_config, CheckpointConfig):
Expand Down Expand Up @@ -367,8 +375,6 @@ def build_runtime_datasources(self):
batch_request = self.build_configured_sql_datasource_batch_request()
else:
raise ValueError("Unrecognized, or lack of, runtime query or Airflow connection passed.")
else:
raise ValueError("Unrecognized, or lack of, runtime or conn_id datasource passed.")
if not self.checkpoint_kwargs:
self.batch_request = batch_request

Expand Down