Skip to content

Mirror elt pattern - #74

Merged
bennyaustin merged 15 commits into
mainfrom
Mirror-ELT-Pattern
Mar 21, 2026
Merged

Mirror elt pattern#74
bennyaustin merged 15 commits into
mainfrom
Mirror-ELT-Pattern

Conversation

@bennyaustin

Copy link
Copy Markdown
Owner

This pull request introduces several improvements to the ELT ControlDB schema and procedures, focusing on enforcing data integrity, enhancing uniqueness constraints, and optimizing how input sources are handled for transformations. The changes include new check constraints, updates to unique indexes, improved handling of NULL comparisons for matching records, and more efficient logic in stored procedures for distinguishing between file-based and table-based inputs.

Schema and Data Integrity Improvements:

  • Added a check constraint CC_L1TransformInstance_InputSource on the [ELT].[L1TransformInstance] table to ensure that either file-based or table-based input fields are set, but not both. [1] [2]
  • Updated indexes UI_IngestInstance and UI_L1TransformDefinition to be unique, enforcing data uniqueness at the database level. [1] [2]

Stored Procedure Logic Enhancements:

  • Refactored InsertTransformInstance_L1.sql to separate logic for file-based and table-based inputs, improving SARGability and efficiency. Existence checks and updates now use equality predicates instead of complex OR/NULL logic, making queries faster and more reliable. [1] [2]
  • Updated the update logic in InsertTransformInstance_L1.sql to match records more precisely using explicit NULL-safe comparisons, reducing the risk of incorrect updates.

Improved NULL Handling in Record Matching:

  • Modified InsertIngestInstance.sql to use explicit NULL-safe equality checks when matching on destination fields, ensuring correct identification of existing records and avoiding issues with NULL comparisons. [1] [2] [3]

Copilot AI and others added 15 commits March 21, 2026 13:28
Replace non-SARGable OR predicates with separate file/table query branches in InsertTransformInstance_L1
Fix NULL-unsafe WHERE predicates in InsertIngestInstance
Fix NULL-unsafe predicates in InsertIngestInstance WHERE clauses
Fix NULL-unsafe WHERE predicates in InsertTransformInstance_L1 UPDATE clause
Merge pull request #68 from bennyaustin/Mirror-ELT-Pattern
Added a check constraint to L1TransformInstance to enforce mutually exclusive input source specification (file or table). Updated UI_IngestInstance and UI_L1TransformDefinition indexes to be UNIQUE. Included the new constraint script in the project for deployment.
@bennyaustin
bennyaustin merged commit 841d81e into main Mar 21, 2026
1 check passed
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