Modernize legacy data models

Rebuild our revenue model from dbt, stored SQL, and spreadsheet overrides. Keep the outputs consistent before we switch.

Mage

I mapped the logic and prepared a modernized workflow for review.

  • Import existing dbt models, SQL, scripts, and spreadsheet rules
  • Map source tables, joins, filters, and metric definitions
  • Generate workflow blocks for the rebuilt model
  • Run old and new outputs side by side
  • Check row counts, schema, nulls, freshness, and business rules
  • Prepare lineage, ownership, and release review

Use AI to understand existing logic, rebuild it as governed workflows, and validate every output before your team switches over.

Make critical logic safe to change

Mage turns hidden rules and brittle models into workflows with visible sources, lineage, checks, and release controls.

Revenue model
Tablestripe_customers
SQLaccount_join.sql
SQLrevenue_model.sql
dbtdbt mart
Sheetoverride sheet
Downstreamdashboard dependency

Understand what exists. Surface the tables, joins, dbt models, SQL, scripts, spreadsheets, and downstream dependencies behind the model.

revenue_model.pyGenerated
1SELECT2 account_id,3 SUM(amount) AS revenue4FROM stripe_transactions5GROUP BY account_id67@transform8def build_revenue_model(df):9 return validate_schema(df)

Rebuild with AI. Generate SQL, dbt, Python, and medallion-style workflow logic from existing rules and business intent.

Revenue workflowv11 → v12
Staging
FilesChecksScheduleSources
3 files changedChanged by Merlin · 12m ago
18- WHERE revenue > 018+ WHERE revenue >= 10019GROUP BY account_id

Govern every change. Control edits, approvals, deployments, ownership, versions, permissions, and audit trails.

Old
New

Prove the output matches. Compare old and new results across history, metrics, row counts, schemas, and reconciliation checks.

One fragile model becomes a governed workflow

Mage turns trapped logic into sources, transformations, checks, approvals, schedules, and reusable outputs.

Rebuild our revenue model from the existing dbt project, SQL, and spreadsheet overrides. Preserve monthly revenue, ARR, and account-level outputs, then compare the old and new models before we switch.

The modernized revenue workflow is ready to review. I rebuilt the existing logic as inspectable workflow blocks and compared its outputs against the current model.

Output comparisonWithin tolerance
Current modelModernized workflow

99.8% matched · Monthly revenue, ARR, and accounts checked

Ask. Modernize our revenue model without changing trusted outputs.

Discover. AI Sidekick maps sources, joins, SQL, dbt models, scripts, and spreadsheet overrides.

Rebuild. Mage generates inspectable workflow blocks in SQL, dbt, Python, or R.

Validate. Autopilot compares old and new outputs against history, checks, and business rules.

Govern. Teams review lineage, owners, permissions, schedules, and release controls.

Release. The workflow runs in production and becomes reusable context for downstream teams and agents.

The systems behind every modernized model

Logic discovery Inspect sources, joins, columns, dbt models, SQL, scripts, spreadsheets, and output patterns.

AI-generated models Generate SQL, dbt, Python, R, tests, documentation, and medallion-style layers from existing rules.

Context-aware refactoring Update names, schemas, dependencies, macros, and block logic without losing workflow context.

Side-by-side validation Compare old and new outputs across row counts, schemas, metrics, joins, windows, and reconciliation rules.

Regression and intent checks Describe what must stay true. Mage checks data quality, business rules, and model intent after release.

Production recovery Retry, replay, backfill, recover failed runs, and optimize resources as the model scales.

Reusable business context Preserve definitions, lineage, ownership, checks, run history, and model outputs.

Governed reuse Give teams and agents the right context, permissions, freshness, and scope.

Context activation Use modernized outputs across dashboards, APIs, automations, RAG pipelines, products, and agents.

Start with the logic your team is afraid to touch

Bring Mage the model, rule, script, or workflow that still works but is too fragile to evolve.

Migrate dbt projects

Move dbt models into workflows that run with sources, checks, schedules, lineage, and downstream delivery.

Rebuild stored procedures

Turn database-resident logic into inspectable workflows your team can review, test, validate, and change.

Standardize business metrics

Move formulas, overrides, mappings, and metric definitions into governed workflows for revenue, churn, margin, and pipeline.

Start with a dbt project, stored procedure, spreadsheet model, report logic, fragile script, or metric definition your team depends on but cannot safely change.