Spensara Spensara Knowledge Base & Documentation Repository

Repository Docs & Knowledge Base

Consolidated Spensara documentation repository (722 Markdown & architecture documents in ../repository)
Built Word Documents (.docx): Spensara Overview (.docx) Capability Assessment (.docx) Brink POS Ingestion Analysis (.docx) The Borg Ingestion Architecture (.docx)

Implementation Specs (157)

Detailed engineering and feature implementation specifications.
implementation-specs/specs/BrinkPosOrdersFirstEtlJob/TASK5.2.md 2,719 bytes · Updated Oct 23, 2026 10:44 AM EDT
Raw File

TASK 5.2: Implement Staging Table Catalog And Redshift COPY Command Construction

Summary

Implement the fixed v1 mapping from emitted GetOrders load contracts to Redshift staging tables and the SQL-construction path that turns one contract artifact set into one Redshift COPY command.

This subtask is the core warehouse-shaping step for the first load -> Redshift staging slice.

Dependencies

  • TASK 5.1 - load-to-staging orchestration and upstream normalize-load batch resolution

Files to Create

1. Staging table catalog

Create or finalize the fixed v1 staging table catalog for the narrowed Sales2.GetOrders contract set.

Required catalog details:

  • ContractName
  • TargetTableName
  • schema-version compatibility rules when needed
  • whether the contract is required for this stage

2. Redshift COPY command factory

Create or finalize the component that builds Redshift COPY SQL for one target table and one resolved contract artifact set.

Recommended logical service:

  • RedshiftCopyCommandFactory

Files to Modify

3. Warehouse SQL construction seam

Modify or finalize the shared warehouse SQL seam so staging-load SQL is created from explicit catalog data and centralized Redshift configuration rather than Brink-specific string concatenation spread across orchestration code.

Required Behavior

  • one emitted load contract maps to exactly one staging table
  • the fixed catalog covers the narrowed TASK4.md GetOrders contract inventory only
  • COPY command construction supports Parquet input
  • COPY command construction uses explicit target table and S3 artifact locations
  • Redshift auth options come from centralized warehouse configuration rather than per-contract branching
  • command construction remains independent from execution so it can be unit-tested directly

Testing

Unit tests

Add unit tests for:

  • contract-to-table catalog correctness for every required v1 contract
  • rejection of unknown or unsupported contracts
  • COPY SQL construction for Parquet input
  • target table selection and input URI/prefix selection
  • use of centralized auth/config placeholders in generated SQL

Acceptance Criteria

  • [x] Fixed v1 staging table catalog exists for the narrowed GetOrders contract set
  • [x] Every required contract maps deterministically to one staging table
  • [x] Unknown or unsupported contracts are rejected explicitly
  • [x] COPY SQL can be built for Parquet input from resolved artifact locations
  • [x] Unit tests cover mapping and SQL-construction behavior

Notes

  • Keep this subtask focused on mapping and SQL construction.
  • Do not execute Redshift commands here; that belongs to TASK 5.3.