<@U088WCP3B4P> Hello. I have a test that received ...
# ask-elementary-ai
a
@kapa.ai Hello. I have a test that received a warning and I send an alert, but the test_result_sample is not displayed, although this parameter is in the alerts_v2 table in the data section, but it is not included in the alert. The alert looks like this: Warning: transactions: 1 issues detected ⚠️ Test Warnings: 1 Test Warnings ⚠️ "check_last_update_projects_today" test failed on transactions - Owner: ..
k
A message from kapa.ai
Based on the information you've provided, it appears you're experiencing an issue with test result samples not displaying in your Elementary Data alerts, even though the field exists in the alerts_v2 table. There are a few potential causes for this issue: ### Possible Causes 1. Missing Configuration: You might need to explicitly include "test_results_sample" in your alert_fields configuration. 2. dbt Version Compatibility: If you recently upgraded to dbt 1.8+, there's a known issue that affects test result samples in Elementary alerts. 3. Materialization Override Issue: In dbt 1.8+, packages need explicit permission to override materializations, which Elementary requires for collecting test samples. ### Solution If you're using dbt 1.8 or higher, you need to add the following flag to your dbt_project.yml file:
Copy code
yaml flags:   require_explicit_package_overrides_for_builtin_materializations: false
This is a temporary measure that will allow Elementary to collect samples and failed row counts for dbt tests. According to the Elementary team, they are working with the dbt-core team on a more permanent solution [Github Issue #1692](https://github.com/elementary-data/elementary/issues/1692). ### Additional Configuration Also, make sure you have properly configured the alert_fields in your model or test configuration:
Copy code
yaml models:   - name: your_model_name     meta:       alert_fields: ["description", "owners", "tags", "subscribers", "result_message", "test_parameters", "test_query", "test_results_sample"]
Or for tests:
Copy code
yaml data_tests:   your_test_group:     +meta:       alert_fields: ["description", "owner", "subscribers", "result_message", "test_results_sample", "test_query"]
By default, all fields should be included in the alert, but explicitly specifying them might help resolve the issue [Alerts Configuration](https://docs.elementary-data.com/oss/guides/alerts/alerts-configuration#alert-fields). If you're using grouped alerts (by table), note that these contain less information by nature and might not include test result samples [Alerts Configuration](https://docs.elementary-data.com/oss/guides/alerts/alerts-configuration#group-alerts-by-table). Let me know if these solutions help resolve your issue!
a
My test_check_last_update_projects_today has a meta with "alert_fields": "['table', 'column', 'description', 'owners', 'result_message', 'test_results_sample']"
And I have require_explicit_package_overrides_for_builtin_materializations with False
@kapa.ai My test_check_last_update_projects_today has a meta with "alert_fields": "['table', 'column', 'description', 'owners', 'result_message', 'test_results_sample']" [10:09 AM] And I have require_explicit_package_overrides_for_builtin_materializations with False
k
A message from kapa.ai
Based on your configuration, it seems you've correctly set up both the alert_fields and the required dbt flag for test result samples. However, there are a few potential issues that might be preventing the test_results_sample from appearing in your alerts: 1. Format of alert_fields: I notice your alert_fields is configured as a string representation of a list (
"['table', 'column', ...]"
) rather than an actual list. This should be formatted as a proper YAML list:
Copy code
yaml meta:   alert_fields: ["table", "column", "description", "owners", "result_message", "test_results_sample"]
2. Empty test results: There might be no sample data to display. According to user reports in [Github Issue #1692](https://github.com/elementary-data/elementary/issues/1692), sometimes the
result_rows
field in the
elementary_test_results
model is empty, which would result in no samples being displayed. 3. Version compatibility: If you're using Elementary with dbt 1.8+, there have been reported issues with test_results_sample not appearing in alerts. Some users have found success by: - Using Elementary CLI version 0.15.1 with dbt package version 0.15.2 - Or upgrading to Elementary dbt package 0.16.1 4. Grouped alerts: If you're using
slack_group_alerts_by: table
, grouped alerts contain less information by nature and might not include test result samples [Alerts Configuration](https://docs.elementary-data.com/oss/guides/alerts/alerts-configuration#group-alerts-by-table). To troubleshoot further: - Check if your test has
store_failures=True
configured - Verify that there's actual data in the
elementary_test_results
table for your test - Check your Elementary and dbt versions and consider upgrading or downgrading based on the information from the GitHub issue If you're still experiencing issues after these checks, it might be worth opening a support ticket with Elementary as this could be a bug in the current version you're using.
a
@kapa.ai My config in test {% macro test_check_last_update_projects_today(model, update_column) %} {{ config( severity = 'warn', meta={ "alert_fields": "['table', 'column', 'description', 'owners', 'result_message', 'test_results_sample']" } ) }} And elementary_test_results has a null result_rows for this test warning But in test_result_rows I have result_row In alerts_dbt_tests I has result_table is null But in alerts_v2 i has a column data with json and in this json i has a test_rows_sample
k
A message from kapa.ai
Based on the information you've provided, I can see a few issues that might be causing your test_results_sample not to display in your alerts. ### Issue 1: Meta Configuration Format The format of your
alert_fields
in the test configuration is incorrect. You're using a string representation of a list rather than an actual YAML list:
Copy code
yaml meta={     "alert_fields": "['table', 'column', 'description', 'owners', 'result_message', 'test_results_sample']" }
This should be formatted as:
Copy code
yaml meta={     "alert_fields": ['table', 'column', 'description', 'owners', 'result_message', 'test_results_sample'] }
### Issue 2: Data Inconsistency You mentioned that: -
elementary_test_results
has a null
result_rows
for this test -
test_result_rows
has result data -
alerts_dbt_tests
has null
result_table
-
alerts_v2
has test_rows_sample in the JSON data This inconsistency suggests there might be an issue with how the data is being processed between these tables. According to user reports in the Elementary Slack community, there have been similar issues with test result samples not appearing in alerts, especially after upgrading to dbt 1.8+ [Github Issue #1692](https://github.com/elementary-data/elementary/issues/1692). ### Potential Solutions: 1. Fix the meta configuration format as mentioned above. 2. Check your dbt and Elementary versions: - Some users reported success with Elementary dbt package version 0.16.1 - Others found that downgrading to Elementary CLI 0.15.1 with dbt package 0.15.2 resolved the issue 3. Verify the
test_sample_row_count
setting
: If you haven't explicitly set this, try adding it to your `dbt_project.yml`:
Copy code
yaml    vars:      elementary:        test_sample_row_count: 5  # or any number you prefer
4. Ensure you have the correct flag in your dbt_project.yml:
Copy code
yaml    flags:      require_explicit_package_overrides_for_builtin_materializations: false
5. Add
store_failures=True
to your test configuration if it's not already there. The fact that you have data in
test_result_rows
but not in
elementary_test_results.result_rows
suggests there might be an issue with how the data is being processed between these tables. This could be related to the materialization override issue in dbt 1.8+ that affects Elementary's ability to collect test samples. If you continue to experience issues after trying these solutions, it might be worth opening a support ticket with Elementary as this could be a bug in the current version you're using.
a
@kapa.ai elementary package 0.18.2, cli - 0.18.1
k
A message from kapa.ai
Thank you for providing your Elementary package and CLI versions. Based on the conversation history and the issue you're experiencing with test_results_sample not displaying in alerts, I can see that you're using relatively recent versions of Elementary (package 0.18.2 and CLI 0.18.1). The issue you're experiencing with test result samples not appearing in alerts despite being present in the alerts_v2 table's JSON data appears to be similar to the one reported in [Github Issue #1692](https://github.com/elementary-data/elementary/issues/1692). This issue has been reported by multiple users, particularly after upgrading to dbt 1.8+. Since you've already: 1. Set up the correct flag (
require_explicit_package_overrides_for_builtin_materializations: false
) 2. Configured alert_fields to include test_results_sample (though with incorrect formatting) I recommend: 1. Fix your meta configuration format first:
Copy code
yaml meta={     "alert_fields": ['table', 'column', 'description', 'owners', 'result_message', 'test_results_sample'] }
2. If that doesn't resolve the issue, you might want to consider: - Ensuring you have
store_failures=True
in your test configuration - Checking if the issue persists with different test types - Opening a support ticket with Elementary, as this might be a bug in the current version The GitHub issue indicates that this problem is affecting multiple users with similar setups, suggesting it might be a bug in the current Elementary versions when used with dbt 1.8+. The Elementary team appears to be aware of the issue and working on a solution. I hope this helps with your troubleshooting efforts! I'm here to help if you have any other questions about Elementary Data.
a
@kapa.ai my alert: Warning: transactions: 1 issues detected ⚠️ Test Warnings: 1 ℹ️ Details Tags No tags Owners Subscribers No subscribers Test Warnings ⚠️ "check_last_update_projects_today" test failed on transactions - Owner: I don`t understand, why i get alert with warning table transaction, not warning about check_last_update_projects_today test
k
A message from kapa.ai
Based on your alert message, it appears you're experiencing an issue with how Elementary Data is formatting your alerts. The alert is showing a warning for the "transactions" table rather than focusing on the specific test "check_last_update_projects_today" that failed. This behavior is likely due to alert grouping. Elementary Data has a feature called "group alerts by table" which consolidates all issues related to a single table into one notification. When this feature is enabled, instead of getting individual alerts for each test failure, you receive a single alert that summarizes all issues for a particular table (in this case, "transactions"). From the alert format you shared, it appears that your alerts are being grouped by table. This is why you're seeing "Warning: transactions: 1 issues detected" at the top, followed by details about the specific test that failed. This grouping can be configured in two ways: 1. Through the CLI when running the monitor command:
Copy code
edr monitor --group-by table
2. Or in your model configuration:
Copy code
yaml models:   - name: transactions     meta:       slack_group_alerts_by: table
If you prefer to receive individual alerts for each test failure rather than grouped by table, you can: 1. Remove the
--group-by table
flag if you're using it in your CLI command 2. Remove the
slack_group_alerts_by: table
configuration from your model's meta section As noted in the documentation, grouped alerts contain less information by nature compared to individual alerts [Alerts Configuration](https://docs.elementary-data.com/oss/guides/alerts/alerts-configuration#group-alerts-by-table). If you want more detailed information about each test failure, switching to individual alerts might be more appropriate for your use case.
a
@kapa.ai This test for source, not model
k
A message from kapa.ai
Thank you for clarifying that your test is for a source rather than a model. This is an important distinction that helps understand your alert configuration issue better. The behavior you're seeing with alerts being grouped by table rather than showing individual test alerts applies to sources as well. Elementary Data treats sources similarly to models when it comes to alert grouping. When alerts are grouped by table (which appears to be happening in your case), Elementary will consolidate all issues related to a single table into one notification, regardless of whether that table is a source or a model. This is why you're seeing "Warning: transactions: 1 issues detected" rather than a specific alert about your "check_last_update_projects_today" test. To change this behavior and receive individual alerts for each test failure on your source, you can: 1. Remove any
--group-by table
flag if you're using it in your
edr monitor
command 2. Check if you have
slack_group_alerts_by: table
configured in your source's meta section and remove it For sources, you would configure this in your schema YAML file:
Copy code
yaml sources:   - name: your_source_name     tables:       - name: transactions         meta:           slack_group_alerts_by: individual  # or remove this line entirely
This should help you receive more specific alerts about your source test failures rather than having them grouped by table. If you continue to experience issues with the alert format or test_results_sample not appearing in your alerts, it might be related to the issue discussed earlier about Elementary's compatibility with newer dbt versions. I hope this helps clarify why your alerts are appearing grouped by table rather than as individual test alerts!
a
@kapa.ai My edr command
Copy code
edr monitor --project-profile-target dev_local --profile-target dev --slack-channel-name ... --slack-token ...
k
A message from kapa.ai
New message text here
n
Hey @Ahazy __, do you need any further help? 🙂
a
Hi, I figured it out already, thanks) I just didn't see that there was a group_by table in the config files
🙌 1