Skip to content

215 feat add mandatory satellites parameter to pit - #483

Open
jstendel wants to merge 9 commits into
mainfrom
215-feat_add_mandatory_satellites_parameter_to_pit
Open

215 feat add mandatory satellites parameter to pit#483
jstendel wants to merge 9 commits into
mainfrom
215-feat_add_mandatory_satellites_parameter_to_pit

Conversation

@jstendel

Copy link
Copy Markdown
Contributor

Description

Adds optional satellite coverage filtering to the PIT macro, so a PIT can be limited to entities that actually have descriptive data, rather than every hub × snapshot combination:

  • Per-satellite mandatory flag: sat_names now accepts either a plain satellite name or a {name, mandatory} dict. When mandatory: true, a PIT row is only emitted where that satellite has a record at the snapshot time
  • Top-level mandatory_strategy: 'any' (row kept if at least one satellite matched, OR) or 'all' (row kept only if every satellite matched, AND), applied across all satellites. Mutually exclusive with the per-satellite flags
  • When any mandatory filtering is active, the unknown and ghost records are dropped (te.hashkey != unknown_key)
  • Fully backward compatible: plain-string sat_names still work and the default behaviour (no filtering) is unchanged. Implemented consistently across all adapters and documented in 22_pit.md

Fixes: 215

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Verified end-to-end on a local Postgres instance and the 215-feat_add_mandatory_satellites_parameter_to_pit branch inside the datavault4dbt-automatic-tests repo where additional pit models and test for those new models were created.

Test Configuration:

  • datavault4dbt-Version: branch 215-feat_add_mandatory_satellites_parameter_to_pit
  • dbt-Version: core version 1.11.10
  • dbt-adapter-Version: dbt-postgres 1.10.0

Checklist:

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation or included information that needs updates (e.g. in the Wiki)

@jstendel

Copy link
Copy Markdown
Contributor Author

CI/CD Run

@jstendel
jstendel marked this pull request as ready for review June 24, 2026 11:10
@jstendel
jstendel requested review from tkiehn and tkirschke June 29, 2026 08:20
Comment thread macros/tables/pit.sql
Comment thread macros/tables/synapse/pit.sql Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds optional “satellite coverage” filtering to the PIT macro so PIT rows can be restricted to entities that have matching satellite records at the snapshot time (via per-satellite mandatory flags or a global mandatory_strategy of 'any'/'all'). It also updates adapter-specific PIT implementations and the PIT documentation accordingly.

Changes:

  • Extend pit/adapter PIT macros with mandatory_strategy and support sat_names entries as {name, mandatory} dicts (with normalization for backward compatibility).
  • Apply mandatory satellite match filtering consistently across supported adapters, and drop unknown/ghost records when mandatory filtering is active.
  • Document the new sat_names dict form and mandatory_strategy behavior in 22_pit.md.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
macros/tables/pit.sql Adds mandatory_strategy, documents it, and normalizes sat_names entries to dicts before dispatch.
macros/tables/bigquery/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering (default implementation).
macros/tables/databricks/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering.
macros/tables/exasol/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering.
macros/tables/fabric/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering.
macros/tables/oracle/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering.
macros/tables/postgres/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering (with WHERE composition).
macros/tables/redshift/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering via HAVING.
macros/tables/snowflake/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering (including snapshot optimization path).
macros/tables/sqlserver/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering.
macros/tables/synapse/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering.
macros/tables/trino/pit.sql Updates PIT SQL generation to use satellite.name and apply mandatory filtering.
docs/01_macro-instructions/22_business-vault/22_pit/22_pit.md Documents the new sat_names dict entries and the mandatory_strategy parameter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread macros/tables/pit.sql
Comment on lines +102 to +111
{# Normalize sat_names: plain strings become {'name': ..., 'mandatory': false} for backward compatibility. #}
{%- set sat_names_normalized = [] -%}
{%- for sat in sat_names -%}
{%- if sat is string -%}
{%- do sat_names_normalized.append({'name': sat, 'mandatory': false}) -%}
{%- else -%}
{%- do sat_names_normalized.append({'name': sat['name'], 'mandatory': sat.get('mandatory', false)}) -%}
{%- endif -%}
{%- endfor -%}
{%- set sat_names = sat_names_normalized -%}
Comment thread macros/tables/pit.sql
{%- set refer_to_ghost_records = datavault4dbt.yaml_metadata_parser(name='refer_to_ghost_records', yaml_metadata=yaml_metadata, parameter=refer_to_ghost_records, required=False, documentation=pit_type_description) -%}
{%- set refer_to_ghost_records = datavault4dbt.yaml_metadata_parser(name='refer_to_ghost_records', yaml_metadata=yaml_metadata, parameter=refer_to_ghost_records, required=False, documentation=refer_to_ghost_records_description) -%}
{%- set snapshot_optimization = datavault4dbt.yaml_metadata_parser(name='snapshot_optimization', yaml_metadata=yaml_metadata, parameter=snapshot_optimization, required=False, documentation=snapshot_optimization_description) -%}
{%- set mandatory_strategy = datavault4dbt.yaml_metadata_parser(name='mandatory_strategy', yaml_metadata=yaml_metadata, parameter=mandatory_strategy, required=False, documentation=mandatory_strategy_description) -%}
Comment thread docs/01_macro-instructions/22_business-vault/22_pit/22_pit.md Outdated
@tkiehn

tkiehn commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Hi @jstendel, could you please also add a test with defined input and expected output per setting to the testing-repo and mention this PR there?

@tkiehn tkiehn added the waiting-on-response Waiting on a response from the author or others, except maintainers. label Jul 13, 2026
@jstendel

jstendel commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Recommended changes are implemented in newest commit and new tests can be found here: https://github.com/ScalefreeCOM/datavault4dbt-automatic-tests/pull/241

Premium Package adjustments can be found here: https://github.com/ScalefreeCOM/datavault4dbt-premium-package/pull/6

@jstendel jstendel added waiting-on-maintainers Waiting for a response from the maintainers. and removed waiting-on-response Waiting on a response from the author or others, except maintainers. labels Aug 4, 2026
@remoteworkflow

remoteworkflow Bot commented Aug 4, 2026

Copy link
Copy Markdown

dbt test combined result: ❌


Details

RESULTS for Synapse:
❌ dbt-core-tests
⚠️ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Postgres:
✅ dbt-core-tests
⚠️ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for BigQuery:
✅ dbt-core-tests
✅ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Redshift:
✅ dbt-core-tests
✅ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Snowflake:
✅ dbt-core-tests
✅ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Exasol:
❌ dbt-core-tests
⚠️ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Fabric:
❌ dbt-core-tests
⚠️ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Oracle:
✅ dbt-core-tests
⚠️ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Databricks:
❌ dbt-core-tests
❌ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for SQL Server:
❌ dbt-tests
⚠️ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


RESULTS for Trino:
✅ dbt-tests
⚠️ dbt-fusion-tests
⚠️ dbt-macro-tests
⚠️ tech-tests


Link to workflow summary: https://github.com/ScalefreeCOM/datavault4dbt-ci-cd/actions/runs/30883322243

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

Labels

waiting-on-maintainers Waiting for a response from the maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants