Skip to content

feat(snowflake): Snowflake edition of the DIRECT Framework - #52

Merged
RoelantVos merged 2 commits into
mainfrom
feature/snowflake-edition
Oct 26, 2026
Merged

RoelantVos merged 2 commits into
mainfrom
feature/snowflake-edition

Conversation

@RoelantVos

Copy link
Copy Markdown
Collaborator

Summary

Adds a snowflake folder with the DIRECT Framework in Snowflake Scripting, so that a Snowflake solution registers its Batches and Modules in the same repository model as the SQL Server edition and runs them inside Snowflake. The folder is self-contained; nothing in the dacpac, the T-SQL procedures, the integration tests or the version files changes.

What is in it

  • sql/01 to sql/10: the OMD, OMD_METADATA, OMD_PROCESSING and OMD_REPORTING schemas inside the solution database (every object fully qualified through a <% database %> token), the repository tables with sequences, the reference data and settings, lookup functions, and the procedures: REGISTER_BATCH, REGISTER_MODULE, ADD_MODULE_TO_BATCH, ADD_BATCH_TO_PARENT_BATCH, SET_SETTING; INSERT_INTO_EVENT_LOG, CREATE_BATCH_INSTANCE, CREATE_MODULE_INSTANCE, UPDATE_BATCH_INSTANCE, UPDATE_MODULE_INSTANCE, SET_SOURCE_CONTROL_VALUES; BATCH_EVALUATION and MODULE_EVALUATION with the abort, cancel and full or partial rollback semantics of 2.1.2; RUN_MODULE (load window, executable with :ModuleInstanceId, :StartValue, :EndValue and :ConsistencyDateTime tokens) and RUN_BATCH (Modules in sequence, then child Batches recursively, STOP_BATCH_ON_MODULE_FAILURE, THROW_ON_FAILURE); START_QUEUE, STOP_QUEUE and REMOVE_QUEUE for a Task per Batch; processing and reporting views.
  • Direct_Snowflake.sql: the single deployment file built from the sql folder (scripts/Build-DirectSnowflake.ps1), deployed with snow sql -f Direct_Snowflake.sql -D database=<name> --enable-templating STANDARD. Rerunnable: tables and settings are kept, procedures and views replaced.
  • scripts/: build, deploy, run a Batch, set or stop the schedule, and Run-DirectSnowflakeTests.ps1.
  • tests/: a regression suite of 23 Snowflake Scripting tests (basic run, custom query, failure with and without throw, failure logging, abort on an unregistered relationship, rollback, one-off cancel, repeated failures and recovery, unregistered Module, Batch with one Module, Batch with a failing Module, partial rollback, hierarchy registration and run, disabled Module, relationship and Batch, load windows, the two update procedures, concurrency abort, queue Task) that mirror the SQL Server integration tests. Each test asserts its own outcome into OMD_TEST.TEST_RESULT; the runner deploys into a scratch database and drops it afterwards.
  • README.md: how a Batch runs, the executable contract, the queue, settings, deployment, testing, folder layout and the differences from the SQL Server edition.

Not ported: GetConsistencyTimestamp, TableCondensing, the external orchestration pair CreateBatchModuleInstances and EndBatchModuleInstances (the executables run inside Snowflake), and the exception views that depend on SQL Server catalogs.

Verification

  • Regression suite on a Snowflake account (Snowflake CLI, scratch database, X-Small warehouse): 22 pass, 0 fail, 1 skip. The skipped test is the queue Task: the Task is created, but ALTER TASK RESUME needs EXECUTE TASK on the account, which the test role lacks. Two full runs, about 15 minutes each.
  • Live use by the Willibald Snowflake sample of ADL (agnosticdatalabs/adc#457): 9 Batches in a three-level hierarchy and 84 Modules registered; three deliveries through the main Batch with the expected key figures; a no-op rerun; a failed run followed by a recovery run with a partial rollback (the failed Module's rows deleted and reloaded, the succeeded Modules skipped).

Notes


Generated by Claude Code

Adds a snowflake folder with the framework in Snowflake Scripting: the
OMD repository schemas, tables and reference data, registration and
instance procedures, Batch and Module evaluation with rollback, RUN_MODULE
and RUN_BATCH with load windows and a Batch hierarchy, a Task-based queue,
processing and reporting views, deployment scripts for the Snowflake CLI
and a README.

Includes a regression test suite (23 Snowflake Scripting tests and a
runner that deploys into a scratch database) that mirrors the SQL Server
integration tests. The suite has not been run against Snowflake yet.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018oFuRFsRbFpqwLoZNGcjN4
Invoke-SqlFile returned the Snowflake CLI output together with the exit
code, so the runner reported a failed deployment whenever the CLI printed
anything. The output now goes to the host and only the exit code is
returned. Verified on Snowflake: 22 tests pass, the queue test is skipped
for a role without EXECUTE TASK.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018oFuRFsRbFpqwLoZNGcjN4
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