Skip to content

draft updates - #1

Draft
talagluck wants to merge 2 commits into
denimalpaca:add_great_expectations_providerfrom
talagluck:great_expectations_provider_updates
Draft

draft updates#1
talagluck wants to merge 2 commits into
denimalpaca:add_great_expectations_providerfrom
talagluck:great_expectations_provider_updates

Conversation

@talagluck

@talagluck talagluck commented Sep 7, 2022

Copy link
Copy Markdown

A few updates here. Some open questions:

I think it makes sense to get rid of the default filesystem datasources, though it still might make sense for dataframes, since there is basically no configuration required here.

Need to differentiate query from dataframe with Runtime Connectors, and pandas from spark df.

How much Data Context config is fair to require as prerequisite for the project? I think what you have here is probably fine (requiring a basic DataContext which will have Stores), but it would be great to think this through.

@denimalpaca denimalpaca left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have some initial comments and questions, but overall I like the way this is getting dialed-in a lot!

@@ -38,8 +38,6 @@ class GreatExpectationsOperator(BaseOperator):
:type file_regex: Optional[Dict]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this, too

Comment on lines -85 to +82
runtime_data_source: Optional[Union[DataFrame, str]] = None,
dataframe_to_validate: Optional[DataFrame] = None, # should we allow a Spark DataFrame as well?
query_to_validate: Optional[str] = None,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove and add docstring lines as necessary

self.return_json_dict: bool = return_json_dict
self.use_open_lineage = use_open_lineage

if self.dataframe_to_validate is not None and self.query_to_validate:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to check if self.query_to_validate is not None for consistency?

raise ValueError(
"Exactly one, or neither, of dataframe_to_validate or query_to_validate may be specified."
)
self.runtime_datasource = bool(self.dataframe_to_validate is not None) or bool(self.query_to_validate)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, consistency in checks (unless I'm missing something).

self.runtime_datasource = bool(self.dataframe_to_validate is not None) or bool(self.query_to_validate)
# Check that only one of the arguments is passed to set a data context
if not (self.data_context_root_dir ^ self.data_context_config):
if not (bool(self.data_context_root_dir) ^ bool(self.data_context_config)):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the bools are added here (and not below as well).

"default_regex": self.file_regex,
},
}
pass

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should throw and error - something about not recognizing the data source and needing further configuration?

Comment on lines -236 to -242
# BigQuery needs a temp table to run on; it is assumed the table will
# be named the same as the data asset but with an added _temp suffix
if self.conn_type == "gcpbigquery":
self.batch_request_extra["batch_spec_passthrough"] = {
"bigquery_temp_table": f"{self.data_asset_name}_temp"
}
batch_request.update(self.batch_request_extra)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this no longer needed for BigQuery? I can't tell if it's being handled somewhere else.

else:
self.log.info("Validation with Great Expectations successful.")

def build_configured_sql_datasource_config_from_conn_id(self):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this and the method below going to be called anywhere? I don't quite understand how they fit into the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants