All Modules

SQL Centralize

Data Replication Platform

Minimally invasive, foreign key aware, multi-tier replication platform. Consolidation, distribution (pub/sub), and ETL variants for SQL Server and PostgreSQL.

Replication Modes

⬇️

Consolidation

Many sources → One central database

⬆️

Distribution

One source → Many targets

🔄

Pub/Sub

Event-driven selective sync

🔀

ETL

Transform during replication

Foreign Key Awareness

Replicates data in the correct order to maintain referential integrity

DEPENDENCY-AWARE REPLICATION ORDER
═══════════════════════════════════════════════════════════════

Source Database Analysis:
┌─────────────────────────────────────────────────────────────┐
│  Orders ──FK──► Customers                                   │
│  OrderItems ──FK──► Orders ──FK──► Products                │
│  Shipments ──FK──► Orders                                   │
│  Invoices ──FK──► Orders ──FK──► Customers                 │
└─────────────────────────────────────────────────────────────┘

Generated Replication Order:
  Step 1: Customers, Products       (no dependencies)
  Step 2: Orders                    (depends on Customers)
  Step 3: OrderItems, Shipments     (depends on Orders)
  Step 4: Invoices                  (depends on Orders)

Benefits:
  ✓ No FK violation errors
  ✓ No need to disable constraints
  ✓ Transactionally consistent
  ✓ Automatic rollback on failure

Multi-Tier Topology

MULTI-TIER REPLICATION EXAMPLE
═══════════════════════════════════════════════════════════════

                        ┌─────────────────┐
                        │   HEADQUARTERS  │
                        │   (Central DB)  │
                        └────────┬────────┘
                                 │
            ┌────────────────────┼────────────────────┐
            │                    │                    │
            ▼                    ▼                    ▼
    ┌───────────────┐   ┌───────────────┐   ┌───────────────┐
    │   REGION US   │   │  REGION EU    │   │  REGION APAC  │
    │   (Tier 1)    │   │   (Tier 1)    │   │   (Tier 1)    │
    └───────┬───────┘   └───────┬───────┘   └───────┬───────┘
            │                   │                   │
     ┌──────┼──────┐           ...                 ...
     │      │      │
     ▼      ▼      ▼
  ┌─────┐┌─────┐┌─────┐
  │ NY  ││ LA  ││ CHI │
  │(T2) ││(T2) ││(T2) │
  └─────┘└─────┘└─────┘

Sync Direction: ↕ Bidirectional (configurable)
Conflict Resolution: Last-write-wins / Custom rules

Simple Configuration

# sql2ai-centralize.yaml
topology:
  mode: consolidation
  sources:
    - name: branch_ny
      connection: ${NY_DB_CONNECTION}
      tables: [Customers, Orders, Products]

    - name: branch_la
      connection: ${LA_DB_CONNECTION}
      tables: [Customers, Orders, Products]

  target:
    name: headquarters
    connection: ${HQ_DB_CONNECTION}

replication:
  schedule: "*/5 * * * *"  # Every 5 minutes
  batch_size: 1000
  parallel_tables: 4

  conflict_resolution:
    strategy: last_write_wins
    timestamp_column: ModifiedAt

  filters:
    - table: Orders
      where: "Status != 'Draft'"

  transforms:
    - table: Customers
      add_column:
        name: SourceBranch
        value: "${source.name}"

Key Features

FK Awareness

Automatic dependency ordering based on foreign keys

Minimally Invasive

No triggers or schema changes required on source

Change Tracking

Uses CDC, temporal tables, or polling

Conflict Resolution

Configurable strategies for bidirectional sync

Transform Support

Apply transformations during replication

Monitoring

Real-time sync status and lag metrics

Replication Dashboard

╔══════════════════════════════════════════════════════════════════╗
║                    SQL CENTRALIZE STATUS                          ║
╠══════════════════════════════════════════════════════════════════╣
║ TOPOLOGY: Consolidation (3 sources → 1 target)                   ║
╠══════════════════════════════════════════════════════════════════╣
║ SOURCE STATUS                                                     ║
║ ─────────────────────────────────────────────────────────────── ║
║ branch_ny     │ ✓ Connected │ Lag: 12s  │ Last: 2min ago        ║
║ branch_la     │ ✓ Connected │ Lag: 8s   │ Last: 2min ago        ║
║ branch_chi    │ ✓ Connected │ Lag: 15s  │ Last: 2min ago        ║
╠══════════════════════════════════════════════════════════════════╣
║ LAST SYNC CYCLE                                                   ║
║ ─────────────────────────────────────────────────────────────── ║
║ Duration:     45 seconds                                          ║
║ Rows synced:  12,847                                              ║
║ Conflicts:    3 (resolved: last-write-wins)                       ║
║ Errors:       0                                                   ║
╠══════════════════════════════════════════════════════════════════╣
║ TABLE SYNC STATUS                                                 ║
║ ─────────────────────────────────────────────────────────────── ║
║ Customers     │ 2,341 rows │ ✓ In sync                           ║
║ Orders        │ 8,472 rows │ ✓ In sync                           ║
║ Products      │ 1,234 rows │ ✓ In sync                           ║
║ OrderItems    │ 45,892 rows│ ✓ In sync                           ║
╚══════════════════════════════════════════════════════════════════╝

Centralize Your Data

Multi-tier replication with FK awareness and minimal source impact.

No credit card required • Free for individual developers