How can I output a custom message or altair graph instead of the default output in data docs?
Here is a guide for customizing the interface of Data Docs: https://docs.greatexpectations.io/en/latest/reference/spare_parts/data_docs_reference.html#customizing-data-docs
It explains the basic architecture of the templates and how to replace the default code with your own.
Thanks for your answer! It seems super straightforward to add a single custom expectation, but I couldn’t find an easy way of injecting custom visualizations.
So far, I’ve been able to update a couple files in the source (
validation_results_table_content_block ) to generate some custom displays for my own expectations, but ideally we’d have plugins for each new expectation & viz. I suppose I could create a whole custom renderer, but that seems like overkill for my use case.
Is creating a whole new renderer the right/only way forward here?
if so, any advice on a straightforward way to integrate custom expectations into that new renderer? The example at the bottom of the page you linked didn’t seem to have a whole lot in the way of iterating over expectation results
Hi Ryan - thanks for reaching out. You are correct - currently, if you would like to use plugins in that way for custom expectations in Data Docs, you would have to implement a custom ExpectationStringRenderer, as well as a custom ValidationResultsTableContentBlockRenderer and ExpectationSuiteBulletListContentBlockRenderer that inherits the custom ExpectationStringRenderer. You would then specify the custom ValidationResultsTableContentBlockRenderer and ExpectationSuiteBulletListContentBlockRenderer in your
great_expectations.yml (also referenced in the docs link above):
data_docs_sites: local_site: class_name: SiteBuilder store_backend: class_name: TupleFilesystemStoreBackend base_directory: uncommitted/data_docs/local_site/ site_index_builder: class_name: DefaultSiteIndexBuilder site_section_builders: expectations: renderer: module_name: great_expectations.render.renderer class_name: ExpectationSuitePageRenderer column_section_renderer: class_name: ExpectationSuiteColumnSectionRenderer bullet_list_renderer: module_name: custom_data_docs.renderers.custom_bullet_list_renderer class_name: CustomExpectationSuiteBulletListContentBlockRenderer validations: renderer: module_name: great_expectations.render.renderer class_name: ValidationResultsPageRenderer column_section_renderer: class_name: ValidationResultsColumnSectionRenderer table_renderer: module_name: custom_data_docs.renderers.custom_table_renderer class_name: CustomValidationResultsTableContentBlockRenderer
We realize this is not ideal and are currently in the middle of a big refactor that will make implementing custom expectations (and their Data Docs renderers) much simpler. In the new architecture, expectations are refactored into their own classes, which also encapsulates any rendering logic. This will be released soon in GE 0.13.