Skip to content

feat: add realtime-box with Lookup Catalog sync workflow#442

Merged
toru-takahashi merged 5 commits into
masterfrom
feat/realtime-box-lookup-catalog-sync
Jun 29, 2026
Merged

feat: add realtime-box with Lookup Catalog sync workflow#442
toru-takahashi merged 5 commits into
masterfrom
feat/realtime-box-lookup-catalog-sync

Conversation

@toru-takahashi

Copy link
Copy Markdown
Member

Summary

Adds a new realtime-box/ directory for Treasure AI RT 2.0 workflow templates, starting with the Lookup Catalog sync workflow.

realtime-box/lookup-catalog-sync/

Syncs tables from cdp_lookup_catalog to RT 2.0 internal storage using hash-based change detection — only changed rows are uploaded on each run.

File Description
lookup_catalog_sync.dig Main workflow — auto-discovers tables via information_schema, inits digest tables, syncs all or a single table
scripts.py Type-aware JSON payload SQL generator supporting array<varchar>, array<bigint>, array<double>, scalar float artifact fix, and NULL element preservation
queries/discover_tables.sql Discovers eligible tables, excludes _wf_* internal and legacy digest/updated tables

Key behaviours:

  • Digest table key column is derived dynamically from each table's first column (no hardcoded _key)
  • p_table_name can be set to sync a single table (useful for testing)
  • All internal/temporary tables use a consistent _wf_ prefix

Test plan

  • Run workflow against a test cdp_lookup_catalog table and verify records appear in RT 2.0
  • Verify automatic table discovery picks up all eligible tables
  • Verify incremental run uploads only changed records
  • Set p_table_name and verify single-table sync works

🤖 Generated with Claude Code

Adds realtime-box/ for Treasure AI RT 2.0 workflow templates.

### realtime-box/lookup-catalog-sync/

Syncs tables from `cdp_lookup_catalog` to RT 2.0 internal storage
using hash-based change detection — only changed rows are uploaded
on each run.

- `lookup_catalog_sync.dig` — auto-discovers tables via information_schema,
  inits digest tables with dynamic key column, syncs all or a single table
- `scripts.py` — type-aware JSON payload SQL generator supporting
  array<varchar>, array<bigint>, array<double>, scalar float artifact fix,
  and NULL element preservation
- `queries/discover_tables.sql` — discovers eligible tables, excludes
  _wf_* internal and legacy digest/updated tables

Key behaviours:
- Digest table key column derived dynamically from each table's first column
- p_table_name can be set to sync a single table (useful for testing)
- All internal/temporary tables use a consistent _wf_ prefix

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
toru-takahashi and others added 3 commits June 27, 2026 23:25
…ference

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread realtime-box/README.md
Comment thread realtime-box/lookup-catalog-sync/queries/discover_tables.sql

@parulsaran parulsaran left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Left few comments, please take a look.
LGTM, Thanks!

Comment thread realtime-box/README.md Outdated
- discover_tables.sql: skip tables with only a time column by requiring
  at least one non-time column via a subquery on information_schema.columns
- README: clarify that the first (key) column must be String type
- README: add Error Handling section documenting Invalid JSON Payload
  errors from the bulk-load API, common causes, and error response format

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@toru-takahashi toru-takahashi merged commit 73bda05 into master Jun 29, 2026
3 checks passed
@toru-takahashi

Copy link
Copy Markdown
Member Author

Thank you!!

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