feat: add optional unique suffixes to test failure table names #1277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for unique suffixes on test failure tables to prevent table name conflicts during parallel test execution (e.g., in Airflow DAGs with hourly/daily runs).
Problem
When running dbt tests with
store_failures: truein parallel environments:Solution
This PR works in conjunction with dbt-labs/dbt-core#11939 to implement:
Optional unique suffixes for test failure tables via new configuration:
store_failures_unique: Boolean flag to enable suffixesstore_failures_suffix: Strategy for suffix generationMultiple suffix strategies:
invocation_id: Uses first 8 chars of invocation ID (default)timestamp: Full timestamp (YYYYMMDD_HHMMSS)date: Date only (YYYYMMDD)hour: Date and hour (YYYYMMDD_HH)Template support for advanced use cases:
data_interval_startConfiguration Example
Key Changes
src/dbt/include/global_project/macros/materializations/tests/test.sqlstore_failures_uniqueis falseTesting
Related Work
Breaking Changes
None. The feature is fully backward compatible and opt-in.
Checklist
CHANGELOG.md